summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@sequoia-pgp.org>2022-07-30 17:39:37 +0300
committerLars Wirzenius <liw@sequoia-pgp.org>2022-07-30 20:19:48 +0300
commitc75c5f5b415fb27d969997caa333df921c85f04d (patch)
treeced6c4d9fd95aba73047ed30e3a7fda10d12e5c9
parent678c408b1a911a2a452ea31624ef595649b4acf7 (diff)
downloadmissing-dependencies-c75c5f5b415fb27d969997caa333df921c85f04d.tar.gz
feat: add scripts to list Debian packages and Rust dependencies
Sponsored-by: author
-rw-r--r--README.md6
-rwxr-xr-xdebian-crate-packages18
2 files changed, 19 insertions, 5 deletions
diff --git a/README.md b/README.md
index 9681380..b9df5b3 100644
--- a/README.md
+++ b/README.md
@@ -12,9 +12,6 @@ There are three parts:
* `debian-crate-packages` is a simple shell script that fetches the
package list for the Debian "unstable" version, and produces a list
of Rust crates and versions that have been packaged.
-* `rust-dependencies` is a shell script that reads the output of
- `cargo tree` (possibly with options like `--all-features`) and
- produces a list of crates and versions.
* The Rust program in this crate reads the outputs of the two scripts
and produces a list of missing crates or versions.
@@ -34,8 +31,7 @@ about dependencies:
```sh
$ ./debian-crate-packages > crates-in-debian
-$ (cd /where/rust/program/is && cargo tree) | ./rust-dependencies > crates-wanted
-$ cargo run -q -- crates-in-debian crates-wanted
+$ (cd /where/rust/program/is && cargo tree) | cargo run -q -- crates-in-debian
missing-version aho-corasick 0.7.18
missing-entirely ansi_term
```
diff --git a/debian-crate-packages b/debian-crate-packages
new file mode 100755
index 0000000..c4c8a5a
--- /dev/null
+++ b/debian-crate-packages
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+set -euo pipefail
+
+if [ ! -e Packages ]; then
+ curl -s http://deb.debian.org/debian/dists/unstable/main/binary-amd64/Packages.xz |
+ unxz >Packages
+fi
+grep-dctrl -s Package,Version librust- Packages |
+ awk '
+/^Package:/ {
+ name = $2
+ gsub(/^librust-/, "", name)
+ gsub(/-dev$/, "", name)
+ gsub(/-/, "_", name)
+}
+/^Version:/ { gsub(/-[^-]*$/, "", $2); print name, $2 }
+'