Go to file
Alexander Burmatov af18754224 cargo vendor
2024-07-06 02:39:39 +03:00
.cargo cargo vendor 2024-07-06 02:39:39 +03:00
apt-pkg-c fix: missing header(?) 2020-10-30 00:27:12 +00:00
examples chore: cripple some examples on ye-old-apt 2020-10-30 00:27:29 +00:00
src chore: clippy: unused import 2020-10-30 00:32:40 +00:00
vendor cargo vendor 2024-07-06 02:39:39 +03:00
.gitignore list packages (after manual make) 2017-07-12 21:18:34 +01:00
.travis.yml chore: bump travis 2019-12-29 21:37:25 +00:00
build.rs hack: work around https://github.com/rust-lang/rust/pull/57018 2019-04-13 23:08:48 +01:00
Cargo.lock cargo vendor 2024-07-06 02:39:39 +03:00
Cargo.toml bump version to 0.3.2 2020-10-30 00:11:07 +00:00
LICENSE.MIT docs / crates.io stuff 2017-07-13 16:12:58 +01:00
README.md chore: link to rust-apt 2022-09-26 14:44:59 +01:00

This crate provides bindings to libapt-pkg.

Build status

Documentation and Examples

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

https://docs.rs/apt-pkg-native

License Note

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

Building

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.

Alternatives

There is a similar project at rust-apt.

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