chrlutz / apt-repos

Show information about binary and source packages in multiple (independent) apt-repositories utilizing libapt / python-apt/ apt_pkg without the need to change the local system and it's apt-setup.
GNU Lesser General Public License v2.1
15 stars 5 forks source link

Short Description

Show information about binary and source packages in multiple (independent) apt-repositories utilizing libapt / python-apt/ apt_pkg without the need to change the local system and it's apt-setup.

Long Description

This tool is aimed for people that extensively work with multiple apt-repositores, e.g. developers of an own debian based software distribution, debian package maintainers or debian users who just want to get an overview about packages that are provided in various apt-repositories and suites. Similar to the well known tools 'apt-cache (show|policy|search)', 'apt-get (update)', 'dpkg (-l)' it prints information about binary packages and source packages that live in apt-repositories. In contrast to these tools that typically work on a concrete local host with a concrete local apt-setup, this tool allows to inspect multiple indipendent apt-repositories and suites without coupling the local system to these repositories.

The Use-Cases

As known from /etc/apt/sources.list-Files, Apt-Repositories are uniquely identified by an URI pointing to the root of a file system structure that is typically exported per http. Each repository can provide packages for multiple suites, components and architectures. A sources.list definition can contain multiple repository/suite/component combinations that are logically merged into one apt-setup that is valid for the concrete local system. On my Ubuntu-System, for example the following apt repository/suite/component combinations are currently active:

deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted
deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates main restricted
deb http://de.archive.ubuntu.com/ubuntu/ xenial universe
deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates universe
deb http://de.archive.ubuntu.com/ubuntu/ xenial multiverse
deb http://de.archive.ubuntu.com/ubuntu/ xenial-updates multiverse
deb http://security.ubuntu.com/ubuntu xenial-security main restricted
deb http://security.ubuntu.com/ubuntu xenial-security universe
deb http://security.ubuntu.com/ubuntu xenial-security multiverse

With the help the tool apt-cache it is now possible to retrieve information about packages provided by the above apt-setup. There is currently no simple way to retrieve information about packages in other repository/suite/component constellations without modifying the local apt-setup. This means that it is not easily possible to e.g. show the list of packages provided by an older ubuntu-suite like trusty.

The following use-cases are addressed by this project:

The Solution

Each repository URI is mapped to a shortname. E.g. http://de.archive.ubuntu.com/ubuntu/ to the much more simple form "ubuntu:". We just add the suite-name and are now able to address the above example repository/suite combinations with very short names, e.g. "ubuntu:xenial", "ubuntu:xenial-updates" or "ubuntu:xenial-security". From now on will call such a short name suite-id.

One or more apt-repos specific configuration files describe the mappings from suite-id's to SourcesList-entries, such as

[
   {
      "Suite" : "ubuntu:xenial",
      "SourcesList" : "deb http://de.archive.ubuntu.com/ubuntu/ xenial main restricted universe multiverse"
      "DebSrc" : true,
      "Architectures" : [ "i386", "amd64" ]
   },
   {
      "Suite" : "ubuntu:xenial-security",
      "SourcesList" : "deb http://security.ubuntu.com/ubuntu xenial-security main restricted universe multiverse"
      "DebSrc" : true,
      "Architectures" : [ "i386", "amd64" ]
   },
   {
      "Suite" : "kubuntu-backports:xenial",
      "SourcesList" : "deb http://ppa.launchpad.net/kubuntu-ppa/backports/ubuntu xenial main"
      "DebSrc" : true,
      "Architectures" : [ "i386", "amd64" ]
   }

]

There are various ways to define single suites or multiple suites from an apt-repository. Apt-repos also has the ability to scan existing apt-repositories to dynamically find and map contained suites to suite-id's. More information about how to configure apt-repos can be found in docs/Configuration.

A new command line tool apt-repos prints information about the packages in these repositories. Analogue to the nomenclature of apt-cache, apt-repos it provides various sub commands:

We use so called suite-selectors to describe in which repository/suite combinations we want to search for a particular query. The following ways of selecting suites are possible:

Each time a particular repository/suite combination is scanned, apt-repos checks if there are new Packages-Files available in the repository and downloads the Packages-Files if necessary into a local cache.

A python module python3-apt-repos (provided in this git-repository) allows us to access the information in the local cache. Also the command line interface apt-repos uses this library. This way we can easily access package information not only in apt-repos but also in other custom python modules.

State

Current State:

Contributions from interrested people via patches or pull requests are very welcome.

License

Everything there is licensed under LGPL version 2.1 or any later version.