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