1 |
I've done some hacking (okay, ugly hacking) with portage lately. |
2 |
reading some source and trying to get a grasp at the code. so far |
3 |
I've only patched 'dep_bestmatch' to deal with stability-symlinks in |
4 |
the portage tree. |
5 |
|
6 |
this is what the patch actually does: |
7 |
|
8 |
almach freeciv # PORTAGE_LEVEL="STABLE" emerge --pretend freeciv |
9 |
These are the packages that I would merge, in order. |
10 |
Calculating dependencies ...done! |
11 |
[ebuild N ] app-games/freeciv-1.12.0-r1 to / |
12 |
|
13 |
almach freeciv # emerge --pretend freeciv |
14 |
These are the packages that I would merge, in order. |
15 |
Calculating dependencies ...done! |
16 |
[ebuild N ] app-games/freeciv-1.12.0-r2 to / |
17 |
|
18 |
almach / # ls -la /usr/portage/app-games/freeciv/ |
19 |
total 15 |
20 |
drwxr-xr-x 3 root root 216 Apr 20 01:47 . |
21 |
drwxr-xr-x 60 root root 1608 Apr 19 12:20 .. |
22 |
-rw-r--r-- 1 root root 987 Mar 29 15:52 ChangeLog |
23 |
drwxr-xr-x 2 root root 128 Apr 19 12:20 files |
24 |
-rw-r--r-- 1 root root 1288 Feb 6 23:58 freeciv-1.12.0-r1.ebuild |
25 |
-rw-r--r-- 1 root root 1321 Mar 29 15:52 freeciv-1.12.0-r2.ebuild |
26 |
lrwxrwxrwx 1 root root 24 Apr 20 01:47 freeciv-stable -> freeciv-1.12.0-r1.ebuild |
27 |
|
28 |
notice that last symlink. :) |
29 |
|
30 |
this is against 1.9.1, I haven't even looked at any other version of |
31 |
portage. |
32 |
|
33 |
now, I don't expect this to get anywhere near the main tree. don't |
34 |
worry about that. :) |
35 |
|
36 |
I am however curious to how what people think of the idea, and the |
37 |
implementation. it probably shows that I haven't coded python in a |
38 |
year or so. and no, this hasn't been tested overly much, just |
39 |
enough for me to feel that it apparently "works for me". please, |
40 |
thump me over the head if there is a reason to do so. |
41 |
|
42 |
I know some people want a package.mask to do separate stable |
43 |
releases, and they probably know I don't like that one bit. |
44 |
personally, I'm going to take a snapshot of my now stable system |
45 |
using this scheme. all I need to do is to make a |
46 |
"<package>-sysok"-symlink for each installed package. this should |
47 |
also hopefully allow me to do rollbacks if I need to do so. |
48 |
|
49 |
if anyone is wondering on the status of the update-flags I also |
50 |
want, well, that'll need quite a bit more work. it will need to be |
51 |
integrated into the datastructure that portage uses to keep track of |
52 |
packages internally -- which will take time. |
53 |
|
54 |
anyhow, the patch. I know, I should patch against the portage |
55 |
sourcecode directly. but still. :) |
56 |
|
57 |
--- /usr/lib/python2.2/site-packages/portage-clean.py Sat Apr 20 01:19:57 2002 |
58 |
+++ /usr/lib/python2.2/site-packages/portage.py Sat Apr 20 02:29:04 2002 |
59 |
@@ -2081,6 +2081,21 @@ |
60 |
else: |
61 |
return mymatch |
62 |
elif not isspecific(mypkgdep): |
63 |
+ keys = os.environ.keys() |
64 |
+ |
65 |
+ if 'PORTAGE_LEVEL' in keys: |
66 |
+ if mypkgdep.find("/") > -1: |
67 |
+ level = os.environ['PORTAGE_LEVEL'] |
68 |
+ [ dir, name ] = mypkgdep.split("/") |
69 |
+ try: |
70 |
+ ebuild = os.readlink("/usr/portage/" + mypkgdep + "/" + name + "-" + level.lower()) |
71 |
+ ebuild = ebuild.replace(".ebuild", "") |
72 |
+ return self.dep_bestmatch("=" + ebuild) |
73 |
+ except OSError: |
74 |
+ print "\n>>> " + mypkgdep + " has no ebuild with label '" + level + "'." |
75 |
+ sys.exit(1) |
76 |
+ |
77 |
+ |
78 |
if not self.hasnode(mypkgdep): |
79 |
return "" |
80 |
mynodes=self.getnode(mypkgdep)[:] |
81 |
|
82 |
|
83 |
-- |
84 |
Terje |