summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-09 14:14:04 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-09 06:40:12 -0800
commit7eb3440ac5152cba8940f6317df236bbc9aaef2f (patch)
tree883f7891b0c1d6cbcbdf97861079ac9fc9323493 /meta/recipes-devtools
parent2f4d784699fa82bf4a0abec226e85868cb4d9cde (diff)
downloadpoky-7eb3440ac5152cba8940f6317df236bbc9aaef2f.tar.gz
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. (From OE-Core rev: 50dc8bfbac42b9a9b52a2f7d0568740c41790c13) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools')
-rw-r--r--meta/recipes-devtools/rpm/rpm/rpmdeps-oecore.patch198
-rw-r--r--meta/recipes-devtools/rpm/rpm_5.4.0.bb3
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 @@
1Add an "rpmdeps-oecore" binary which allows batch processing of individual file
2dependencies in a similar manner to rpmdeps --provides --requires -v, prefixing
3each line of output with the filename that has the dependency.
4
5This is much faster than individually calling rpmdeps on each file.
6
7This binary is used by package.bbclass.
8
9Upstream-Status: Inappropriate [OE Specific]
10
11RP 2012/2/7
12
13---
14 tools/Makefile.am | 6 ++-
15 tools/rpmdeps-oecore.c | 147 ++++++++++++++++++++++++++++++++++++++++++++++++
16 2 files changed, 152 insertions(+), 1 deletions(-)
17 create mode 100644 tools/rpmdeps-oecore.c
18
19diff --git a/tools/Makefile.am b/tools/Makefile.am
20index f520843..2eba9bf 100644
21--- a/tools/Makefile.am
22+++ b/tools/Makefile.am
23@@ -58,7 +58,7 @@ pkgbin_PROGRAMS = \
24 @WITH_AUGEAS_AUGTOOL@ chroot cp @WITH_CUDF_CUDFTOOL@ find mtree \
25 @WITH_SEMANAGE_SEMODULE@ wget \
26 rpmcache rpmdigest rpmrepo rpmspecdump \
27- rpmcmp rpmdeps sqlite3 @WITH_KEYUTILS_RPMKEY@ @WITH_LIBELF_DEBUGEDIT@
28+ rpmcmp rpmdeps rpmdeps-oecore sqlite3 @WITH_KEYUTILS_RPMKEY@ @WITH_LIBELF_DEBUGEDIT@
29 dist_man_MANS = rpmgrep.1
30
31 augtool_SOURCES = augtool.c
32@@ -155,6 +155,10 @@ rpmdeps_SOURCES = rpmdeps.c
33 rpmdeps_LDFLAGS = @LDFLAGS_STATIC@ $(LDFLAGS)
34 rpmdeps_LDADD = $(RPM_LDADD_COMMON)
35
36+rpmdeps_oecore_SOURCES = rpmdeps-oecore.c
37+rpmdeps_oecore_LDFLAGS = @LDFLAGS_STATIC@ $(LDFLAGS)
38+rpmdeps_oecore_LDADD = $(RPM_LDADD_COMMON)
39+
40 rpmdigest_SOURCES = rpmdigest.c
41 rpmdigest_LDFLAGS = @LDFLAGS_STATIC@ $(LDFLAGS)
42 rpmdigest_LDADD = $(RPMIO_LDADD_COMMON)
43diff --git a/tools/rpmdeps-oecore.c b/tools/rpmdeps-oecore.c
44new file mode 100644
45index 0000000..e646da9
46--- /dev/null
47+++ b/tools/rpmdeps-oecore.c
48@@ -0,0 +1,147 @@
49+#include "system.h"
50+const char *__progname;
51+
52+#include <rpmio.h>
53+#include <rpmiotypes.h>
54+#include <rpmcb.h>
55+#include <argv.h>
56+#include <rpmtypes.h>
57+#include <rpmtag.h>
58+
59+#include <rpmds.h>
60+#define _RPMFC_INTERNAL /* XXX for debugging */
61+#include <rpmfc.h>
62+
63+#include <rpmcli.h>
64+
65+#include "debug.h"
66+
67+/*@unchecked@*/
68+char *progname;
69+
70+#define RPMDEP_RPMFC 1
71+
72+static int rpmdepPrint(char *filename, rpmds ds, FILE * fp)
73+{
74+ if (fp == NULL) fp = stderr;
75+
76+ ds = rpmdsInit(ds);
77+ while (rpmdsNext(ds) >= 0) {
78+ fprintf(fp, "%s %s: %s\n", filename, rpmdsType(ds), rpmdsDNEVR(ds)+2);
79+ }
80+ return 0;
81+}
82+
83+static struct poptOption optionsTable[] = {
84+
85+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, rpmcliAllPoptTable, 0,
86+ N_("Common options:"),
87+ NULL },
88+
89+ POPT_AUTOALIAS
90+ POPT_AUTOHELP
91+ POPT_TABLEEND
92+};
93+
94+
95+int
96+main(int argc, char *argv[])
97+{
98+ poptContext optCon;
99+ ARGV_t av = NULL;
100+ rpmfc fc = NULL;
101+ FILE * fp = NULL;
102+ int flags = 0;
103+ int ac = 0;
104+ int ec = 1;
105+ int xx;
106+ int i;
107+ char buf[BUFSIZ];
108+ int nddict;
109+ const char * s;
110+ char * se;
111+ const char * fn;
112+ const char * N;
113+ const char * EVR;
114+ evrFlags Flags;
115+ unsigned char deptype;
116+ int ix;
117+ rpmds ds;
118+
119+/*@-modobserver@*/
120+ if ((progname = strrchr(argv[0], '/')) != NULL)
121+ progname++;
122+ else
123+ progname = argv[0];
124+/*@=modobserver@*/
125+
126+ optCon = rpmcliInit(argc, argv, optionsTable);
127+ if (optCon == NULL)
128+ goto exit;
129+
130+ av = poptGetArgs(optCon);
131+ ac = argvCount(av);
132+
133+ if (ac == 0) {
134+ av = NULL;
135+ xx = argvFgets(&av, NULL);
136+ ac = argvCount(av);
137+ }
138+
139+ /* Make sure file names are sorted. */
140+ xx = argvSort(av, NULL);
141+
142+ /* Build file class dictionary. */
143+ fc = rpmfcNew();
144+ xx = rpmfcClassify(fc, av, NULL);
145+
146+ /* Build file/package dependency dictionary. */
147+ xx = rpmfcApply(fc);
148+
149+ /* Generate per-file indices into package dependencies. */
150+ nddict = argvCount(fc->ddict);
151+
152+ for (i = 0; i < nddict; i++) {
153+ s = fc->ddict[i];
154+
155+ /* Parse out (file#,deptype,N,EVR,Flags) */
156+ ix = strtol(s, &se, 10);
157+ assert(se != NULL);
158+ deptype = *se++;
159+ se++;
160+ N = se;
161+ while (*se && *se != ' ')
162+ se++;
163+ *se++ = '\0';
164+ EVR = se;
165+ while (*se && *se != ' ')
166+ se++;
167+ *se++ = '\0';
168+ Flags = strtol(se, NULL, 16);
169+
170+ switch (deptype) {
171+ default:
172+ /*@switchbreak@*/ break;
173+ case 'P':
174+ ds = rpmdsSingle(RPMTAG_PROVIDENAME, N, EVR, Flags);
175+ rpmdepPrint((char *)fc->fn[ix], ds, stdout);
176+ (void)rpmdsFree(ds);
177+ ds = NULL;
178+ /*@switchbreak@*/ break;
179+ case 'R':
180+ ds = rpmdsSingle(RPMTAG_REQUIRENAME, N, EVR, Flags);
181+ rpmdepPrint((char *)fc->fn[ix], ds, stdout);
182+ (void)rpmdsFree(ds);
183+ ds = NULL;
184+ /*@switchbreak@*/ break;
185+ }
186+ }
187+
188+ fc = rpmfcFree(fc);
189+
190+ ec = 0;
191+
192+exit:
193+ optCon = rpmcliFini(optCon);
194+ return ec;
195+}
196--
1971.7.4.1
198
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"
45DEPENDS = "bzip2 zlib db openssl elfutils expat libpcre attr acl popt ${extrarpmdeps}" 45DEPENDS = "bzip2 zlib db openssl elfutils expat libpcre attr acl popt ${extrarpmdeps}"
46extrarpmdeps = "python perl" 46extrarpmdeps = "python perl"
47extrarpmdeps_virtclass-native = "file-native" 47extrarpmdeps_virtclass-native = "file-native"
48PR = "r32" 48PR = "r33"
49 49
50# rpm2cpio is a shell script, which is part of the rpm src.rpm. It is needed 50# rpm2cpio is a shell script, which is part of the rpm src.rpm. It is needed
51# in order to extract the distribution SRPM into a format we can extract... 51# 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
68 file://rpm-scriptletexechelper.patch \ 68 file://rpm-scriptletexechelper.patch \
69 file://fix_for_automake_1.11.2.patch \ 69 file://fix_for_automake_1.11.2.patch \
70 file://pythondeps.sh \ 70 file://pythondeps.sh \
71 file://rpmdeps-oecore.patch \
71 " 72 "
72 73
73# file://rpm-autoconf.patch \ 74# file://rpm-autoconf.patch \