summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2011-02-15 22:20:49 -0600
committerSaul Wold <sgw@linux.intel.com>2011-02-16 07:34:51 -0800
commitca649ef8253cbf69062322b5bdee4123ee4c4eca (patch)
treee6006e59ece4109391ddd09ad683bc28821cce5d /meta
parent0e4aa13e9eef50533d8385b7fa638f33d4248e78 (diff)
downloadpoky-ca649ef8253cbf69062322b5bdee4123ee4c4eca.tar.gz
rpm: Add the ability to use the platform file during install
Add a new rpm macro, rpmrc_platform_path to specify an alternative platform file. This is required to allow the dep resolver to identify compatible packages. Also workaround a minor problem with the --showrc command in RPM. A bug has been reported upstream on this. Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/package_rpm.bbclass15
-rw-r--r--meta/recipes-devtools/rpm/rpm/rpm-platform.patch132
-rw-r--r--meta/recipes-devtools/rpm/rpm/rpm-showrc.patch23
-rw-r--r--meta/recipes-devtools/rpm/rpm_5.4.0.bb8
4 files changed, 170 insertions, 8 deletions
diff --git a/meta/classes/package_rpm.bbclass b/meta/classes/package_rpm.bbclass
index cc262dc831..215be8d607 100644
--- a/meta/classes/package_rpm.bbclass
+++ b/meta/classes/package_rpm.bbclass
@@ -219,7 +219,8 @@ package_install_internal_rpm () {
219 219
220 # Generate an install solution by doing a --justdb install, then recreate it with 220 # Generate an install solution by doing a --justdb install, then recreate it with
221 # an actual package install! 221 # an actual package install!
222 ${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ 222 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
223 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
223 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \ 224 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
224 -D "__dbi_txn create nofsync" \ 225 -D "__dbi_txn create nofsync" \
225 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \ 226 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
@@ -235,7 +236,8 @@ package_install_internal_rpm () {
235 exit 1 236 exit 1
236 fi 237 fi
237 echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_${task}_attemptonly.${PID}" 238 echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_${task}_attemptonly.${PID}"
238 ${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ 239 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
240 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
239 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \ 241 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
240 -D "__dbi_txn create nofsync private" \ 242 -D "__dbi_txn create nofsync private" \
241 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \ 243 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
@@ -254,7 +256,8 @@ package_install_internal_rpm () {
254 cat /dev/null > ${target_rootfs}/install/recommend.list 256 cat /dev/null > ${target_rootfs}/install/recommend.list
255 while [ $loop -eq 1 ]; do 257 while [ $loop -eq 1 ]; do
256 # Dump the full set of recommends... 258 # Dump the full set of recommends...
257 ${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ 259 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
260 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
258 -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${confbase}.macro`" \ 261 -D "_dbpath ${IMAGE_ROOTFS}/install" -D "`cat ${confbase}.macro`" \
259 -D "__dbi_txn create nofsync private" \ 262 -D "__dbi_txn create nofsync private" \
260 -qa --qf "[%{RECOMMENDS}\n]" | sort -u > ${target_rootfs}/install/recommend 263 -qa --qf "[%{RECOMMENDS}\n]" | sort -u > ${target_rootfs}/install/recommend
@@ -273,7 +276,8 @@ package_install_internal_rpm () {
273 continue 276 continue
274 fi 277 fi
275 echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_{task}_recommend.${PID}" 278 echo "Attempting $pkg_name..." >> "${WORKDIR}/temp/log.do_{task}_recommend.${PID}"
276 ${RPM} -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ 279 ${RPM} --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
280 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
277 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \ 281 -D "_dbpath ${target_rootfs}/install" -D "`cat ${confbase}.macro`" \
278 -D "__dbi_txn create nofsync private" \ 282 -D "__dbi_txn create nofsync private" \
279 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \ 283 -U --justdb --noscripts --notriggers --noparentdirs --nolinktos --ignoresize \
@@ -293,7 +297,8 @@ package_install_internal_rpm () {
293 297
294 # Attempt install 298 # Attempt install
295 ${RPM} --root ${target_rootfs} \ 299 ${RPM} --root ${target_rootfs} \
296 -D "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \ 300 --predefine "_rpmds_sysinfo_path ${target_rootfs}/etc/rpm/sysinfo" \
301 --predefine "_rpmrc_platform_path ${target_rootfs}/etc/rpm/platform" \
297 -D "_dbpath ${rpmlibdir}" \ 302 -D "_dbpath ${rpmlibdir}" \
298 --noscripts --notriggers --noparentdirs --nolinktos \ 303 --noscripts --notriggers --noparentdirs --nolinktos \
299 -D "__dbi_txn create nofsync private" \ 304 -D "__dbi_txn create nofsync private" \
diff --git a/meta/recipes-devtools/rpm/rpm/rpm-platform.patch b/meta/recipes-devtools/rpm/rpm/rpm-platform.patch
new file mode 100644
index 0000000000..09a1c13048
--- /dev/null
+++ b/meta/recipes-devtools/rpm/rpm/rpm-platform.patch
@@ -0,0 +1,132 @@
1Fix up platform and related sysinfo file loading.
2
3This ensures that RPM knows the compatible set of package types at all times.
4
5Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
6
7diff -ur rpm-5.4.0.orig/lib/depends.c rpm-5.4.0/lib/depends.c
8--- rpm-5.4.0.orig/lib/depends.c 2011-02-15 20:40:13.002849708 -0600
9+++ rpm-5.4.0/lib/depends.c 2011-02-15 20:47:05.838981632 -0600
10@@ -248,7 +248,7 @@
11 he->p.ptr = _free(he->p.ptr);
12 }
13
14-#if defined(RPM_VENDOR_WINDRIVER)
15+#if defined(RPM_VENDOR_WINDRIVER) && !defined(RPM_VENDOR_POKY)
16 /*
17 * If we're capable of installing multiple colors
18 * but at least one of the packages are white (0), we
19@@ -505,7 +505,7 @@
20 return 0;
21 }
22
23-#if defined(RPM_VENDOR_WINDRIVER)
24+#if defined(RPM_VENDOR_WINDRIVER) && !defined(RPM_VENDOR_POKY)
25 /* Is "compat" compatible w/ arch? */
26 int _isCompatibleArch(const char * arch, const char * compat)
27 {
28@@ -649,7 +649,7 @@
29
30 if (arch == NULL || (parch = rpmteA(p)) == NULL)
31 continue;
32-#if defined(RPM_VENDOR_WINDRIVER)
33+#if defined(RPM_VENDOR_WINDRIVER) && !defined(RPM_VENDOR_POKY)
34 /* XXX hackery for alias matching. */
35 if (!_isCompatibleArch(arch, parch))
36 continue;
37@@ -815,6 +815,12 @@
38 return rc;
39 }
40
41+#if defined(RPM_VENDOR_WINDRIVER)
42+#define _ETC_RPM_SYSINFO "%{_etcrpm}/sysinfo"
43+#else
44+#define _ETC_RPM_SYSINFO SYSCONFIGDIR "/sysinfo"
45+#endif
46+
47 /*@only@*/ /*@null@*/ /*@unchecked@*/
48 static char *sysinfo_path = NULL;
49
50@@ -1296,7 +1302,7 @@
51 sysinfo_path = rpmExpand("%{?_rpmds_sysinfo_path}", NULL);
52 if (!(sysinfo_path != NULL && *sysinfo_path == '/')) {
53 sysinfo_path = _free(sysinfo_path);
54- sysinfo_path = xstrdup(SYSCONFIGDIR "/sysinfo");
55+ sysinfo_path = rpmExpand(_ETC_RPM_SYSINFO, NULL);
56 }
57 }
58
59diff -ur rpm-5.4.0.orig/lib/rpmds.c rpm-5.4.0/lib/rpmds.c
60--- rpm-5.4.0.orig/lib/rpmds.c 2011-02-15 20:40:13.004855352 -0600
61+++ rpm-5.4.0/lib/rpmds.c 2011-02-15 20:41:55.598846670 -0600
62@@ -1737,7 +1737,7 @@
63 /*@-observertrans @*/
64 _sysinfo_path = _free(_sysinfo_path);
65 /*@=observertrans @*/
66- _sysinfo_path = xstrdup(_ETC_RPM_SYSINFO);
67+ _sysinfo_path = rpmExpand(_ETC_RPM_SYSINFO, NULL);
68 }
69 }
70 /*@=modobserver@*/
71diff -ur rpm-5.4.0.orig/lib/rpmrc.c rpm-5.4.0/lib/rpmrc.c
72--- rpm-5.4.0.orig/lib/rpmrc.c 2011-02-15 20:40:13.006853913 -0600
73+++ rpm-5.4.0/lib/rpmrc.c 2011-02-15 20:44:39.708972391 -0600
74@@ -38,7 +38,13 @@
75 static const char * configTarget = NULL;
76
77 /*@observer@*/ /*@unchecked@*/
78-static const char * platform = SYSCONFIGDIR "/platform";
79+#if defined(RPM_VENDOR_WINDRIVER)
80+#define _ETC_RPM_PLATFORM "%{_etcrpm}/platform"
81+#else
82+#define _ETC_RPM_PLATFORM SYSCONFIGDIR "/platform"
83+#endif
84+
85+static const char * _platform = NULL;
86
87 /*@only@*/ /*@relnull@*/ /*@unchecked@*/
88 void * platpat = NULL;
89@@ -685,16 +691,17 @@
90 int rc;
91
92 while (!gotDefaults) {
93-#if defined(RPM_VENDOR_WINDRIVER)
94- const char * _platform = rpmGetPath(__etcrpm, "/platform", NULL);
95-#else
96- const char * _platform = platform;
97-#endif
98+ if (_platform == NULL) {
99+ _platform = rpmExpand("%{?_rpmrc_platform_path}", NULL);
100+ /* XXX may need to validate path existence somewhen. */
101+ if (!(_platform != NULL && *_platform == '/')) {
102+ _platform = _free(_platform);
103+ _platform = rpmExpand(_ETC_RPM_PLATFORM, NULL);
104+ }
105+ }
106 CVOG_t cvog = NULL;
107 #if defined(RPM_VENDOR_OPENPKG) /* larger-utsname */
108 const char *cp;
109-#endif
110-#if defined(RPM_VENDOR_OPENPKG) /* larger-utsname */
111 /* utsname fields on some platforms (like HP-UX) are very small
112 (just about 8 characters). This is too small for OpenPKG, so cheat! */
113 rc = uname(&un_real);
114@@ -771,9 +778,7 @@
115 if (cp != NULL && cp != _platform)
116 cp = _free(cp);
117 #endif
118-#if defined(RPM_VENDOR_WINDRIVER)
119 _platform = _free(_platform);
120-#endif
121
122 if (configTarget && !parseCVOG(configTarget, &cvog) && cvog != NULL) {
123 gotDefaults = 1;
124@@ -1096,6 +1101,8 @@
125
126 #ifdef PREMACROFILES
127 if (rpmReadRC(PREMACROFILES)) return -1;
128+#else
129+ if (rpmReadRC(NULL)) return -1;
130 #endif
131
132 /* Reset umask to its default umask(2) value. */
diff --git a/meta/recipes-devtools/rpm/rpm/rpm-showrc.patch b/meta/recipes-devtools/rpm/rpm/rpm-showrc.patch
new file mode 100644
index 0000000000..5051ce604b
--- /dev/null
+++ b/meta/recipes-devtools/rpm/rpm/rpm-showrc.patch
@@ -0,0 +1,23 @@
1Workaround for a memory leak in --showrc.
2
3Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
4
5diff -ur rpm-5.4.0.orig/lib/rpmrc.c rpm-5.4.0/lib/rpmrc.c
6--- rpm-5.4.0.orig/lib/rpmrc.c 2011-02-15 20:40:13.006853913 -0600
7+++ rpm-5.4.0/lib/rpmrc.c 2011-02-15 20:44:39.708972391 -0600
8@@ -1216,11 +1223,15 @@
9 if (DNEVR != NULL)
10 fprintf(fp, " %s\n", DNEVR+2);
11 }
12+#if 0
13 (void)rpmdsFree(ds);
14 ds = NULL;
15+#endif
16 fprintf(fp, "\n");
17 }
18+#if 0
19 PRCO = rpmdsFreePRCO(PRCO);
20+#endif
21 }
22
23 if (rpmIsVerbose()) {
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.0.bb b/meta/recipes-devtools/rpm/rpm_5.4.0.bb
index 56fcd9c62f..93951d2c61 100644
--- a/meta/recipes-devtools/rpm/rpm_5.4.0.bb
+++ b/meta/recipes-devtools/rpm/rpm_5.4.0.bb
@@ -43,7 +43,7 @@ LICENSE = "LGPL 2.1"
43LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1" 43LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1"
44 44
45DEPENDS = "bzip2 zlib python perl db openssl elfutils expat libpcre attr acl popt" 45DEPENDS = "bzip2 zlib python perl db openssl elfutils expat libpcre attr acl popt"
46PR = "r11" 46PR = "r12"
47 47
48# rpm2cpio is a shell script, which is part of the rpm src.rpm. It is needed 48# rpm2cpio is a shell script, which is part of the rpm src.rpm. It is needed
49# in order to extract the distribution SRPM into a format we can extract... 49# in order to extract the distribution SRPM into a format we can extract...
@@ -51,7 +51,9 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.0-0.20101229.src.rpm;ex
51 file://perfile_rpmdeps.sh \ 51 file://perfile_rpmdeps.sh \
52 file://rpm-autogen.patch \ 52 file://rpm-autogen.patch \
53 file://rpm-libsql-fix.patch \ 53 file://rpm-libsql-fix.patch \
54 file://header-include-fix.patch \ 54 file://header-include-fix.patch \
55 file://rpm-platform.patch \
56 file://rpm-showrc.patch \
55 " 57 "
56 58
57# file://hdraddorappend.patch \ 59# file://hdraddorappend.patch \
@@ -155,7 +157,7 @@ EXTRA_OECONF = "--verbose \
155 --with-path-macros=${rpm_macros} \ 157 --with-path-macros=${rpm_macros} \
156 --with-bugreport=http://bugzilla.pokylinux.org" 158 --with-bugreport=http://bugzilla.pokylinux.org"
157 159
158CFLAGS_append = " -DRPM_VENDOR_WINDRIVER" 160CFLAGS_append = " -DRPM_VENDOR_WINDRIVER -DRPM_VENDOR_POKY"
159 161
160PACKAGES = "${PN}-dbg ${PN} ${PN}-doc ${PN}-libs ${PN}-dev ${PN}-common ${PN}-build python-rpm-dbg python-rpm perl-module-rpm perl-module-rpm-dev ${PN}-locale" 162PACKAGES = "${PN}-dbg ${PN} ${PN}-doc ${PN}-libs ${PN}-dev ${PN}-common ${PN}-build python-rpm-dbg python-rpm perl-module-rpm perl-module-rpm-dev ${PN}-locale"
161 163