]> code.ossystems Code Review - openembedded-core.git/commitdiff
python-smartpm: Add patches for rpm4
authorSaul Wold <sgw@linux.intel.com>
Tue, 30 Sep 2014 17:16:53 +0000 (10:16 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 30 Sep 2014 19:55:13 +0000 (20:55 +0100)
Add DEPENDS for python-rpm package from either rpm4 or rpm5

Extend the smart-dflags patch to catch an exception if the api does exist

Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-devtools/python/python-smartpm/smart-dflags.patch
meta/recipes-devtools/python/python-smartpm/smart-rpm4-fixes.patch [new file with mode: 0644]
meta/recipes-devtools/python/python-smartpm_1.4.1.bb

index 3f272621560a10ca24f652b7feaf99b917013274..531ea51cadc585522bc5a2f671ace675b88b85df 100644 (file)
@@ -7,34 +7,39 @@ Upstream-Status: Pending
 
 Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
 
-diff --git a/smart/backends/rpm/pm.py b/smart/backends/rpm/pm.py
-index 707a146..aec82e7 100644
---- a/smart/backends/rpm/pm.py
-+++ b/smart/backends/rpm/pm.py
-@@ -106,6 +106,23 @@ class RPMPackageManager(PackageManager):
+[sgw - Added try/catch for rpm4 since it does not have setDFlags() API]
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+
+
+Index: smart-1.4.1/smart/backends/rpm/pm.py
+===================================================================
+--- smart-1.4.1.orig/smart/backends/rpm/pm.py
++++ smart-1.4.1/smart/backends/rpm/pm.py
+@@ -106,6 +106,26 @@ class RPMPackageManager(PackageManager):
              flags |= rpm.RPMTRANS_FLAG_TEST
          ts.setFlags(flags)
  
-+        dflags = ts.setDFlags(0)
-+        if sysconf.get("rpm-noupgrade", False):
-+            dflags |= rpm.RPMDEPS_FLAG_NOUPGRADE
-+        if sysconf.get("rpm-norequires", False):
-+            dflags |= rpm.RPMDEPS_FLAG_NOREQUIRES
-+        if sysconf.get("rpm-noconflicts", False):
-+            dflags |= rpm.RPMDEPS_FLAG_NOCONFLICTS
-+        if sysconf.get("rpm-noobsoletes", False):
-+            dflags |= rpm.RPMDEPS_FLAG_NOOBSOLETES
-+        if sysconf.get("rpm-noparentdirs", False):
-+            dflags |= rpm.RPMDEPS_FLAG_NOPARENTDIRS
-+        if sysconf.get("rpm-nolinktos", False):
-+            dflags |= rpm.RPMDEPS_FLAG_NOLINKTOS
-+        if sysconf.get("rpm-nosuggest", False):
-+            dflags |= rpm.RPMDEPS_FLAG_NOSUGGEST
-+        ts.setDFlags(dflags)
++        try:
++            dflags = ts.setDFlags(0)
++            if sysconf.get("rpm-noupgrade", False):
++                dflags |= rpm.RPMDEPS_FLAG_NOUPGRADE
++            if sysconf.get("rpm-norequires", False):
++                dflags |= rpm.RPMDEPS_FLAG_NOREQUIRES
++            if sysconf.get("rpm-noconflicts", False):
++                dflags |= rpm.RPMDEPS_FLAG_NOCONFLICTS
++            if sysconf.get("rpm-noobsoletes", False):
++                dflags |= rpm.RPMDEPS_FLAG_NOOBSOLETES
++            if sysconf.get("rpm-noparentdirs", False):
++                dflags |= rpm.RPMDEPS_FLAG_NOPARENTDIRS
++            if sysconf.get("rpm-nolinktos", False):
++                dflags |= rpm.RPMDEPS_FLAG_NOLINKTOS
++            if sysconf.get("rpm-nosuggest", False):
++                dflags |= rpm.RPMDEPS_FLAG_NOSUGGEST
++            ts.setDFlags(dflags)
++        except AttributeError, ae:
++            pass
 +
          # Set rpm verbosity level.
          levelname = sysconf.get('rpm-log-level')
          level = {
--- 
-1.7.9.5
-
diff --git a/meta/recipes-devtools/python/python-smartpm/smart-rpm4-fixes.patch b/meta/recipes-devtools/python/python-smartpm/smart-rpm4-fixes.patch
new file mode 100644 (file)
index 0000000..708ffe6
--- /dev/null
@@ -0,0 +1,49 @@
+
+This patch checks for rpm5 related functions in order to allow rpm4 
+to work correctly. Currently the rpm4 archscore and filter work
+differently enough that they need to be changed.
+
+Upstream-Status: Inappropriate [OE-Core Specific]
+
+Signed-off-by: Saul Wold <sgw@linux.intel.com>
+
+Index: smart-1.4.1/smart/backends/rpm/base.py
+===================================================================
+--- smart-1.4.1.orig/smart/backends/rpm/base.py
++++ smart-1.4.1/smart/backends/rpm/base.py
+@@ -338,10 +338,14 @@ class RPMObsoletes(Depends):
+ _SCOREMAP = {}
+ def getArchScore(arch, _sm=_SCOREMAP):
+-    if arch not in _sm:
+-        score = rpm.archscore(arch)
+-        _sm[arch] = score
+-    return _sm.get(arch, 0)
++    try:
++        rpm.platformscore(arch)
++        if arch not in _sm:
++            score = rpm.archscore(arch)
++            _sm[arch] = score
++        return _sm.get(arch, 0)
++    except AttributeError:
++        return 1
+ # TODO: Embed color into nameprovides and obsoletes relations.
+ _COLORMAP = {"noarch": 0, "x86_64": 2, "ppc64": 2, "s390x": 2, "sparc64": 2}
+Index: smart-1.4.1/smart/backends/rpm/pm.py
+===================================================================
+--- smart-1.4.1.orig/smart/backends/rpm/pm.py
++++ smart-1.4.1/smart/backends/rpm/pm.py
+@@ -235,6 +235,12 @@ class RPMPackageManager(PackageManager):
+         if sysconf.get("rpm-order"):
+             ts.order()
+         probfilter = rpm.RPMPROB_FILTER_OLDPACKAGE
++        try:
++            # Test for RPM5 function
++            rpm.platformscore("")
++        except AttributeError:
++            probfilter |= rpm.RPMPROB_FILTER_IGNOREARCH
++
+         if force or reinstall:
+             probfilter |= rpm.RPMPROB_FILTER_REPLACEPKG
+             probfilter |= rpm.RPMPROB_FILTER_REPLACEOLDFILES
index 09715794b3b1e7c057dbc267df6549fb061686a9..f2eb33d3a3da06695399f000979245dbcc7f1c71 100644 (file)
@@ -8,7 +8,7 @@ SECTION = "devel/python"
 LICENSE = "GPLv2"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=393a5ca445f6965873eca0259a17f833"
 
-DEPENDS = "python rpm gettext-native"
+DEPENDS = "python rpm gettext-native python-rpm"
 PR = "r9"
 SRCNAME = "smart"
 
@@ -32,7 +32,8 @@ SRC_URI = "\
           file://smart-config-ignore-all-recommends.patch \
           file://smart-attempt.patch \
           file://smart-filename-NAME_MAX.patch \
-          "
+          file://smart-rpm4-fixes.patch \
+         "
 
 SRC_URI[md5sum] = "573ef32ba177a6b3c4bf7ef04873fcb6"
 SRC_URI[sha256sum] = "b1d519ddb43d60f293b065c28870a5d9e8b591cd49e8c68caea48ace91085eba"