• This repository has been archived on 12/Dec/2022
  • Stars
    star
    533
  • Rank 83,238 (Top 2 %)
  • Language
    C++
  • Created about 11 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Mirror of the apt git repository - This is just a mirror of the upstream repository, please submit pull requests there: https://salsa.debian.org/apt-team/apt

APT

apt is the main command-line package manager for Debian and its derivatives. It provides command-line tools for searching and managing as well as querying information about packages as well as low-level access to all features provided by the libapt-pkg and libapt-inst libraries which higher-level package managers can depend upon.

Included tools are:

  • apt-get for retrieval of packages and information about them from authenticated sources and for installation, upgrade and removal of packages together with their dependencies
  • apt-cache for querying available information about installed as well as available packages
  • apt-cdrom to use removable media as a source for packages
  • apt-config as an interface to the configuration settings
  • apt-key as an interface to manage authentication keys
  • apt-extracttemplates to be used by debconf to prompt for configuration questions before installation
  • apt-ftparchive creates Packages and other index files needed to publish an archive of deb packages
  • apt-sortpkgs is a Packages/Sources file normalizer
  • apt is a high-level command-line interface for better interactive usage

The libraries libapt-pkg and libapt-inst are also maintained as part of this project, alongside various additional binaries like the acquire methods used by them. Bindings for Python (python-apt) and Perl (libapt-pkg-perl) are available as separated projects.

Discussion happens mostly on the mailing list (archive) and on IRC. Our bug tracker as well as a general overview can be found at the Debian Tracker page.

Contributing

APT is maintained in git, the official repository being located at https://salsa.debian.org/apt-team/apt, but also available at other locations like GitHub.

The default branch is main, other branches targeted at different derivatives and releases being used as needed. Various topic branches in different stages of completion might be branched of from those, which you are encouraged to do as well.

Coding

APT uses CMake. To start building, you need to run

cmake <path to source directory>

from a build directory. For example, if you want to build in the source tree, run:

cmake .

Then you can use make as you normally would (pass -j <count> to perform <count> jobs in parallel).

You can also use the Ninja generator of CMake, to do that pass -G Ninja to the cmake invocation, and then use ninja instead of make.

The source code uses in most parts a relatively uncommon indent convention, namely 3 spaces with 8 space tab (see doc/style.txt for more on this). Adhering to it avoids unnecessary code-churn destroying history (aka: git blame) and you are therefore encouraged to write patches in this style. Your editor can surely help you with this, for vim the settings would be setlocal shiftwidth=3 noexpandtab tabstop=8 (the latter two are the default configuration and could therefore be omitted).

Translations

While we welcome contributions here, we highly encourage you to contact the Debian Internationalization (i18n) team. Various language teams have formed which can help you create, maintain and improve a translation, while we could only do a basic syntax check of the file formatโ€ฆ

Further more, translating APT is split into two independent parts: The program translation, meaning the messages printed by the tools, as well as the manual pages and other documentation shipped with APT.

Bug triage

Software tools like APT, which are used by thousands of users every day, have a steady flow of incoming bug reports. Not all of them are really bugs in APT: It can be packaging bugs, like failing maintainer scripts, that a user reports against apt, because apt was the command they executed that led to this failure; or various wishlist items for new features. Given enough time the occasional duplicate enters the system as well. Our bug tracker is therefore full with open bug reports which are waiting for you! ;)

Testing

Manual execution

When you make changes and want to run them manually, you can just do so. CMake automatically inserts an rpath so the binaries find the correct libraries.

Note that you have to invoke CMake with the right install prefix set (e.g. -DCMAKE_INSTALL_PREFIX=/usr) to have your build find and use the right files by default or alternatively set the locations at run-time via an APT_CONFIG configuration file.

Integration tests

There is an extensive integration test suite available which can be run via:

$ ./test/integration/run-tests

Each test can be run individually as well. The tests are very noisy by default, especially so while running all of them; it might be beneficial to enable quiet (-q) or very quiet (-qq) mode. The tests can also be run in parallel via -j X where X is the number of jobs to run.

While these tests are not executed at package build-time as they require additional dependencies, the repository contains the configuration needed to run them on Travis CI and Shippable as well as via autopkgtests e.g. on Debian Continuous Integration.

A test case here is a shell script embedded in a framework creating an environment in which apt tools can be used naturally without root-rights to test every aspect of its behavior itself as well as in conjunction with dpkg and other tools while working with packages.

Unit tests

These tests are gtest-dev based, executed by ctest, reside in ./test/libapt and can be run with make test. They are executed at package build-time, but not by make. CTest by default does not show the output of tests, even if they failed, so to see more details you can also run them with ctest --verbose.

Debugging

APT does many things, so there is no central debug mode which could be activated. Instead, it uses various configuration options to activate debug output in certain areas. The following describes some common scenarios and generally useful options, but is in no way exhaustive.

Note that, to avoid accidents, you should NEVER use these settings as root. Simulation mode (-s) is usually sufficient to help you run apt as a non-root user.

Using different state files

If a dependency solver bug is reported, but can't easily be reproduced by the triager, it is beneficial to ask the reporter for the /var/lib/dpkg/status file which includes the packages installed on the system and in which version. Such a file can then be used via the option dir::state::status. Beware of different architecture settings! Bug reports usually include this information in the template. Assuming you already have the Packages files for the architecture (see sources.list manpage for the arch= option) you can change to a different architecture with a configuration file like:

