Debian dependency resolution in polynomial time
Niels Thykier
Debian Developer Release Manager
- 21. August 2015
DebConf15 2015 Heidelberg, Germany
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 1 / 46
Debian dependency resolution in polynomial time Niels Thykier - - PowerPoint PPT Presentation
Debian dependency resolution in polynomial time Niels Thykier Debian Developer Release Manager 21. August 2015 DebConf15 2015 Heidelberg, Germany Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 1 / 46
Debian Developer Release Manager
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 1 / 46
1
2
3
4
5
6
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 2 / 46
1
2
3
4
5
6
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 3 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 4 / 46
1
Apt figures out what is needed to install the package.
2
Apt/dpkg computes a series of “unpack”, “configure” etc. actions.
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 5 / 46
◮ Define all actions (e.g. “unpack pkg/version/arch”). ◮ Compute partial-ordering constrains (“configure pkgA/...” before
“configure pkgB/...”)
◮ Sort items such that all their constrains are satisfied. ◮ Given no cycles, we always can construct a directed-acyclic graph
(DAG).
◮ Said DAG is your install plan - “just” feed it to dpkg and you are done.
1Known invalid assumption Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 6 / 46
◮ The fewer (postinst) scripts, the fewer “unbreakable cycles”. ◮ Remove all dependency cycles and this problem is indisputably “trivial”. ◮ Yes, that is easier said than done, but that is at most what it takes.
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 7 / 46
2It is primarily “slow” for other reasons Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 8 / 46
1
2
3
4
5
6
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 9 / 46
◮ This also includes “normal” pkg(>= 1.0) versions. ◮ And especially unversioned dependencies with multiple versions of said
packages.
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 10 / 46
3You can also make it trivial in a different way. However, it involves removing
negative dependencies (which be “fun” in its own way)
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 11 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 12 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 13 / 46
1
2
3
4
5
6
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 14 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 15 / 46
◮ almost exclusively used in binaries built from the same source. Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 16 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 17 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 18 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 19 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 20 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 21 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 22 / 46
1
2
3
4
5
6
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 23 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 24 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 25 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 26 / 46
1 With single suite + architecture, there is at most one version of any
2 We forbid the use of alternatives implementations for libraries as it is
3 We only want so many implementations of awk, dpkg, etc. 4 Breakage is usually quite “obvious” (despite a “exploded options
5 We discourage (and in many cases) forbid the use of permanent
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 27 / 46
1
2
3
4
5
6
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 28 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 29 / 46
◮ That is, old packages are removed.
◮ That is, they have been upgraded if there was a new version
◮ This involves installing new packages, so we will ignore that. Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 30 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 31 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 32 / 46
◮ This is generally true for pure stable to stable upgrades
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 33 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 34 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 35 / 46
◮ Theory: “Given a set of installable mutually co-installable packages
called I”
◮ Theory: “We can compute Inew = (I \ R) ∪ A in linear time”
◮ Theory: “We verify that Inew is a valid solution in O(|I| + |E|)”
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 36 / 46
◮ Due to “Depends: foo (= ${binary:Version})” ◮ Side-effect: Also resolves intra-source Breaks/Replaces.
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 37 / 46
◮ Example test: libc6, ant, man-db*, eclipse*, xterm*, etc. ◮ Not tested in “all configurations”
◮ Common for libraries without ABI breaks ◮ Enables upgrading of “stable” packages before their reverse
dependencies
◮ Example issues: perl packages, python packages, etc.
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 38 / 46
◮ Example: dpkg needs new version of libc ◮ Example: dpkg breaks old version of readahead-fedora
◮ Example: bar/wheezy depends on libfoo1, bar/jessie depends on
libfoo2.
◮ Example: bar depends on foo. In Jessie, foo depends on one single
foo-replacement.
◮ In both cases, the replacement is built from the same source as the
package being replaced.
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 39 / 46
1
2
3
4
5
6
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 40 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 41 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 42 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 43 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 44 / 46
Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 45 / 46
about the slides: available at https://anonscm.debian.org/cgit/users/nthykier/talks.git c 2015 Niels Thykier c 2010–2014 Stefano Zacchiroli (original templates/images) license Creative Commons Attribution-ShareAlike 4.0 International License Niels Thykier (Debian) Debian dependency resolution in polynomial time DebConf15 2015 46 / 46