diff options
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.patch | 80 |
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 @@ | |||
1 | Fix smart RPM backend to handle rpm-dbpath/rpm-root properly | ||
2 | |||
3 | Don't assume that if the dbpath starts with / that it is an absolute | ||
4 | path. This matches the behaviour of rpm itself. (If the root path is | ||
5 | specified and does not start with /, rpm will prepend the root path | ||
6 | twice and fail). | ||
7 | |||
8 | Upstream-Status: Pending | ||
9 | |||
10 | Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> | ||
11 | |||
12 | diff --git a/smart/backends/rpm/base.py b/smart/backends/rpm/base.py | ||
13 | index 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) | ||
38 | diff --git a/smart/channels/rpm_sys.py b/smart/channels/rpm_sys.py | ||
39 | index 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 | ||
64 | diff --git a/smart/plugins/detectsys.py b/smart/plugins/detectsys.py | ||
65 | index 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): | ||