Add a more or less useful README file for everything related to MultiArch
[ntk/apt.git] / README.MultiArch
CommitLineData
9a230738
DK
1Before we start with this topic: Note that MultiArch is not yet ready for
2prime time and/or for the casual user. The implementation is so far widely
3untested and only useful for developers of packagemanagment tools which
4use APT and his friends and maintainers of (upcoming) MultiArch packages.
5This README is especially NOT written for the casual user and is NOT a
6usage guide - you have been warned. It is assumed that the reader has
7at least a bit of knowledge about APT internals, dependency relations
8and the MultiArch spec [0].
9
10
11The implementation is focused on NOT breaking existing singleArch-only
12applications and/or systems as this is the current status-quo for all
13systems. Also, many systems don't need (or can't make use of) MultiArch,
14so APT will proceed in thinking SingleArch as long as it is not explicitly
15told to handle MultiArch:
16To activate MultiArch handling you need to specify architectures you
17want to be considered by APT with the config list APT::Architectures
18(Insert architectures in order of preference).
19APT will download Packages files for all these architectures in the
20update step. Exception: In the sourcelist is the optionfield used:
21deb [ arch=amd64,i386 ] http://example.org/ experimental main
22(This optionfield is a NOP in previous apt versions)
23
24Internally in APT a package is represented as a PkgIterator -
25before MultiArch this PkgIterator was architecture unaware,
26only VerIterators include the architecture they came from.
27This is/was a big problem as all versions in a package are
28considered for dependency resolution, so pinning will not work in all cases.
29
30The problem is solved by a conceptional change:
31A PkgIterator is now architecture aware, so the packages
32of foobar for amd64 and for i386 are now for apt internal totally
33different packages. That is a good thing for e.g. pinning, but
34sometimes you need the information that such packages are belonging together:
35All these foobar packages therefore form a Group accessible with GrpIterators.
36Note that the GrpIterator has the same name as all the packages in this group,
37so e.g. apt-cache pkgnames iterates over GrpIterator to get the package names:
38This is compatible to SingleArch as a Group consists only of a single package
39and also to MultiArch as a Group consists of possible many packages which
40all have the same name and are therefore out of interest for pkgnames.
41
42
43Caused by the paragraph "Dependencies involving Architecture: all packages"
44in the MultiArch spec we have a second major conceptional change
45which could even break existing applications, but we hope for the best…
46An Architecture: all package is internally split into pseudo packages
47for all MultiArch Architectures and additional a package with the
48architecture "all" with no dependencies which is a dependency of all
49these architecture depending packages. While the architecture depending
50packages are mainly used for dependency resolution (a package of arch A which
51depends on an arch all package assumes that the dependencies of this package
52are also from arch A. Packages also sometimes change from any to all or v.v.)
53the arch "all" package is used for scheduling download/installation of the
54underlying "real" package. Note that the architecture depending packages can
55be detected with Pseudo() while the "all" package reports exactly this arch
56as package architecture and as pseudo architecture of the versions of this pkg.
57Beware: All versions of a "real" architecture all package will be report "all"
58as their architecture if asked with Arch() regardless if they are the "all" or
59the architecture depending packages. If you want to know the architecture this
60pseudo package was created for call Arch(true). Also, while the spec say that
61arch:all packages are not allowed to have a MultiArch flag APT assigns a
62special value to them: MultiArch: all.
63
64
65As you might guess this arch:all handling has a few problems (but we think so
66far that the problems are minor compared to the problems we would have with
67other implementations.)
68APT doesn't know which pseudo packages of such an arch all package are
69"installed" (to satisfy dependencies), so APT will generate a Cache in which
70all these pseudo packages are installed (e.g. apt-cache policy will display
71them all as installed). Later in the DepCache step it will "remove"
72all pseudo packages whose dependencies are not satisfied.
73The expense is that if the package state is broken APT could come to the
74conclusion to "remove" too many pseudo packages, but in a stable environment
75APT should never end up in a broken system state…
76
77
78Given all these internal changes it is quite interesting that the actual
79implementation of MultiArch is trivial: Some implicit dependencies and a few
80more provides are all changes needed to get it working. Especially noteworthy
81is that it wasn't needed to change the resolver in any way and other parts only
82need to be told about ignoring pseudo packages or using GrpIterator instead of
83PkgIterator, so chances are good that libapt-applications will proceed to work
84without or at least only require minor changes, but your mileage may vary…
85
86
87Known Issues and/or noteworthy stuff:
88* The implementation is mostly untested, so it is very likely that APT will
89 eat your kids if you aren't as lucky as the author of these patches.
90* the (install)size of a pseudo package is always NULL - if you want to know
91 the (install)size you need to get the info from the arch "all" package.
92* It is maybe confusing, but the arch "all" package does have the same versions
93 and in general roughly the same information with one subtil difference:
94 It doesn't have any dependency, regardless of the type. The pseudo packages
95 depend on this package.
96* apt-cache policy foobar on installed architecture all package foobar will
97 report all architecture depending packages as installed. Displaying here the
98 correct information would require to build the complete DepCache…
99* [BUG] An installed package which changes the architecture from any to all
100 (and v.v.) shows up in the NEW packages section instead of UPGRADE.
101* [TODO] Investigate the DepCache pseudo-package killer heuristic:
102 e.g. add more safety guards…
103* [FIXME] a few corner cases/missing features marked as FIXME in the code
104
105
106[0] https://wiki.ubuntu.com/MultiarchSpec