Gentoo Archives: gentoo-dev

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: don't rely on dynamic deps
Date: Mon, 28 Jul 2014 07:00:16
Message-Id: pan$7a719$9eda1481$3d70abb9$ffe87f9c@cox.net
In Reply to: Re: [gentoo-dev] don't rely on dynamic deps by "Paweł Hajdan
1 Paweł Hajdan, Jr. posted on Sun, 27 Jul 2014 16:56:17 +0200 as excerpted:
2
3 >> One thing I would question in that table is "applied immediately (but
4 >> can break hard when dynamic-deps stop working))." How can dynamically
5 >> removing an "unused dependency" cause something to break, setting aside
6 >> bugs in the package manager? If removing a dependency causes something
7 >> to break, how can it be "unused?"
8 >
9 > Yeah, I was also wondering about this.
10
11
12 I believe what is being discussed there is the following (as I understand
13 it):
14
15 1) Foo incorrectly deps on bar, and doesn't actually use that dep for
16 anything. Say it was a historical dep that upstream forgot to remove in
17 the docs when they removed the dep, and the (gentoo) maintainer didn't
18 detect it initially.
19
20 2) User installs foo with the incorrect dep, thus pulling in bar.
21
22 At this point use has an unnecessary package installed but is otherwise
23 fine, deps are wrongly pulling it in.
24
25 3) Foo maintainer detects the error (upstream removed the dep in the
26 unreleased version and maintainer realizes it wasn't needed in the
27 current version either) and removes the dep on bar, but since it was
28 unused anyway and thus doesn't affect the package as installed (except in
29 vardb), he takes advantage of dynamic-deps and no revbump is done.
30
31 At this point, user has an unnecessary dep that portage has just been
32 told about due to dynamic deps, and will unmerge it at the next depclean,
33 but the user's dep-tree is still self-consistent and everything's fine.
34
35 4) Due to dynamic-deps, portage depcleans bar.
36
37 Due to dynamic-deps, the user's dep-tree is still consistent and
38 everything's fine.
39
40 5) Since nothing in the tree needs bar, it is removed.
41
42 Due to dynamic-deps, the user's dep-tree is still consistent, because the
43 in-/usr/portage foo.ebuild doesn't say anything about bar since #3.
44
45 6) Finally, foo is removed from tree.
46
47 ** User isn't ready to get rid of foo yet, but user's dep-tree just blew
48 up, because now portage falls back to the static vardb from original
49 install, and that still says foo deps on bar, which is nowhere to be
50 found!
51
52 What's worse, the usual trick of digging the ebuild out of vardb and
53 putting it in the user's overlay to shut portage up and let the user keep
54 foo doesn't work, because the vardb ebuild has an unsatisfied dep.
55
56 With the repeated caveat that this is as I understand it, if the above is
57 clear along with the implications, you can stop reading here. The below
58 simply expands on the above and its implications...
59
60 The "breaks hard" bit can be applied for two reasons. First, exactly as
61 I said above, the user's now SOL -- they had no warning things were going
62 to break and now it's too late to do anything about it (unless they're
63 advanced enough to figure out how to dig the last, corrected ebuild
64 version out of a snapshot or the cvs attic, or to figure out that dep
65 isn't actually needed on their own, and edit the ebuild they pulled out
66 of vardb accordingly).
67
68 Second, "breaks hard" can apply when a whole set of related packages were
69 removed at once, all with the same bad dep. Consider for instance
70 someone with kde-4.11 installed and how deeply dependent typical kde
71 ebuilds tend to be on the kde eclasses. If the bad dep was in an eclass
72 and applied to say 200+ kde packages the user may well have installed,
73 then got corrected such that dynamic-deps killed the bad dep, then all of
74 kde-4.11 was removed from the tree at once... A user may well find out
75 they have 200+ broken deps at once! "Breaks hard", indeed!
76
77
78 Now we look at the same set of triggering events with static deps. There
79 are two cases, depending on whether the foo maintainer accounted for
80 static deps and did a revision bump at step 3 or not:
81
82 With a revision bump at step #3, at step #4, before the user can do the
83 depclean, they'll have to do the revision upgrade. The aftermath of step
84 #6 will then be hugely different as the vardb copy will have the bad dep
85 removed as well.
86
87 If the foo maintainer didn't do a revision bump, with static deps the
88 user will have never depcleaned bar in step #4 as the vardb deps still
89 say it's needed. So when foo is removed in step #6, again, no big deal.
90 Sure the user had a useless dep installed the whole time, but when foo is
91 removed from tree, fine, the user's dep-tree remains self-consistent and
92 no blowup. And the user remains free to dig that ebuild out of vardb and
93 install it in the overlay again, at least temporarily, to keep portage
94 from yelling about it until the user has time to find an alternative to
95 the package, or to upgrade to the new version (kde 4.12 or 4.13 in my
96 mass-breakage example). Reinstalling may or may not be possible
97 depending on how much the ebuild depended on eclasses and what had
98 happened to them, but keeping the same thing installed at least
99 temporarily should be fine.
100
101 And the static-deps case of the user not upgrading in a timely manner and
102 thus skipping step #4 entirely, resolves exactly as if the maintainer
103 hadn't done a bump. Useless dep installed the whole time but no breakage.
104
105 To complete the alternatives-tree, the no-window-update scenario with
106 dynamic-deps would fall back to static/installed when the user updated
107 after both packages were removed, and if an eclass wasn't involved,
108 pulling the ebuilds out of vardb to stick in the overlay temporarily
109 should still shut up portage, and the user could even rebuild from his
110 overlay copy. But if an eclass was involved with that dep, however,
111 pulling those ebuilds out of vardb and into the user overlay would
112 trigger dynamic deps again, and what would happen then would depend on
113 exactly how the eclass had changed. If the eclass had simply removed the
114 bad dep then the effect would be extending the correction window, since
115 with dynamic-deps that new information would now be used, allowing bar to
116 be unmerged even with foo still merged. But if the eclasses had been
117 updated to remove the old logic entirely (in the kde case, if the eclasses
118 had their 4.11 logic removed already), then while portage would fall-back
119 to the static deps as long as the ebuild wasn't available, as soon as it
120 became available again, all hell would break loose as portage would see
121 the ebuild in the overlay and try to use dynamic deps, breaking due to
122 the eclasses no longer having the required support at all!
123
124 Just in case someone missed the disclaimer above, that's as I understand
125 it. I /think/ I get it, but I don't claim to be a PM/PMS expert and it's
126 possible I have it wrong.
127
128 --
129 Duncan - List replies preferred. No HTML msgs.
130 "Every nonfree program has a lord, a master --
131 and if you use the program, he is your master." Richard Stallman

Replies

Subject Author
[gentoo-dev] Re: don't rely on dynamic deps Martin Vaeth <martin@×××××.de>