Gentoo Archives: gentoo-amd64

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-amd64@l.g.o
Subject: [gentoo-amd64] Re: unmerging slotted group packages
Date: Sun, 28 Jan 2007 12:19:12
Message-Id: epi475$nc6$1@sea.gmane.org
In Reply to: [gentoo-amd64] unmerging slotted group packages by Daiajo Tibdixious
1 "Daiajo Tibdixious" <daiajo@×××××.com> posted
2 a4a9bfcb0701272117g58fdd9beof34ecba152619063@××××××××××.com, excerpted
3 below, on Sun, 28 Jan 2007 16:17:37 +1100:
4
5 > I discovered by accident that I have KDE 3.3, 3.4, & 3.5 all installed
6 > at the same time.
7 > I wanted to clean out 3.3 (at least) and tried emerge -aC
8 > =kde-base/kde-3.3.0 which of course just did this pseudo package, not
9 > the containing packages.
10 > I also tried emerge --clean kde-base/kde but this says nothing to
11 > remove, even though 3.4 & 3.5 are still present:
12 > [D] kde-base/kde
13 > Available versions: (3.5) 3.5.2 3.5.5
14 > Installed: 3.4.3(3.4)(17:19:35 01/18/06)(-accessibility)
15 > 3.5.5(3.5)(02:50:53 12/10/06)(-accessibility)
16 > Homepage: http://www.kde.org/
17 > Description: KDE - merge this to pull in all
18 > non-developer kde-base/* packages
19 >
20 > I got rid of 3.3 by doing eix -I kde & removing each sub-package
21 > manually, I just think I must be missing an easier way.
22
23 Two easier ways to do it, but with both, use --pretend first and ensure
24 it's not going to remove something you know you need. Both of these
25 depend on your world file being accurate, so proceed with caution if you
26 know it's not. Each separate section is bullet-pointed with **, below,
27 hopefully making it easy to follow.
28
29
30 ** First, some general maintenance. You may have a bit of cleaning up to
31 do here if you've not done it in awhile.
32
33 There's a step that's normally recommended before the following, only at
34 this point it'd likely cause a bunch of extra work due to stuff you will
35 be removing anyway, so I'd say skip it this time. However, I'll note it
36 at the bottom under pre-maintenance, and I'd suggest reading thru this
37 entire message so you understand how it all works, before you start.
38
39 OK, do an emerge --pretend --depclean, and see what's listed. It
40 should list everything that's not either in your world file or a
41 dependency of something in your world file. That's what portage thinks
42 you don't need. If you think you need something on that list, do an
43 emerge --noreplace <package> so portage will add an appropriate entry to
44 your world file for it. (If it's a dependency, aka a branch package that
45 something else depends on, as usual, add the "leaf" packages that depend
46 on it, thus keeping only "leaves" in your world file, so when all of them
47 are removed, portage knows it can remove the dependency as well.)
48
49 Once you have all the packages in your world file you know you need, so
50 --depclean --pretend is only listing stuff that should be safe to remove
51 (it won't be listing the KDE slots stuff at this time, most likely), go
52 ahead and do the emerge --depclean without the pretend.
53
54 That should leave you with all the "extra" packages removed. Generally,
55 these will be old dependencies for "leaf" packages, old/dead branches with
56 no current leaves. Up to this point you should do relatively frequently,
57 just keeping the old cruft on your system to a minimum, as part of regular
58 maintenance.
59
60 There is another part to this that you should normally do whenever you are
61 doing it for system maintenance. However, we'll skip that here since
62 it could mean a bunch of extra work for stuff you are going to remove
63 anyway. Thus, I'll list it at the bottom, under completing the system
64 maintenance, after the old-KDE removal stuff.
65
66
67 ** OK, now here's method 1, specifically unmerging the old kde slots:
68
69 Specifically emerge --unmerge =kde-<old-ver>. This will unmerge the
70 meta-package that's the leaf for all the other KDE packages (branches
71 supporting that leaf) of that version.
72
73 ** And here's method 2, using --prune:
74
75 Emerge --prune will try to unmerge all but the most recently merged version
76 of the packages in question. That's likely what you want for things like
77 KDE, but it's definitely NOT what you want for things like autoconf and
78 automake, for instance, since many packages depend on older versions and
79 won't work with newer ones. Thus, ALWAYS use --pretend the first time you
80 use --prune, just to be SURE it's going to remove what you expect it to,
81 and nothing else, and NEVER do an emerge --prune world or system (except
82 if you are curious, you can try it with --pretend, just to see what it
83 would do if you were stupid and tried --prune world without the pretend).
84
85 So... emerge --pretend --prune kde-base/kde, and see what it lists. If
86 it looks sensible and it should, run it again without the pretend.
87
88 ** Finishing up the unmerge:
89
90 OK, either way you did it, you should now be clear of the old kde
91 meta-packages, but you'll still have the actual packages merged.
92 However, once the metapackage is unmerged, you can again run emerge
93 --depclean --pretend, and portage should list all the dependencies of the
94 slot leaf you just removed as stuff it'd now remove. If it looks correct,
95 go ahead and do it again, this time without the --pretend. Again, if
96 there's something listed that you know shouldn't be, do an emerge
97 --noreplace <package> for it so portage adds it to the world file, then
98 when everything looks good, go ahead and remove the --pretend.
99
100
101 ** Completing the system maintenance, revdep-rebuild:
102
103 OK, now you should have all the old cruft removed, but we aren't quite
104 finished yet. There's a possibility that some of the remaining packages
105 are now broken, because they had seen and compiled against some of that
106 old cruft, even tho they /should/ have compiled against newer stuff.
107 Broken dependencies can also happen when you changed USE flags and didn't
108 recompile everything that used those flags with the new flags. --depclean
109 doesn't understand these cases, and so sometimes removes stuff that's
110 still needed, but there's a tool designed to fix it: revdep-rebuild, which
111 is part of gentoolkit.
112
113 So, if you don't have gentoolkit merged, emerge it. Then, run
114 revdep-rebuild --pretend (remember, unlike --depclean, revdep-rebuild is
115 it's own command, not part of emerge). Depending on the speed of your disk
116 and amount of memory, revdep-rebuild will take a half an hour or so to
117 scan all the executables and libraries on your system and ensure they have
118 all their library dependencies met. If they don't, it'll figure out what
119 you have to remerge to get things working again, and either do it, or with
120 pretend, give you a list. If you've not been keeping up with system
121 maintenance, especially if you just --depcleaned a bunch of stuff as we
122 just did, and/or if you don't regularly do emerge --newuse world after
123 changing your USE flags, you'll likely have a bit of a list of stuff that
124 needs rebuilt, thus the --pretend the first time, so you get a bit of
125 warning at how long it might take.
126
127 Once you know what revdep-rebuild thinks you need to remerge, you can run
128 it again without the --pretend, and it'll do it. (It won't take all that
129 time figuring stuff out again, as if there's actually anything it needs
130 to remerge, it saves the work files from the --pretend, so it can get
131 right to work the second time.)
132
133 Once you have everything rebuilt, if you like or I'd recommend it if
134 you had a lot to rebuild, you can run revdep-rebuild --pretend once more,
135 just to be sure. Once it says you are clean, you'll have a nicely
136 sparkling clean system, freshly de-crufted and with all dependencies
137 verified by revdep-rebuild. =8^)
138
139
140 ** Pre-maintenance, emerge --newuse and revdep-rebuild:
141
142 As I explained near the top, emerge --depclean is an important part of
143 what should be routine system maintenance, just to keep your system free
144 of cruft. However, when done routinely, there's a couple things you can
145 do before the --depclean to keep things from breaking with the removal
146 of that cruft and therefore needing rebuilt with revdep-rebuild. I
147 suggested skipping them this time only because with all that old stuff on
148 your system, you'd have likely been doing a lot of extra merging for stuff
149 that you were just getting ready to clean out. However, if you do it
150 routinely, say every three or six months, after any big removals such
151 as old KDE slots, and after changing your use flags, there won't be that
152 much stuff out of date anyway, so doing this pre-maintenance is a good
153 idea as it'll keep stuff from breaking with the --depclean.
154
155 For routine maintenance, then, your first steps should be the following:
156
157 emerge --newuse world (first with --pretend, or with --ask, of course).
158 This makes sure all packages are remerged that have had their USE flags
159 changed. Since USE flags often determine dependencies, changing USE flags
160 often means changing dependencies, and remerging any packages with changed
161 flags then updates the dependencies so they don't break when --depclean
162 removes stuff based on current USE flags.
163
164 revdep-rebuild (again, first with --pretend, or with --ask). Do this
165 before your emerge --depclean, after emerge --newuse, and in theory,
166 nothing should be broken after your emerge --depclean.
167
168
169 ** Summary of routine system maintenance, step by step:
170
171 Here, in short form and for further reference, are the steps that should
172 be done routinely, say every 3-6 months, and after USE flag changes or
173 after major upgrades (stuff like KDE, GNOME, XORG, GCC, etc).
174
175 1) emerge --newuse world
176 2) revdep-rebuild
177 3) emerge --pretend --depclean
178 4) emerge --noreplace <package> as necessary
179 5) emerge --depclean
180 6) unmerge old slots or major packages if desired
181 7) repeat steps 3-6 as necessary
182 8) revdep-rebuild
183 9) verify with another revdep-rebuild if desired
184
185 Nice clean system! =8^)
186
187 If done in this order, there shouldn't be much if anything to
188 revdep-rebuild the second time, in step 8.
189
190
191 ** Notes:
192
193 - Again, while skipping step 1 and 2 if you haven't been keeping up with
194 the routine maintenance steps above does mean a bigger risk of stuff
195 broken, I'd still recommend it in your case right now, simply because it's
196 likely if you tried doing the above in order, you'd have a lot of packages
197 to rebuild in steps 1 and 2 only to support stuff you are removing in step
198 6. However, if you'd prefer to do the perhaps significant extra work and
199 avoid as much breakage as possible, go ahead and do it this way this time,
200 as well.
201
202 - revdep-rebuild scans elf files, that is, native elf format binary
203 executables and shared object libraries. While that gets most of the big
204 and critical stuff, revdep-rebuild doesn't understand perl/python/ruby/etc
205 dependencies, and thus won't rebuild them. For those types of things,
206 there are other tools, such as python-updater, for python.
207
208 - There's another specialized tool for dealing with all those
209 *.la libtool files, helping them find libstdc++, as provided by the gcc
210 package. Every time you unmerge old versions of gcc or when you get
211 libstdc++ errors trying to merge something, you should run
212 fix_libtool_files.sh <old/bad-gcc-ver>. Thus, if you just unmerged or
213 it's complaining that it can't find the libstdc++ for gcc-3.4.6, for
214 instance, run fix_libtool_files.sh gcc-3.4.6, and it will scan all the
215 *.la files it can find and ensure all the entries listing that old
216 version also list your current gcc version, as pointed at by gcc-config.
217 Just another tool to know about, as it sure comes in handy sometimes. =8^)
218
219 - I recommend that folks use FEATURES=buildpkg. That portage feature
220 causes it to build and archive a binary version of every package it
221 merges, by default to $PORTDIR/packages. You can then use emerge
222 --package (-k) or --packageonly (-K) if for some reason you need to
223 remerge an old version of something. This comes in handy in a number of
224 cases, including if you used --depclean and unmerge something that you
225 figure out later you needed, but what wasn't in your world file or listed
226 as a dependency of anything in the world file, for whatever reason.
227 Having a couple old versions around in binary package form is also handy
228 if something stops working right after an upgrade. Having a binary
229 package of gcc around is nice as well, in case gcc breaks, and there are
230 even tricks that allow you to rescue a broken portage or python if you
231 have a binary package, when you'd otherwise be in pretty bad shape,
232 because portage is broken and won't let you emerge a new copy of it!
233 Typically, packages for an entire system take up about a gig, so plan on
234 two gigs or so, just to have a bit of extra room. eclean, now a part of
235 portage, can be used to manage both your packages dir and distdir,
236 pruning old source and package files for ebuilds no longer in the tree.
237
238 - If you have emerged a lot of library files and other dependencies
239 without using --oneshot, so they ended up in your world file, --depclean
240 won't list or unmerge them when they are no longer needed, because they
241 are in your world file. This is the opposite of the problem above, in
242 that with the above problem, stuff you need isn't in the world file so
243 will be removed by --depclean, while here, stuff you no longer need
244 because it was a dependency of something you are no longer running is
245 listed in the world file, and thus won't be removed. There's a tool to
246 fix this too. =8^) If you know you have this problem, or just want to see
247 if you might, try emerging udept, which contains dep. You can then run
248 dep --pretend --pruneworld, and get a list of entries in your world file
249 that it thinks are depends, and thus removable, since something else in
250 the file depends on them already. There are a bunch of other things it
251 can do as well. It includes its own --depclean implementation, for
252 instance. However, while it's often faster than portage, it's also not
253 always as accurate. Therefore, as usual, --pretend or --ask can be very
254 helpful, and you'll want to treat its results rather more skeptically than
255 you might portage's own. With --pruneworld, for instance, it wanted to
256 remove a couple things from world that I found out later I needed there.
257 Similarly I tried running its depclean, and it wanted to remove QUITE A
258 FEW packages that were needed, and that portage's depclean knew were
259 needed. So it's a tool that helps, and since it's faster, I'll use it for
260 some things, but for things like --depclean, I wouldn't trust it at all,
261 as it DOES get things wrong sometimes, where portage's emerge --depclean
262 gets it right.
263
264 I'm sure that's more information than you had thought you were asking
265 for, but it's all quite usable here, and hopefully you'll find it equally
266 so there. =8^)
267
268 --
269 Duncan - List replies preferred. No HTML msgs.
270 "Every nonfree program has a lord, a master --
271 and if you use the program, he is your master." Richard Stallman
272
273 --
274 gentoo-amd64@g.o mailing list

Replies

Subject Author
Re: [gentoo-amd64] Re: unmerging slotted group packages Steve Herber <herber@×××××.com>
Re: [gentoo-amd64] Re: unmerging slotted group packages Daiajo Tibdixious <daiajo@×××××.com>
Re: [gentoo-amd64] Re: unmerging slotted group packages "Bo Ørsted Andresen" <bo.andresen@××××.dk>