Codebase list debian-goodies / 8f7dd6f
Make debget a lightweight wrapper around "apt-get download" Closes: #733471 Axel Beckert 6 years ago
2 changed file(s) with 6 addition(s) and 45 deletion(s). Raw diff Collapse all Expand all
5252 fi
5353 set -e
5454
55
55 error=0
5656 for pkgspec in $*; do
5757 set +e
58 apt-get -q2 --print-uris download "$pkgspec" 2>/dev/null >/dev/null
58 apt-get download "$pkgspec"
5959 if [ $? -ne 0 ] ; then
60 echo "ERROR: There is no '$pkgspec' package. Sorry."
6160 echo "If you believe the package exists then consider updating your"
6261 echo "package database using 'apt-get update'."
62 error=1
6363 continue
6464 fi
65 set -e
66 # This provides only one version, but it's better than the apt-get
67 # call which will not work in packages not available locally
68 apt-cache show "$pkgspec" 2>/dev/null | grep ^Ver |
69 while read version; do
70 version=`echo $version | sed -ne '$s/^.*: \(.*\).*$/\1/p'`
71 echo "($pkgspec -> $version)"
72 done
73 aptdata=$(apt-get -q2 --print-uris download "$pkgspec" 2>/dev/null | grep -F "/${pkgspec}_")
74 if [ -z "$aptdata" ] ; then
75 echo "ERROR: No APT data returned for '$pkgspec'. Sorry."
76 echo "This is probably because the package is in the local apt cache"
77 echo "Tip: Use 'aptitude download'"
78 continue
79 fi
80 url=$(echo "$aptdata" | sed -e "s/^'\([^']*\)'.*$/\1/")
81 file=$(echo "$aptdata" | sed -e "s/^'[^']*' \([^ ]*\).*$/\1/")
82 if [ -z "$url" ] ; then
83 echo "ERROR: Cound not obtain an URL for $pkgspec"
84 else
85 if echo "$url" | egrep -q '^tor\+'; then
86 if which torify 2>&1 > /dev/null; then
87 torify=torify
88 else
89 echo "torify not found, can not download $url" 1>&2
90 exit 2
91 fi
92 url=$(echo "$url" | sed -e 's/^tor+//')
93 fi
94 if [ -n "$torify" ]; then
95 echo "Downloading $pkgspec from $url via tor"
96 else
97 echo "Downloading $pkgspec from $url"
98 fi
99 $torify curl "$url" > "$file"
100 fi
10165 done
66 exit $error
00 debian-goodies (0.71) UNRELEASED; urgency=medium
11
2 * debget (and therefore also debman):
3 + Support apt-transport-tor i.e. tor+http:// and tor+https:// APT
4 repository URLs. (Closes: #821156)
5 + Replace "apt-get --print-uris --reinstall install" with "apt-get
6 --print-uris download" to avoid dependency resolution before
7 printing URLs. (Closes: #733465)
2 * Make debget a lightweight wrapper around "apt-get download". Speeds up
3 script by up to factor 2. (Closes: #821156, #733465, #733471)
84
95 -- Axel Beckert <abe@debian.org> Sat, 22 Apr 2017 01:48:14 +0200
106