From 92182ca88aff9cec04b2af5e9babaf33bf61f0af Mon Sep 17 00:00:00 2001 From: Mark Hatle Date: Thu, 4 Oct 2012 13:57:00 -0500 Subject: python-smartpm: Add smartpm recipe This is the initial integration, basic functionality such as 'smart query' has been tested. Active use of remote feeds and such has not yet been verified. Thanks to Paul Eggleton for corrections and bug fixes for the initial integration. Signed-off-by: Mark Hatle Signed-off-by: Paul Eggleton --- .../python/python-smartpm/smart-rpm-root.patch | 80 ++++++++++++++++++++++ .../python/python-smartpm/smartpm-rpm5-nodig.patch | 46 +++++++++++++ 2 files changed, 126 insertions(+) create mode 100644 meta/recipes-devtools/python/python-smartpm/smart-rpm-root.patch create mode 100644 meta/recipes-devtools/python/python-smartpm/smartpm-rpm5-nodig.patch (limited to 'meta/recipes-devtools/python/python-smartpm') diff --git a/meta/recipes-devtools/python/python-smartpm/smart-rpm-root.patch b/meta/recipes-devtools/python/python-smartpm/smart-rpm-root.patch new file mode 100644 index 0000000000..b2629ef051 --- /dev/null +++ b/meta/recipes-devtools/python/python-smartpm/smart-rpm-root.patch @@ -0,0 +1,80 @@ +Fix smart RPM backend to handle rpm-dbpath/rpm-root properly + +Don't assume that if the dbpath starts with / that it is an absolute +path. This matches the behaviour of rpm itself. (If the root path is +specified and does not start with /, rpm will prepend the root path +twice and fail). + +Upstream-Status: Pending + +Signed-off-by: Paul Eggleton + +diff --git a/smart/backends/rpm/base.py b/smart/backends/rpm/base.py +index 7092332..0489e11 100644 +--- a/smart/backends/rpm/base.py ++++ b/smart/backends/rpm/base.py +@@ -46,6 +46,12 @@ __all__ = ["RPMPackage", "RPMProvides", "RPMNameProvides", "RPMPreRequires", + "rpm", "getTS", "getArchScore", "getArchColor", "system_provides", + "collapse_libc_requires"] + ++def rpm_join_dbpath(root, dbpath): ++ if dbpath.startswith('/') and root: ++ return os.path.join(root, dbpath[1:]) ++ else: ++ return os.path.join(root, dbpath) ++ + def getTS(new=False): + rpm_root = os.path.abspath(sysconf.get("rpm-root", "/")) + if not hasattr(getTS, "ts") or getTS.root != rpm_root: +@@ -56,7 +62,7 @@ def getTS(new=False): + #if not sysconf.get("rpm-check-signatures", False): + # getTS.ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) + rpm_dbpath = sysconf.get("rpm-dbpath", "var/lib/rpm") +- dbdir = os.path.join(getTS.root, rpm_dbpath) ++ dbdir = rpm_join_dbpath(getTS.root, rpm_dbpath) + if not os.path.isdir(dbdir): + try: + os.makedirs(dbdir) +diff --git a/smart/channels/rpm_sys.py b/smart/channels/rpm_sys.py +index efcb10e..b9fda27 100644 +--- a/smart/channels/rpm_sys.py ++++ b/smart/channels/rpm_sys.py +@@ -20,7 +20,7 @@ + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + from smart.backends.rpm.header import RPMDBLoader +-from smart.backends.rpm.base import getTS ++from smart.backends.rpm.base import getTS, rpm_join_dbpath + from smart.channel import PackageChannel + from smart import * + import os +@@ -32,9 +32,9 @@ class RPMSysChannel(PackageChannel): + + def fetch(self, fetcher, progress): + getTS() # Make sure the db exists. +- path = os.path.join(sysconf.get("rpm-root", "/"), +- sysconf.get("rpm-dbpath", "var/lib/rpm"), +- "Packages") ++ dbdir = rpm_join_dbpath(sysconf.get("rpm-root", "/"), ++ sysconf.get("rpm-dbpath", "var/lib/rpm")) ++ path = os.path.join(dbdir, "Packages") + digest = os.path.getmtime(path) + if digest == self._digest: + return True +diff --git a/smart/plugins/detectsys.py b/smart/plugins/detectsys.py +index 2cd49ad..3959d07 100644 +--- a/smart/plugins/detectsys.py ++++ b/smart/plugins/detectsys.py +@@ -20,10 +20,11 @@ + # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + # + from smart import * ++from smart.backends.rpm.base import rpm_join_dbpath + import os + + def detectRPMSystem(): +- dir = os.path.join(sysconf.get("rpm-root", "/"), ++ dir = rpm_join_dbpath(sysconf.get("rpm-root", "/"), + sysconf.get("rpm-dbpath", "var/lib/rpm")) + file = os.path.join(dir, "Packages") + if os.path.exists(file): diff --git a/meta/recipes-devtools/python/python-smartpm/smartpm-rpm5-nodig.patch b/meta/recipes-devtools/python/python-smartpm/smartpm-rpm5-nodig.patch new file mode 100644 index 0000000000..9919a941bc --- /dev/null +++ b/meta/recipes-devtools/python/python-smartpm/smartpm-rpm5-nodig.patch @@ -0,0 +1,46 @@ +RPM5 has removed support for RPMVSF_NOSIGNATURES + +Patch smart to no longer use this flag + +Upstream-Status: Pending + +Signed-off-by: Mark Hatle + +diff -ur smart-1.4.1.orig/smart/backends/rpm/base.py smart-1.4.1/smart/backends/rpm/base.py +--- smart-1.4.1.orig/smart/backends/rpm/base.py 2012-10-04 11:22:11.229351164 -0500 ++++ smart-1.4.1/smart/backends/rpm/base.py 2012-10-04 11:22:44.820170786 -0500 +@@ -53,8 +53,8 @@ + if sysconf.get("rpm-dbpath"): + rpm.addMacro('_dbpath', "/" + sysconf.get("rpm-dbpath")) + getTS.ts = rpm.ts(getTS.root) +- if not sysconf.get("rpm-check-signatures", False): +- getTS.ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) ++ #if not sysconf.get("rpm-check-signatures", False): ++ # getTS.ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) + rpm_dbpath = sysconf.get("rpm-dbpath", "var/lib/rpm") + dbdir = os.path.join(getTS.root, rpm_dbpath) + if not os.path.isdir(dbdir): +@@ -82,8 +82,8 @@ + if sysconf.get("rpm-dbpath"): + rpm.addMacro('_dbpath', "/" + sysconf.get("rpm-dbpath")) + ts = rpm.ts(getTS.root) +- if not sysconf.get("rpm-check-signatures", False): +- ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) ++ #if not sysconf.get("rpm-check-signatures", False): ++ # ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES) + return ts + else: + return getTS.ts +diff -ur smart-1.4.1.orig/smart/plugins/yumchannelsync.py smart-1.4.1/smart/plugins/yumchannelsync.py +--- smart-1.4.1.orig/smart/plugins/yumchannelsync.py 2010-12-06 03:11:05.000000000 -0600 ++++ smart-1.4.1/smart/plugins/yumchannelsync.py 2012-10-04 11:23:09.799350924 -0500 +@@ -56,7 +56,8 @@ + + rpmroot = sysconf.get("rpm-root", "/") + ts = rpmUtils.transaction.initReadOnlyTransaction(root=rpmroot) +- ts.pushVSFlags(~(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NODIGESTS)) ++ #ts.pushVSFlags(~(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NODIGESTS)) ++ ts.pushVSFlags(~(rpm._RPMVSF_NODIGESTS)) + releasever = None + # HACK: we're hard-coding the most used distros, will add more if needed + idx = ts.dbMatch('provides', 'fedora-release') -- cgit v1.2.3