]> git.saurik.com Git - apt.git/blame - README.md
Optimize VersionHash() to not need temporary copy of input
[apt.git] / README.md
CommitLineData
2457d184
DK
1APT
2===
3
4apt is the main commandline package manager for Debian and its derivatives.
5It provides commandline tools for searching and managing as well as querying
6information about packages as well as low-level access to all features
7provided by the libapt-pkg and libapt-inst libraries which higher-level
8package managers can depend upon.
9
10Included tools are:
11
12* apt-get for retrieval of packages and information about them
13 from authenticated sources and for installation, upgrade and
14 removal of packages together with their dependencies
15* apt-cache for querying available information about installed
16 as well as installable packages
17* apt-cdrom to use removable media as a source for packages
18* apt-config as an interface to the configuration settings
19* apt-key as an interface to manage authentication keys
20* apt-extracttemplates to be used by debconf to prompt for configuration
21 questions before installation.
22* apt-ftparchive creates Packages and other index files
23 needed to publish an archive of debian packages
24* apt-sortpkgs is a Packages/Sources file normalizer.
25
26The libraries libapt-pkg and libapt-inst are also maintained as part of this project,
27alongside various additional binaries like the acquire-methods used by them.
28Bindings for Python ([python-apt](https://tracker.debian.org/pkg/python-apt)) and
29Perl ([libapt-pkg-perl](https://tracker.debian.org/pkg/libapt-pkg-perl)) are available as separated projects.
30
31Discussion happens mostly on [the mailinglist](mailto:deity@lists.debian.org) ([archive](https://lists.debian.org/deity/)) and on [IRC](irc://irc.oftc.net/debian-apt).
32Our bugtracker as well as a general overview can be found at the [Debian Tracker page](https://tracker.debian.org/pkg/apt).
33
34
35Contributing
36------------
37APT is maintained in git, the official repository being located at
4030a669 38`git://anonscm.debian.org/apt/apt.git` ([webgit](https://anonscm.debian.org/git/apt/apt.git)),
2457d184
DK
39but also available at other locations like [GitHub](https://github.com/Debian/apt).
40
2ee1a6f0 41The default branch is `master`, other branches targeted at different
2457d184
DK
42derivatives and releases being used as needed. Various topic branches in
43different stages of completion might be branched of from those, which you
44are encouraged to do as well.
45
46### Coding
47
fb0f82b2 48APT uses cmake. To start building, you need to run
2457d184 49
17631ae7 50 cmake <path to source directory>
2457d184 51
fb0f82b2
JAK
52from a build directory. For example, if you want to build in the source tree,
53run:
54
17631ae7 55 cmake .
fb0f82b2
JAK
56
57Then you can use make as you normally would (pass -j <count> to perform <count>
58jobs in parallel).
59
60You can also use the Ninja generator of cmake, to do that pass
17631ae7 61 -G Ninja
fb0f82b2 62to the cmake invocation, and then use ninja instead of make.
2457d184
DK
63
64The source code uses in most parts a relatively uncommon indent convention,
4030a669 65namely 3 spaces with 8 space tab (see [doc/style.txt](https://anonscm.debian.org/git/apt/apt.git/tree/doc/style.txt) for more on this).
2457d184
DK
66Adhering to it avoids unnecessary code-churn destroying history (aka: `git blame`)
67and you are therefore encouraged to write patches in this style.
68Your editor can surely help you with this, for vim the settings would be
69`setlocal shiftwidth=3 noexpandtab tabstop=8`
70(the later two are the default configuration and could therefore be omitted).
71
72### Translations
73
74While we welcome contributions here, we highly encourage you to contact the [Debian Internationalization (i18n) team](https://wiki.debian.org/Teams/I18n).
75Various language teams have formed which can help you creating, maintaining
76and improving a translation, while we could only do a basic syntax check of the
77file format…
78
79Further more, Translating APT is split into two independent parts:
80The program translation, meaning the messages printed by the tools,
81as well as the manpages and other documentation shipped with APT.
82
83### Bug triage
84
85Software tools like APT which are used by thousands of users every
86day have a steady flow of incoming bugreports. Not all of them are really
87bugs in APT: It can be packaging bugs like failing maintainer scripts a
88user reports against apt, because apt was the command he executed leading
89to this failure or various wishlist items for new features. Given enough time
90also the occasional duplicate enters the system.
91Our bugtracker is therefore full with open bugreports which are waiting for you! ;)
c4d749b7
MV
92
93Testing
94-------
95
2457d184
DK
96### Manual execution
97
fb0f82b2
JAK
98When you make changes and want to run them manually, you can just do so. CMake
99automatically inserts an rpath so the binaries find the correct libraries.
2457d184 100
7ce2af82
DK
101Note that you have to invoke CMake with the right install prefix set (e.g.
102`-DCMAKE_INSTALL_PREFIX=/usr`) to have your build find and use the right files
103by default or alternatively set the locations at runtime via an `APT_CONFIG`
104configuration file.
105
2457d184
DK
106### Integration tests
107
7ce2af82 108There is an extensive integration testsuite available which can be run via:
2457d184
DK
109
110 $ ./test/integration/run-tests
111
7ce2af82
DK
112Each test can also be run individually as well. The tests are very noisy by
113default, especially so while running all of them it might be beneficial to
114enabling quiet (`-q`) or very quiet (`-qq`) mode. The tests can also be run in
115parallel via `-j X` where `X` is the number of jobs to run.
116
117While these tests are not executed at package build-time as they require
118additional dependencies, the repository contains the configuration needed to
119run them on [Travis CI](https://travis-ci.org/) and
120[Shippable](https://shippable.com/) as well as via autopkgtests e.g. on
121[Debian Continuous Integration](https://ci.debian.net/packages/a/apt/).
2457d184
DK
122
123A testcase here is a shellscript embedded in a framework creating an environment in which
124apt tools can be used naturally without root-rights to test every aspect of its behavior
125itself as well as in conjunction with dpkg and other tools while working with packages.
126
127
128### Unit tests
129
ecaae01f
DK
130These tests are gtest-dev based, executed by ctest, reside in `./test/libapt`
131and can be run with `make test`. They are executed at package build-time, but
132not by `make`. CTest by default does not show the output of tests, even if they
133failed, so to see more details you can also run them with `ctest --verbose`.
2457d184
DK
134
135Debugging
136---------
137
138APT does many things, so there is no central debug mode which could be
139activated. It uses instead various config-options to activate debug output
140in certain areas. The following describes some common scenarios and generally
141useful options, but is in no way exhaustive.
142
143Note that you should *NEVER* use these settings as root to avoid accidents.
7ce2af82 144Simulation mode (`-s`) is usually sufficient to help you run apt as a non-root user.
2457d184
DK
145
146### Using different state files
147
148If a dependency solver bug is reported, but can't be reproduced by the
149triager easily, it is beneficial to ask the reporter for the
150`/var/lib/dpkg/status` file, which includes the packages installed on the
151system and in which version. Such a file can then be used via the option
152`dir::state::status`. Beware of different architecture settings!
153Bugreports usually include this information in the template. Assuming you
154already have the `Packages` files for the architecture (see `sources.list`
155manpage for the `arch=` option) you can change to a different architecture
156with a config file like:
157
158 APT::Architecture "arch1";
159 #clear APT::Architectures;
160 APT:: Architectures { "arch1"; "arch2"; }
161
162If a certain mirror state is needed, see if you can reproduce it with [snapshot.debian.org](http://snapshot.debian.org/).
163Your sources.list file (`dir::etc::sourcelist`) has to be correctly mention the repository,
164but if it does, you can use different downloaded archive state files via `dir::state::lists`.
165
166In case manually vs. automatically installed matters, you can ask the reporter for
167the `/var/lib/apt/extended_states` file and use it with `dir::state::extended_states`.
168
169### Dependency resolution
170
171APT works in its internal resolver in two stages: First all packages are visited
172and marked for installation, keep back or removal. Option `Debug::pkgDepCache::Marker`
173shows this. This also decides which packages are to be installed to satisfy dependencies,
174which can be seen by `Debug::pkgDepCache::AutoInstall`. After this is done, we might
175be in a situation in which two packages want to be installed, but only on of them can be.
176It is the job of the pkgProblemResolver to decide which of two packages 'wins' and can
177therefore decide what has to happen. You can see the contenders as well as their fight and
178the resulting resolution with `Debug::pkgProblemResolver`.
179
180### Downloading files
181
182Various binaries (called 'methods') are tasked with downloading files. The Acquire system
183talks to them via simple text protocol. Depending on which side you want to see, either
184`Debug::pkgAcquire::Worker` or `Debug::Acquire::http` (or similar) will show the messages.
185
186The integration tests use a simple self-built webserver which also logs. If you find that
187the http(s) methods do not behave like they should be try to implement this behavior in the
188webserver for simpler and more controlled testing.
c4d749b7 189
2457d184 190### Installation order
c4d749b7 191
2457d184
DK
192Dependencies are solved, packages downloaded: Everything read for the installation!
193The last step in the chain is often forgotten, but still very important:
194Packages have to be installed in a particular order so that their dependencies are
195satisfied, but at the same time you don't want to install very important and optional
196packages at the same time if possible, so that a broken optional package does not
197block the correct installation of very important packages. Which option to use depends on
198if you are interested in the topology sorting (`Debug::pkgOrderList`), the dependency-aware
199cycle and unconfigured prevention (`Debug::pkgPackageManager`) or the actual calls
200to dpkg (`Debug::pkgDpkgPm`).