aboutsummaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/rpm
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2012-12-11 08:09:40 -0600
committerSaul Wold <sgw@linux.intel.com>2012-12-14 15:17:19 -0800
commit355a621caca66ed393d36fff6be8918921cf45ae (patch)
treeae3728565bbc77c5cb78569b3afe83b801354aa7 /meta/recipes-devtools/rpm
parent230068110e1cda349f9bf3886d8d06ac46deea37 (diff)
downloadopenembedded-core-contrib-355a621caca66ed393d36fff6be8918921cf45ae.tar.gz
rpm/smart: Fix runtime-relocation issues w/ RPM and Smart
Fix runtime-relocation issues with the RPM and Smart wrappers. In addition the patches were necessary to fix related problems. The changes to the includes three categories of issues: *) Incorrect pathname evaluations *) Incorrect evaluation of the /etc/rpm/platform file contents *) Confusing vendor #define checks Finally, a simple way to debug the platformScore was added as that is necessary to debug how this works and into the smart system. Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'meta/recipes-devtools/rpm')
-rw-r--r--meta/recipes-devtools/rpm/rpm/rpm-debug-platform.patch65
-rw-r--r--meta/recipes-devtools/rpm/rpm/rpm-platform.patch2
-rw-r--r--meta/recipes-devtools/rpm/rpm/rpm-platform2.patch87
-rw-r--r--meta/recipes-devtools/rpm/rpm_5.4.9.bb41
4 files changed, 157 insertions, 38 deletions
diff --git a/meta/recipes-devtools/rpm/rpm/rpm-debug-platform.patch b/meta/recipes-devtools/rpm/rpm/rpm-debug-platform.patch
new file mode 100644
index 0000000000..25ebbdcbed
--- /dev/null
+++ b/meta/recipes-devtools/rpm/rpm/rpm-debug-platform.patch
@@ -0,0 +1,65 @@
+Debug the platform score generation...
+
+Index: rpm-5.4.9/lib/rpmrc.c
+===================================================================
+--- rpm-5.4.9.orig/lib/rpmrc.c
++++ rpm-5.4.9/lib/rpmrc.c
+@@ -465,6 +465,8 @@ static rpmRC rpmPlatform(const char * pl
+
+ rc = (rpmRC) rpmiobSlurp(platform, &iob);
+
++ fprintf(stderr, "D: rpmPlatform file %s\n", platform);
++
+ if (rc || iob == NULL) {
+ rc = RPMRC_FAIL;
+ goto exit;
+@@ -486,6 +488,7 @@ static rpmRC rpmPlatform(const char * pl
+ while (--t > p && xisspace(*t))
+ *t = '\0';
+ if (t > p) {
++ fprintf(stderr, "D: rpmPlatform mireAppend REGEX %s\n", p);
+ xx = mireAppend(RPMMIRE_REGEX, 0, p, NULL, &mi_re, &mi_nre);
+ }
+ continue;
+@@ -503,6 +506,11 @@ static rpmRC rpmPlatform(const char * pl
+ _gnu = rpmExpand("-", cvog->gnu, NULL);
+
+ addMacro(NULL, "_platform_gnu", NULL, (_gnu ? _gnu : ""), -1);
++ fprintf(stderr, "D: rpmPlatform addMacro %s-%s-%s(%s)\n",
++ rpmExpand("%{_platform_cpu}", NULL),
++ rpmExpand("%{_platform_vendor}", NULL),
++ rpmExpand("%{_platform_os}", NULL),
++ rpmExpand("%{_platform_gnu}", NULL));
+ #else
+ addMacro(NULL, "_host_cpu", NULL, cvog->cpu, -1);
+ addMacro(NULL, "_host_vendor", NULL, cvog->vendor, -1);
+@@ -510,6 +518,7 @@ static rpmRC rpmPlatform(const char * pl
+ #endif
+ }
+
++ fprintf(stderr, "D: rpmPlatform mireAppend STRCMP %s -- ", p);
+ #if defined(RPM_VENDOR_OPENPKG) /* explicit-platform */
+ /* do not use vendor and GNU attribution */
+ p = rpmExpand("%{_host_cpu}-%{_host_os}", NULL);
+@@ -518,6 +527,7 @@ static rpmRC rpmPlatform(const char * pl
+ (cvog && *cvog->gnu ? "-" : NULL),
+ (cvog ? cvog->gnu : NULL), NULL);
+ #endif
++ fprintf(stderr, "%s\n", p);
+ xx = mireAppend(RPMMIRE_STRCMP, 0, p, NULL, &mi_re, &mi_nre);
+ p = _free(p);
+
+@@ -686,9 +696,12 @@ int rpmPlatformScore(const char * platfo
+
+ if ((mire = (miRE) mi_re) != NULL)
+ for (i = 0; i < mi_nre; i++) {
+- if (mireRegexec(mire + i, platform, 0) >= 0)
++ if (mireRegexec(mire + i, platform, 0) >= 0) {
++ fprintf(stderr, "D: rpmPlatformScore %s (%d)\n", platform, i + 1);
+ return (i + 1);
++ }
+ }
++ fprintf(stderr, "D: rpmPlatformScore %s (%d)\n", platform, 0);
+ return 0;
+ }
+ /*@=onlytrans@*/
diff --git a/meta/recipes-devtools/rpm/rpm/rpm-platform.patch b/meta/recipes-devtools/rpm/rpm/rpm-platform.patch
index 7b81857837..9e167d82f3 100644
--- a/meta/recipes-devtools/rpm/rpm/rpm-platform.patch
+++ b/meta/recipes-devtools/rpm/rpm/rpm-platform.patch
@@ -40,7 +40,7 @@ diff -ur rpm-5.4.0.orig/lib/depends.c rpm-5.4.0/lib/depends.c
return rc;
}
-+#if defined(RPM_VENDOR_WINDRIVER)
++#if defined(RPM_VENDOR_WINDRIVER) || defined(RPM_VENDOR_POKY)
+#define _ETC_RPM_SYSINFO "%{_etcrpm}/sysinfo"
+#else
+#define _ETC_RPM_SYSINFO SYSCONFIGDIR "/sysinfo"
diff --git a/meta/recipes-devtools/rpm/rpm/rpm-platform2.patch b/meta/recipes-devtools/rpm/rpm/rpm-platform2.patch
index 3d50e46c11..6683d8fdbf 100644
--- a/meta/recipes-devtools/rpm/rpm/rpm-platform2.patch
+++ b/meta/recipes-devtools/rpm/rpm/rpm-platform2.patch
@@ -3,10 +3,13 @@ Fix up platform and related sysinfo file loading (part 2).
Upstream-Status: Pending
We need to ensure that we set the _gnu flag somehow. We do this by reading
-from the platform file, and setting a new platform_gnu and related vars.
+from the platform file, and setting a new _platform_gnu and related vars.
-We then check for the existance of these things and change the configure
-time defaults to the run-time values as necessary.
+The default values of _host_cpu, _host_vendor and _host_os are changed to
+reference either the automatically determined _target_... or _platform_...
+values. The macros file uses the configure time defaults in _platform_...
+versions have not been defined. This preserves existing behavior, but
+ensures reasonable defaults are always available.
Signed-off-by: Mark Hatle <mark.hatle@windriver.com>
@@ -14,17 +17,43 @@ Index: rpm-5.4.9/lib/rpmrc.c
===================================================================
--- rpm-5.4.9.orig/lib/rpmrc.c
+++ rpm-5.4.9/lib/rpmrc.c
-@@ -487,9 +487,10 @@ static rpmRC rpmPlatform(const char * pl
+@@ -328,10 +328,15 @@ static void setDefaults(void)
+ /*@modifies rpmGlobalMacroContext, internalState @*/
+ {
+
+-#if defined(RPM_VENDOR_WINDRIVER)
++#if defined(RPM_VENDOR_WINDRIVER) || defined(RPM_VENDOR_POKY)
+ addMacro(NULL, "_usrlibrpm", NULL, __usrlibrpm, RMIL_DEFAULT);
+ addMacro(NULL, "_etcrpm", NULL, __etcrpm, RMIL_DEFAULT);
+ addMacro(NULL, "_vendor", NULL, "%{?_host_vendor}%{!?_host_vendor:wrs}", RMIL_DEFAULT);
++
++ addMacro(NULL, "_host_cpu", NULL, "%{?_platform_cpu}%{!?_platform_cpu:%{?_target_cpu}}", RMIL_DEFAULT);
++ addMacro(NULL, "_host_vendor", NULL, "%{?_platform_vendor}%{!?_platform_cpu:%{?_target_vendor}}", RMIL_DEFAULT);
++ addMacro(NULL, "_host_os", NULL, "%{?_platform_os}%{!?_platform_os:%{?_target_os}}", RMIL_DEFAULT);
++ addMacro(NULL, "_host_gnu", NULL, "%{?_platform_gnu}%{!?_platform_gnu:%{?_gnu}}", RMIL_DEFAULT);
+ #endif
+
+ addMacro(NULL, "_usr", NULL, USRPREFIX, RMIL_DEFAULT);
+@@ -487,9 +492,22 @@ static rpmRC rpmPlatform(const char * pl
}
if (!parseCVOG(p, &cvog) && cvog != NULL) {
-- addMacro(NULL, "_host_cpu", NULL, cvog->cpu, -1);
-- addMacro(NULL, "_host_vendor", NULL, cvog->vendor, -1);
-- addMacro(NULL, "_host_os", NULL, cvog->os, -1);
++#if defined(RPM_VENDOR_POKY)
++ char * _gnu = NULL;
++
+ addMacro(NULL, "_platform_cpu", NULL, cvog->cpu, -1);
+ addMacro(NULL, "_platform_vendor", NULL, cvog->vendor, -1);
+ addMacro(NULL, "_platform_os", NULL, cvog->os, -1);
-+ addMacro(NULL, "_platform_gnu", NULL, cvog->gnu, -1);
++
++ if (cvog->gnu && cvog->gnu[0] != '\0')
++ _gnu = rpmExpand("-", cvog->gnu, NULL);
++
++ addMacro(NULL, "_platform_gnu", NULL, (_gnu ? _gnu : ""), -1);
++#else
+ addMacro(NULL, "_host_cpu", NULL, cvog->cpu, -1);
+ addMacro(NULL, "_host_vendor", NULL, cvog->vendor, -1);
+ addMacro(NULL, "_host_os", NULL, cvog->os, -1);
++#endif
}
#if defined(RPM_VENDOR_OPENPKG) /* explicit-platform */
@@ -32,25 +61,45 @@ Index: rpm-5.4.9/macros/macros.in
===================================================================
--- rpm-5.4.9.orig/macros/macros.in
+++ rpm-5.4.9/macros/macros.in
-@@ -873,7 +873,7 @@ $_arbitrary_tags_tests Foo:Bar
- %_build_arch @RPMCANONARCH@
- %_vendor @RPMCANONVENDOR@
+@@ -875,9 +875,9 @@ $_arbitrary_tags_tests Foo:Bar
%_os @RPMCANONOS@
--%_gnu @RPMCANONGNU@
-+%_gnu %{?_platform_gnu:-%{_platform_gnu}}%{!?_platform_gnu:@RPMCANONGNU@}
+ %_gnu @RPMCANONGNU@
+
+-%_host_platform %{_host_cpu}-%{_host_vendor}-%{_host_os}%{?_gnu}
+-%_build_platform %{_build_cpu}-%{_build_vendor}-%{_build_os}%{?_gnu}
+-%_target_platform %{_target_cpu}-%{_target_vendor}-%{_target_os}%{?_gnu}
++%_host_platform %{_host_cpu}-%{_host_vendor}-%{_host_os}%{?_host_gnu}%{!?_host_gnu:%{?_gnu}}
++%_build_platform %{_build_cpu}-%{_build_vendor}-%{_build_os}%{?_host_gnu}%{!?_host_gnu:%{?_gnu}}
++%_target_platform %{_target_cpu}-%{_target_vendor}-%{_target_os}%{?_host_gnu}%{!?_host_gnu:%{?_gnu}}
- %_host_platform %{_host_cpu}-%{_host_vendor}-%{_host_os}%{?_gnu}
- %_build_platform %{_build_cpu}-%{_build_vendor}-%{_build_os}%{?_gnu}
-@@ -920,9 +920,9 @@ $_arbitrary_tags_tests Foo:Bar
+ #==============================================================================
+ # ---- configure macros.
+@@ -920,9 +920,10 @@ $_arbitrary_tags_tests Foo:Bar
%_build_os %{_host_os}
%_host @host@
%_host_alias @host_alias@%{nil}
-%_host_cpu @host_cpu@
-%_host_vendor @host_vendor@
-%_host_os @host_os@
-+%_host_cpu %{?_platform_cpu}%{!?_platform_cpu:@host_cpu@}
-+%_host_vendor %{?_platform_vendor}%{!?_platform_vendor:@host_vendor@}
-+%_host_os %{?_platform_os}%{!?_platform_os:@host_os@}
++%_host_cpu %{?_platform_cpu}%{!?_platform_cpu:%{_arch}}
++%_host_vendor %{?_platform_vendor}%{!?_platform_vendor:%{_vendor}}
++%_host_os %{?_platform_os}%{!?_platform_os:%{_os}}
++%_host_gnu %{?_platform_gnu}%{!?_platform_gnu:%{_gnu}}
%_target %{_host}
%_target_alias %{_host_alias}
%_target_cpu %{_host_cpu}
+Index: rpm-5.4.9/python/rpmmodule.c
+===================================================================
+--- rpm-5.4.9.orig/python/rpmmodule.c
++++ rpm-5.4.9/python/rpmmodule.c
+@@ -65,8 +65,8 @@ static PyObject * archScore(PyObject * s
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", kwlist, &arch))
+ return NULL;
+
+-#if defined(RPM_VENDOR_WINDRIVER)
+- platform = rpmExpand(arch, "-%{_host_vendor}", "-%{_host_os}%{?_gnu}", NULL);
++#if defined(RPM_VENDOR_WINDRIVER) || defined(RPM_VENDOR_POKY)
++ platform = rpmExpand(arch, "-%{_host_vendor}", "-%{_host_os}%{?_host_gnu}%{!?_host_gnu:%{?_gnu}}", NULL);
+ #else
+ platform = rpmExpand(arch, "-", "%{_vendor}", "-", "%{_os}", NULL);
+ #endif
diff --git a/meta/recipes-devtools/rpm/rpm_5.4.9.bb b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
index 7311d0e015..be76f2470a 100644
--- a/meta/recipes-devtools/rpm/rpm_5.4.9.bb
+++ b/meta/recipes-devtools/rpm/rpm_5.4.9.bb
@@ -43,7 +43,7 @@ LICENSE = "LGPLv2.1"
LIC_FILES_CHKSUM = "file://COPYING.LIB;md5=2d5025d4aa3495befef8f17206a5b0a1"
DEPENDS = "libpcre attr acl popt ossp-uuid file bison-native"
-PR = "r58"
+PR = "r59"
# 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...
@@ -86,6 +86,11 @@ SRC_URI = "http://www.rpm5.org/files/rpm/rpm-5.4/rpm-5.4.9-0.20120508.src.rpm;ex
file://rpm-platform2.patch \
"
+# Uncomment the following line to enable platform score debugging
+# This is useful when identifying issues with Smart being unable
+# to process certain package feeds.
+#SRC_URI += "file://rpm-debug-platform.patch"
+
SRC_URI[md5sum] = "60d56ace884340c1b3fcac6a1d58e768"
SRC_URI[sha256sum] = "bac7cc5bd9d0e8262fdc0099349924608da8f680f5cb243751f696552239dde8"
@@ -150,7 +155,7 @@ PACKAGECONFIG[tcl] = "--with-tcl,--without-tcl,tcl,"
PACAKGECONFIG[augeas] = "--with-augeas,--without-augeas,augeas,"
EXTRA_OECONF += "--verbose \
- --sysconfdir=/etc \
+ --sysconfdir=${sysconfdir} \
--with-file \
--with-path-magic=%{_usrlibrpm}/../../share/misc/magic.mgc \
--with-syck=internal \
@@ -226,7 +231,7 @@ FILES_${PN}-dbg += "${libdir}/rpm/.debug \
FILES_${PN}-common = "${bindir}/rpm2cpio \
${bindir}/gendiff \
- /etc/rpm \
+ ${sysconfdir}/rpm \
/var/spool/repackage \
"
@@ -444,30 +449,30 @@ do_install_append() {
do_install_append_class-native() {
create_wrapper ${D}/${bindir}/rpm \
- RPM_USRLIBRPM=${STAGING_LIBDIR_NATIVE}/rpm \
- RPM_ETCRPM=${STAGING_ETCDIR_NATIVE}/rpm \
- RPM_LOCALEDIRRPM=${STAGING_DATADIR_NATIVE}/locale
+ RPM_USRLIBRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', True))}/rpm \
+ RPM_ETCRPM='$'{RPM_ETCRPM-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir', True), d.getVar('bindir', True))}/rpm} \
+ RPM_LOCALEDIRRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir', True), d.getVar('bindir', True))}/locale
create_wrapper ${D}/${bindir}/rpm2cpio \
- RPM_USRLIBRPM=${STAGING_LIBDIR_NATIVE}/rpm \
- RPM_ETCRPM=${STAGING_ETCDIR_NATIVE}/rpm \
- RPM_LOCALEDIRRPM=${STAGING_DATADIR_NATIVE}/locale
+ RPM_USRLIBRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', True))}/rpm \
+ RPM_ETCRPM='$'{RPM_ETCRPM-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir', True), d.getVar('bindir', True))}/rpm} \
+ RPM_LOCALEDIRRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir', True), d.getVar('bindir', True))}/locale
create_wrapper ${D}/${bindir}/rpmbuild \
- RPM_USRLIBRPM=${STAGING_LIBDIR_NATIVE}/rpm \
- RPM_ETCRPM=${STAGING_ETCDIR_NATIVE}/rpm \
- RPM_LOCALEDIRRPM=${STAGING_DATADIR_NATIVE}/locale
+ RPM_USRLIBRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', True))}/rpm \
+ RPM_ETCRPM='$'{RPM_ETCRPM-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir', True), d.getVar('bindir', True))}/rpm} \
+ RPM_LOCALEDIRRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir', True), d.getVar('bindir', True))}/locale
create_wrapper ${D}/${bindir}/rpmconstant \
- RPM_USRLIBRPM=${STAGING_LIBDIR_NATIVE}/rpm \
- RPM_ETCRPM=${STAGING_ETCDIR_NATIVE}/rpm \
- RPM_LOCALEDIRRPM=${STAGING_DATADIR_NATIVE}/locale
+ RPM_USRLIBRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', True))}/rpm \
+ RPM_ETCRPM='$'{RPM_ETCRPM-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir', True), d.getVar('bindir', True))}/rpm} \
+ RPM_LOCALEDIRRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir', True), d.getVar('bindir', True))}/locale
for rpm_binary in ${D}/${libdir}/rpm/bin/rpm*; do
create_wrapper $rpm_binary
- RPM_USRLIBRPM=${STAGING_LIBDIR_NATIVE}/rpm \
- RPM_ETCRPM=${STAGING_ETCDIR_NATIVE}/rpm \
- RPM_LOCALEDIRRPM=${STAGING_DATADIR_NATIVE}/locale
+ RPM_USRLIBRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('libdir', True), d.getVar('bindir', True))}/rpm \
+ RPM_ETCRPM='$'{RPM_ETCRPM-'`dirname $''realpath`'/${@os.path.relpath(d.getVar('sysconfdir', True), d.getVar('bindir', True))}/rpm} \
+ RPM_LOCALEDIRRPM='`dirname $''realpath`'/${@os.path.relpath(d.getVar('datadir', True), d.getVar('bindir', True))}/locale
done
# Adjust popt macros to match...