Codebase list rust-stfu8 / a7f38ff
list-rdeps: use a cache file for installability checks Ximin Luo 4 years ago
1 changed file(s) with 14 addition(s) and 3 deletion(s). Raw diff Collapse all Expand all
1717 aptitude versions --disable-columns -F '%p %t' --group-by=none "~rnative $1" | grep "$ARCHIVE"
1818 }
1919
20 inst_cache=$(mktemp)
21 # https://stackoverflow.com/a/14812383 inside "trap" avoids running handler twice
22 trap 'excode=$?; rm -rf "'"$inst_cache"'"; trap - EXIT' EXIT HUP INT QUIT PIPE TERM
23
2024 installability() {
21 if apt -t "$ARCHIVE" -s install "$1=$2" 2>/dev/null >/dev/null; then
22 echo " "
25 local r=$(grep -F "$1=$2" "$inst_cache" | cut -f2)
26 if [ -n "$r" ]; then
27 echo "$r"
2328 else
24 echo "X"
29 if apt -t "$ARCHIVE" -s install "$1=$2" 2>/dev/null >/dev/null; then
30 r=" "
31 else
32 r="X"
33 fi
34 printf "%s=%s\t%s\n" "$1" "$2" "$r" >> "$inst_cache"
35 echo "$r"
2536 fi
2637 }
2738