APT::Architecture "arch1";
#clear APT::Architectures;
APT:: Architectures { "arch1"; "arch2"; }

If a certain mirror state is needed, see if you can reproduce it with snapshot.debian.org. Your sources.list file (dir::etc::sourcelist) has to correctly mention the repository, but if it does, you can use different downloaded archive state files via dir::state::lists.

In case manually vs. automatically installed matters, you can ask the reporter for the /var/lib/apt/extended_states file and use it with dir::state::extended_states.

Dependency resolution

APT works in its internal resolver in two stages: First all packages are visited and marked for installation, keep back or removal. Option Debug::pkgDepCache::Marker shows this. This also decides which packages are to be installed to satisfy dependencies, which can be seen by Debug::pkgDepCache::AutoInstall. After this is done, we might be in a situation in which two packages want to be installed, but only one of them can be. It is the job of the pkgProblemResolver to decide which of two packages 'wins' and can therefore decide what has to happen. You can see the contenders as well as their fight and the resulting resolution with Debug::pkgProblemResolver.

Downloading files

Various binaries (called 'methods') are tasked with downloading files. The Acquire system talks to them via simple text protocol. Depending on which side you want to see, either Debug::pkgAcquire::Worker or Debug::Acquire::http (or similar) will show the messages.

The integration tests use a simple self-built web server (webserver) which also logs. If you find that the http(s) methods do not behave like they should then try to implement this behavior in webserver for simpler and more controlled testing.

Installation order

Dependencies are solved, packages downloaded: Everything is ready for the installation! The last step in the chain is often forgotten, but still very important: Packages have to be installed in a particular order so that their dependencies are satisfied, but at the same time you don't want to install very important and optional packages at the same time if possible, so that a broken optional package does not block the correct installation of very important packages. Which option to use depends on if you are interested in the topology sorting (Debug::pkgOrderList), the dependency-aware cycle and unconfigured prevention (Debug::pkgPackageManager) or the actual calls to dpkg (Debug::pkgDpkgPm).

Additional documentation

Many more things could and should be said about APT and its usage but are more targeted at developers of related programs or only of special interest.

More Repositories

1

dh-make-golang

Automatically creates Debian packaging for Go packages
Go
368
star
2

dcs

Debian Code Search (codesearch.debian.net) is a search engine that searches through all the 130 GB of open source software that is included in Debian. Supports regular expressions!
Go
194
star
3

debiman

debiman generates a static manpage HTML repository out of a Debian archive
Go
181
star
4

raspi3-image-spec

contains the files to build the https://wiki.debian.org/RaspberryPi3 image
127
star
5

.github

Description of the purpose for this GitHub organization
74
star
6

debhelper

Perl
39
star
7

devscripts

Mirror of https://salsa.debian.org/debian/devscripts.git
Perl
31
star
8

ratt

Rebuild All The Things!
Go
30
star
9

debsources

Mirrored from https://salsa.debian.org/qa/debsources
Python
22
star
10

pk4

make available the Debian source package producing the specified package
Go
21
star
11

mergebot

Minimize the number of steps required to accept contributions for Debian packages you maintain.
Go
17
star
12

dak

[MIRROR] - send patches to https://salsa.debian.org/ftp-team/dak
Python
16
star
13

dput-ng

[MIRROR] - do not open PRs here
Python
14
star
14

tensorflow

C++
11
star
15

debile

[MIRROR] - actually hosted @ git.d.o
Python
10
star
16

java-package

Utility for creating Java Debian packages (mirrored from git.debian.org)
Shell
9
star
17

britney2

Python
8
star
18

openjdk-8

OpenJDK 8 packaging for Debian (mirrored from git.debian.org)
7
star
19

pkg-go-tools

tools (implemented in Go) for the pkg-go Debian packaging team
Go
6
star
20

docker.io

Debian Docker packaging
6
star
21

kfreebsd-11

6
star
22

ud

a reimplementation of Debian's userdir-ldap, leveraging the Django framework
Python
4
star
23

intel-mkl

[Mirror] https://salsa.debian.org/science-team/intel-mkl
3
star
24

freebsd-utils

3
star
25

spdx-licenses

Packaging data for spdx-licenses
3
star
26

pytorch

PyTorch Debian Packaging (Mirrored from Salsa)
C++
2
star
27

freebsd-buildutils

2
star
28

rsnapshot

Debian packaging for rsnapshot
2
star
29

kfreebsd-10

2
star
30

freebsd-libs

2
star
31

ctfutils

2
star
32

xserver-xorg-video-nv

2
star
33

ufsutils

2
star
34

firewoes

[MIRROR ONLY] - real repo at git://git.upsilon.cc/firewose.git
Python
2
star
35

cdbs

Read only mirror of https://alioth.debian.org/anonscm/git/collab-maint/cdbs.git
Shell
2
star
36

zfsutils

1
star
37

cuse4bsd

1
star
38

kfreebsd-downloader-10

1
star
39

freebsd-manpages

1
star
40

istgt

1
star
41

freebsd-glue

C
1
star
42

fuse4bsd

1
star
43

kfreebsd-defaults

1
star
44

kfreebsd-kernel-headers

C
1
star
45

freebsd-quota

1
star
46

freebsd-smbfs

1
star