summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python-smartpm/smart-rpm-root.patch
diff options
context:
space:
mode:
authorMark Hatle <mark.hatle@windriver.com>2012-10-04 13:57:00 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-11-18 16:42:02 +0000
commit3d8fd40f9f339564d8b7c80e2f60cc4f49826def (patch)
treec4e614f31c43da4e718514c3b4e185824a005319 /meta/recipes-devtools/python/python-smartpm/smart-rpm-root.patch
parent4dd9d39dca1221792f963f7fa74da0d0221f12ef (diff)
downloadpoky-3d8fd40f9f339564d8b7c80e2f60cc4f49826def.tar.gz
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. (From OE-Core rev: 92182ca88aff9cec04b2af5e9babaf33bf61f0af) Signed-off-by: Mark Hatle <mark.hatle@windriver.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/python/python-smartpm/smart-rpm-root.patch')
-rw-r--r--meta/recipes-devtools/python/python-smartpm/smart-rpm-root.patch80
1 files changed, 80 insertions, 0 deletions
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 @@
1Fix smart RPM backend to handle rpm-dbpath/rpm-root properly
2
3Don't assume that if the dbpath starts with / that it is an absolute
4path. This matches the behaviour of rpm itself. (If the root path is
5specified and does not start with /, rpm will prepend the root path
6twice and fail).
7
8Upstream-Status: Pending
9
10Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
11
12diff --git a/smart/backends/rpm/base.py b/smart/backends/rpm/base.py
13index 7092332..0489e11 100644
14--- a/smart/backends/rpm/base.py
15+++ b/smart/backends/rpm/base.py
16@@ -46,6 +46,12 @@ __all__ = ["RPMPackage", "RPMProvides", "RPMNameProvides", "RPMPreRequires",
17 "rpm", "getTS", "getArchScore", "getArchColor", "system_provides",
18 "collapse_libc_requires"]
19
20+def rpm_join_dbpath(root, dbpath):
21+ if dbpath.startswith('/') and root:
22+ return os.path.join(root, dbpath[1:])
23+ else:
24+ return os.path.join(root, dbpath)
25+
26 def getTS(new=False):
27 rpm_root = os.path.abspath(sysconf.get("rpm-root", "/"))
28 if not hasattr(getTS, "ts") or getTS.root != rpm_root:
29@@ -56,7 +62,7 @@ def getTS(new=False):
30 #if not sysconf.get("rpm-check-signatures", False):
31 # getTS.ts.setVSFlags(rpm._RPMVSF_NOSIGNATURES)
32 rpm_dbpath = sysconf.get("rpm-dbpath", "var/lib/rpm")
33- dbdir = os.path.join(getTS.root, rpm_dbpath)
34+ dbdir = rpm_join_dbpath(getTS.root, rpm_dbpath)
35 if not os.path.isdir(dbdir):
36 try:
37 os.makedirs(dbdir)
38diff --git a/smart/channels/rpm_sys.py b/smart/channels/rpm_sys.py
39index efcb10e..b9fda27 100644
40--- a/smart/channels/rpm_sys.py
41+++ b/smart/channels/rpm_sys.py
42@@ -20,7 +20,7 @@
43 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
44 #
45 from smart.backends.rpm.header import RPMDBLoader
46-from smart.backends.rpm.base import getTS
47+from smart.backends.rpm.base import getTS, rpm_join_dbpath
48 from smart.channel import PackageChannel
49 from smart import *
50 import os
51@@ -32,9 +32,9 @@ class RPMSysChannel(PackageChannel):
52
53 def fetch(self, fetcher, progress):
54 getTS() # Make sure the db exists.
55- path = os.path.join(sysconf.get("rpm-root", "/"),
56- sysconf.get("rpm-dbpath", "var/lib/rpm"),
57- "Packages")
58+ dbdir = rpm_join_dbpath(sysconf.get("rpm-root", "/"),
59+ sysconf.get("rpm-dbpath", "var/lib/rpm"))
60+ path = os.path.join(dbdir, "Packages")
61 digest = os.path.getmtime(path)
62 if digest == self._digest:
63 return True
64diff --git a/smart/plugins/detectsys.py b/smart/plugins/detectsys.py
65index 2cd49ad..3959d07 100644
66--- a/smart/plugins/detectsys.py
67+++ b/smart/plugins/detectsys.py
68@@ -20,10 +20,11 @@
69 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
70 #
71 from smart import *
72+from smart.backends.rpm.base import rpm_join_dbpath
73 import os
74
75 def detectRPMSystem():
76- dir = os.path.join(sysconf.get("rpm-root", "/"),
77+ dir = rpm_join_dbpath(sysconf.get("rpm-root", "/"),
78 sysconf.get("rpm-dbpath", "var/lib/rpm"))
79 file = os.path.join(dir, "Packages")
80 if os.path.exists(file):