list-rdeps: run for several packages at once, generalise wording
Ximin Luo
4 years ago
6 | 6 | which grep-dctrl >/dev/null || abort 1 "grep-dctrl not found, install dctrl-tools" |
7 | 7 | which aptitude >/dev/null || abort 1 "aptitude not found, install it" |
8 | 8 | |
9 | pkg="${1//_/-}" | |
10 | pkg="${pkg#rust-}" | |
9 | ARCHIVE="${ARCHIVE:-unstable}" | |
11 | 10 | |
12 | 11 | if [ $(($(date +%s) - $(stat -c %Y /var/cache/apt/pkgcache.bin))) -gt 7200 ]; then |
13 | 12 | read -p "APT cache is a bit old, update? [Y/n] " x |
14 | 13 | if [ "$x" != "n" ]; then sudo apt update; fi |
15 | 14 | fi |
16 | 15 | |
17 | ARCHIVE="${ARCHIVE:-unstable}" | |
18 | 16 | apt_versions() { |
19 | 17 | aptitude versions --disable-columns -F '%p %t' --group-by=none "~rnative $1" | grep "$ARCHIVE" |
20 | 18 | } |
27 | 25 | fi |
28 | 26 | } |
29 | 27 | |
30 | echo "Versions of rust-${pkg} in $ARCHIVE:" | |
31 | apt_versions "~e^rust-${pkg}$" | sort | while read binpkg ver archive; do | |
32 | stat="$(installability "$binpkg" "$ver")" | |
33 | printf "%s %-48s %-16s\n" "$stat" "$binpkg" "$ver" | |
34 | done | |
35 | echo | |
28 | list_rdeps() { | |
29 | pkg="${1//_/-}" | |
30 | pkg="${pkg#rust-}" | |
36 | 31 | |
37 | echo "Versions of rdeps in $ARCHIVE:" | |
38 | apt_versions "~D^librust-${pkg}~(\+~|-[0-9]~).*-dev$" | while read rdep ver archives; do | |
39 | apt-cache show "${rdep}=${ver}" \ | |
40 | | grep-dctrl -FDepends -e "librust-${pkg}(\+|-[0-9]).*-dev" -sPackage,Version,Depends - \ | |
41 | | cut -d: -f2 | cut '-d ' -f2- \ | |
42 | | sed -z -e 's/\n\n/\t/g' -e 's/\n/ /g' -e 's/\t/\n/g' | |
43 | done | sort | while read rdep ver deps; do | |
44 | rustdeps="$(printf "%s" "$deps" | tr ',' '\n' | egrep -wo "librust-${pkg}(\+|-[0-9])\S*-dev" | tr '\n' ' ')" | |
45 | stat="$(installability "$rdep" "$ver")" | |
46 | printf "%s %-48s %-16s depends on %s\n" "$stat" "$rdep" "$ver" "$rustdeps" | |
47 | done | |
48 | echo | |
32 | echo "Versions of rust-${pkg} in $ARCHIVE:" | |
33 | apt_versions "~e^rust-${pkg}$" | sort | while read binpkg ver archive; do | |
34 | local stat="$(installability "$binpkg" "$ver")" | |
35 | printf "%s %-48s %-16s\n" "$stat" "$binpkg" "$ver" | |
36 | done | |
37 | echo | |
38 | ||
39 | echo "Versions of rdeps of rust-${pkg} in $ARCHIVE:" | |
40 | apt_versions "~D^librust-${pkg}~(\+~|-[0-9]~).*-dev$" | while read rdep ver archives; do | |
41 | apt-cache show "${rdep}=${ver}" \ | |
42 | | grep-dctrl -FDepends -e "librust-${pkg}(\+|-[0-9]).*-dev" -sPackage,Version,Depends - \ | |
43 | | cut -d: -f2 | cut '-d ' -f2- \ | |
44 | | sed -z -e 's/\n\n/\t/g' -e 's/\n/ /g' -e 's/\t/\n/g' | |
45 | done | sort | while read rdep ver deps; do | |
46 | local rustdeps="$(printf "%s" "$deps" | tr ',' '\n' | egrep -wo "librust-${pkg}(\+|-[0-9])\S*-dev" | tr '\n' ' ')" | |
47 | local stat="$(installability "$rdep" "$ver")" | |
48 | printf "%s %-48s %-16s depends on %s\n" "$stat" "$rdep" "$ver" "$rustdeps" | |
49 | done | |
50 | echo | |
51 | } | |
52 | ||
53 | for i in "$@"; do list_rdeps "$i"; done | |
49 | 54 | |
50 | 55 | cat <<eof |
51 | 56 | If any package is marked "X" (to the left of the package) it means it is not |
52 | 57 | installable even in $ARCHIVE - you should check why this is so by attempting to |
53 | 58 | install it yourself, e.g. via aptitude, and see why it can't be installed. This |
54 | 59 | must be fixed before migration is attempted. For example, it may depend on a |
55 | package which is not yet in Debian. | |
60 | package which is not yet in Debian. Make sure you give the \`-t $ARCHIVE\` flag | |
61 | so it chooses packages from the correct archive. | |
56 | 62 | |
57 | One common reason, for an rdep, is that its dependency (on rust-${pkg}) is out | |
58 | of date - check the "depends" column above to see if this is the case. If so, | |
59 | you must upgrade it to the current version, by patching Cargo.toml to accept | |
60 | the new version of ${pkg} as a dependency. Of course, check that the build | |
61 | works - if it doesn't, then you'll need to further patch the source code of the | |
62 | rdep to use the API of the new version of ${pkg}. | |
63 | One common reason, for an rdep, is that its dependency is out of date - check | |
64 | the "depends" column above to see if this is the case. If so, you must upgrade | |
65 | it to the current version, by patching Cargo.toml to accept the new version of | |
66 | the dependency. Of course, check that the build works - if it doesn't, then | |
67 | you'll need to further patch the source code of the rdep to use the API of the | |
68 | new version of the dependency. | |
63 | 69 | |
64 | 70 | Alternatively, if any rdep is obsolete (i.e. nothing else depends on it) then |
65 | 71 | you should file a RM request to remove it from the Debian archive. See the |