1 |
Author: zmedico |
2 |
Date: 2008-02-22 22:20:50 +0000 (Fri, 22 Feb 2008) |
3 |
New Revision: 9367 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/_emerge/__init__.py |
7 |
Log: |
8 |
Add support for file paths as arguments to emerge. If an argument starts |
9 |
with / and it's not recognized as a tbz2 or ebuild then we try to find |
10 |
and owner in the vdb and generate a slot atom from it. Thanks to solar |
11 |
for the suggestion. |
12 |
|
13 |
|
14 |
Modified: main/trunk/pym/_emerge/__init__.py |
15 |
=================================================================== |
16 |
--- main/trunk/pym/_emerge/__init__.py 2008-02-22 06:48:03 UTC (rev 9366) |
17 |
+++ main/trunk/pym/_emerge/__init__.py 2008-02-22 22:20:50 UTC (rev 9367) |
18 |
@@ -1429,6 +1429,7 @@ |
19 |
self._reinstall_nodes = {} |
20 |
self.mydbapi = {} |
21 |
self.trees = {} |
22 |
+ self._trees_orig = trees |
23 |
self.roots = {} |
24 |
# Contains a filtered view of preferred packages that are selected |
25 |
# from available repositories. |
26 |
@@ -2123,6 +2124,35 @@ |
27 |
cpv=mykey, metadata=metadata, onlydeps=onlydeps) |
28 |
args.append(PackageArg(arg=x, package=pkg, |
29 |
root_config=root_config)) |
30 |
+ elif x.startswith(os.path.sep): |
31 |
+ if not x.startswith(myroot): |
32 |
+ portage.writemsg(("\n\n!!! '%s' does not start with" + \ |
33 |
+ " $ROOT.\n") % x, noiselevel=-1) |
34 |
+ return 0, [] |
35 |
+ relative_path = x[len(myroot):] |
36 |
+ vartree = self._trees_orig[myroot]["vartree"] |
37 |
+ owner_cpv = None |
38 |
+ for cpv in vardb.cpv_all(): |
39 |
+ self.spinner.update() |
40 |
+ cat, pf = portage.catsplit(cpv) |
41 |
+ if portage.dblink(cat, pf, myroot, |
42 |
+ pkgsettings, vartree=vartree).isowner( |
43 |
+ relative_path, myroot): |
44 |
+ owner_cpv = cpv |
45 |
+ break |
46 |
+ if owner_cpv is None: |
47 |
+ portage.writemsg(("\n\n!!! '%s' is not claimed " + \ |
48 |
+ "by any package.\n") % x, noiselevel=-1) |
49 |
+ return 0, [] |
50 |
+ slot = vardb.aux_get(owner_cpv, ["SLOT"])[0] |
51 |
+ if not slot: |
52 |
+ # portage now masks packages with missing slot, but it's |
53 |
+ # possible that one was installed by an older version |
54 |
+ atom = portage.cpv_getkey(owner_cpv) |
55 |
+ else: |
56 |
+ atom = "%s:%s" % (portage.cpv_getkey(owner_cpv), slot) |
57 |
+ args.append(AtomArg(arg=atom, atom=atom, |
58 |
+ root_config=root_config)) |
59 |
else: |
60 |
if x in ("system", "world"): |
61 |
x = SETPREFIX + x |
62 |
|
63 |
-- |
64 |
gentoo-commits@l.g.o mailing list |