diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-09 14:14:04 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-09 06:39:52 -0800 |
commit | 50dc8bfbac42b9a9b52a2f7d0568740c41790c13 (patch) | |
tree | ec553406e31be7a36c27dcebf70392e70336efc8 | |
parent | a91d7a0c27d0ec763cb794be5282f7d34a3135fe (diff) | |
download | openembedded-core-50dc8bfbac42b9a9b52a2f7d0568740c41790c13.tar.gz openembedded-core-50dc8bfbac42b9a9b52a2f7d0568740c41790c13.tar.bz2 openembedded-core-50dc8bfbac42b9a9b52a2f7d0568740c41790c13.zip |
rpm 5.4.0: Add rpmdeps-oecore to replace rpmdeps for package.bbclass
This is a performance enhancement by adding a binary allowing batch processing
of individual file dependencies. The second patch in this series uses the binary
this patch creates.
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-devtools/rpm/rpm/rpmdeps-oecore.patch | 198 | ||||
-rw-r--r-- | meta/recipes-devtools/rpm/rpm_5.4.0.bb | 3 |
2 files changed, 200 insertions, 1 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpmdeps-oecore.patch b/meta/recipes-devtools/rpm/rpm/rpmdeps-oecore.patch new file mode 100644 index 0000000000..1667901b63 --- /dev/null +++ b/meta/recipes-devtools/rpm/rpm/rpmdeps-oecore.patch @@ -0,0 +1,198 @@ +Add an "rpmdeps-oecore" binary which allows batch processing of individual file +dependencies in a similar manner to rpmdeps --provides --requires -v, prefixing +each line of output with the filename that has the dependency. + +This is much faster than individually calling rpmdeps on each file. + +This binary is used by package.bbclass. + +Upstream-Status: Inappropriate [OE Specific] + +RP 2012/2/7 + +--- + tools/Makefile.am | 6 ++- + tools/rpmdeps-oecore.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 152 insertions(+), 1 deletions(-) + create mode 100644 tools/rpmdeps-oecore.c + +diff --git a/tools/Makefile.am b/tools/Makefile.am +index f520843..2eba9bf 100644 +--- a/tools/Makefile.am ++++ b/tools/Makefile.am +@@ -58,7 +58,7 @@ pkgbin_PROGRAMS = \ + @WITH_AUGEAS_AUGTOOL@ chroot cp @WITH_CUDF_CUDFTOOL@ find mtree \ + @WITH_SEMANAGE_SEMODULE@ wget \ + rpmcache rpmdigest rpmrepo rpmspecdump \ +- rpmcmp rpmdeps sqlite3 @WITH_KEYUTILS_RPMKEY@ @WITH_LIBELF_DEBUGEDIT@ ++ rpmcmp rpmdeps rpmdeps-oecore sqlite3 @WITH_KEYUTILS_RPMKEY@ @WITH_LIBELF_DEBUGEDIT@ + dist_man_MANS = rpmgrep.1 + + augtool_SOURCES = augtool.c +@@ -155,6 +155,10 @@ rpmdeps_SOURCES = rpmdeps.c + rpmdeps_LDFLAGS = @LDFLAGS_STATIC@ $(LDFLAGS) + rpmdeps_LDADD = $(RPM_LDADD_COMMON) + ++rpmdeps_oecore_SOURCES = rpmdeps-oecore.c ++rpmdeps_oecore_LDFLAGS = @LDFLAGS_STATIC@ $(LDFLAGS) ++rpmdeps_oecore_LDADD = $(RPM_LDADD_COMMON) ++ + rpmdigest_SOURCES = rpmdigest.c + rpmdigest_LDFLAGS = @LDFLAGS_STATIC@ $(LDFLAGS) + rpmdigest_LDADD = $(RPMIO_LDADD_COMMON) +diff --git a/tools/rpmdeps-oecore.c b/tools/rpmdeps-oecore.c +new file mode 100644 +index 0000000..e646da9 +--- /dev/null ++++ b/tools/rpmdeps-oecore.c +@@ -0,0 +1,147 @@ ++#include "system.h" ++const char *__progname; ++ ++#include <rpmio.h> ++#include <rpmiotypes.h> ++#include <rpmcb.h> ++#include <argv.h> ++#include <rpmtypes.h> ++#include <rpmtag.h> ++ ++#include <rpmds.h> ++#define _RPMFC_INTERNAL /* XXX for debugging */ ++#include <rpmfc.h> ++ ++#include <rpmcli.h> ++ ++#include "debug.h" ++ ++/*@unchecked@*/ ++char *progname; ++ ++#define RPMDEP_RPMFC 1 ++ ++static int rpmdepPrint(char *filename, rpmds ds, FILE * fp) ++{ ++ if (fp == NULL) fp = stderr; ++ ++ ds = rpmdsInit(ds); ++ while (rpmdsNext(ds) >= 0) { ++ fprintf(fp, "%s %s: %s\n", filename, rpmdsType(ds), rpmdsDNEVR(ds)+2); ++ } ++ return 0; ++} ++ ++static struct poptOption optionsTable[] = { ++ ++ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0, ++ N_("Common options:"), ++ NULL }, ++ ++ POPT_AUTOALIAS ++ POPT_AUTOHELP ++ POPT_TABLEEND ++}; ++ ++ ++int ++main(int argc, char *argv[]) ++{ ++ poptContext optCon; ++ ARGV_t av = NULL; ++ rpmfc fc = NULL; ++ FILE * fp = NULL; ++ int flags = 0; ++ int ac = 0; ++ int ec = 1; ++ int xx; ++ int i; ++ char buf[BUFSIZ]; ++ int nddict; ++ const char * s; ++ char * se; ++ const char * fn; ++ const char * N; ++ const char * EVR; ++ evrFlags Flags; ++ unsigned char deptype; ++ int ix; ++ rpmds ds; ++ ++/*@-modobserver@*/ ++ if ((progname = strrchr(argv[0], '/')) != NULL) ++ progname++; ++ else ++ progname = argv[0]; ++/*@=modobserver@*/ ++ ++ optCon = rpmcliInit(argc, argv, optionsTable); ++ if (optCon == NULL) ++ goto exit; ++ ++ av = poptGetArgs(optCon); ++ ac = argvCount(av); ++ ++ if (ac == 0) { ++ av = NULL; ++ xx = argvFgets(&av, NULL); ++ ac = argvCount(av); ++ } ++ ++ /* Make sure file names are sorted. */ ++ xx = argvSort(av, NULL); ++ ++ /* Build file class dictionary. */ ++ fc = rpmfcNew(); ++ xx = rpmfcClassify(fc, av, NULL); ++ ++ /* Build file/package dependency dictionary. */ ++ xx = rpmfcApply(fc); ++ ++ /* Generate per-file indices into package dependencies. */ ++ nddict = argvCount(fc->ddict); ++ ++ for (i = 0; i < nddict; i++) { ++ s = fc->ddict[i]; ++ ++ /* Parse out (file#,deptype,N,EVR,Flags) */ ++ ix = strtol(s, &se, 10); ++ assert(se != NULL); ++ deptype = *se++; ++ se++; ++ N = se; ++ while (*se && *se != ' ') ++ se++; ++ *se++ = '\0'; ++ EVR = se; ++ while (*se && *se != ' ') ++ se++; ++ *se++ = '\0'; ++ Flags = strtol(se, NULL, 16); ++ ++ switch (deptype) { ++ default: ++ /*@switchbreak@*/ break; ++ case 'P': ++ ds = rpmdsSingle(RPMTAG_PROVIDENAME, N, EVR, Flags); ++ rpmdepPrint((char *)fc->fn[ix], ds, stdout); ++ (void)rpmdsFree(ds); ++ ds = NULL; ++ /*@switchbreak@*/ break; ++ case 'R': ++ ds = rpmdsSingle(RPMTAG_REQUIRENAME, N, EVR, Flags); ++ rpmdepPrint((char *)fc->fn[ix], ds, stdout); ++ (void)rpmdsFree(ds); ++ ds = NULL; ++ /*@switchbreak@*/ break; ++ } ++ } ++ ++ fc = rpmfcFree(fc); ++ ++ ec = 0; ++ ++exit: ++ optCon = rpmcliFini(optCon); ++ return ec; ++} +-- +1.7.4.1 + diff --git a/meta/recipes-devtools/rpm/rpm_5.4.0.bb b/meta/recipes-devtools/rpm/rpm_5.4.0.bb index 64ae5373be..eeca8230f2 100644 --- a/meta/recipes-devtools/rpm/rpm_5.4.0.bb +++ b/meta/recipes-devtools/rpm/rpm_5.4.0.bb @@ -45,7 +45,7 @@ LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1" DEPENDS = "bzip2 zlib db openssl elfutils expat libpcre attr acl popt ${extrarpmdeps}" extrarpmdeps = "python perl" extrarpmdeps_virtclass-native = "file-native" -PR = "r32" +PR = "r33" # rpm2cpio is a shell script, which is part of the rpm src.rpm. It is needed # in order to extract the distribution SRPM into a format we can extract... @@ -68,6 +68,7 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.0-0.20101229.src.rpm;ex file://rpm-scriptletexechelper.patch \ file://fix_for_automake_1.11.2.patch \ file://pythondeps.sh \ + file://rpmdeps-oecore.patch \ " # file://rpm-autoconf.patch \ |