6 releases

0.3.2 Oct 30, 2020
0.3.1 Dec 29, 2019
0.3.0 Nov 18, 2017
0.2.1 Sep 9, 2017
0.1.0 Jul 13, 2017

#193 in Operating systems

Download history 38/week @ 2023-06-01 21/week @ 2023-06-08 58/week @ 2023-06-15 77/week @ 2023-06-22 46/week @ 2023-06-29 14/week @ 2023-07-06 26/week @ 2023-07-13 20/week @ 2023-07-20 36/week @ 2023-07-27 35/week @ 2023-08-03 11/week @ 2023-08-10 52/week @ 2023-08-17 132/week @ 2023-08-24 22/week @ 2023-08-31 31/week @ 2023-09-07 19/week @ 2023-09-14

222 downloads per month
Used in deb-version

MIT license


Rust 896 SLoC // 0.0% comments C++ 318 SLoC // 0.1% comments

This crate provides bindings to libapt-pkg.

Build status

Documentation and Examples

See the examples/ folder for some partial implementations of some commands.


License Note

While the code in this crate is available under a permissive MIT license, it is useless without libapt-pkg, which is GPL2+.


libapt-pkg-dev must be installed. The cc crate is used to try and find a native compiler.

The ye-olde-apt feature provides support for apt <1.2 (Ubuntu 14.04 (Trusty), Debian 7 (Jessie) (2015)). This works by just deleting methods which are not available in that version. See #2.

Thread safety

It is intended that the crate should be usable from multiple threads. However, this is generally implemented using singletons, which may be really annoying for your use-case.

The current way the singleton is managed is awful, and it's not been fixed while I've been learning about the problems. A major version bump, and a proper singleton, may resolve some of the issues. This needs to be done eventually.

apt does not have a concurrency model: you may not use threads.

Since apt 1.4 or 1.5 (in Debian Stretch (2017), but not in Xenial 16.04), some operations are thread safe: it should be possible to initialise the cache twice in parallel. As these versions of apt are not widespread, the API of this crate does not attempt to expose this.

Switching distro with docker

examples/on-sid has a docker file which builds a minimum Debian image with typical package lists downloaded. You can run a tool in it, from this directory, by:

(cd examples/on-sid && make)
docker run -v $(pwd):/mnt sid-sources-list /mnt/target/release/examples/sources