diff -Nru apt-fast-1.8.3~121+gitaf73a17/apt-fast apt-fast-1.8.3~137+git7b72bb7/apt-fast --- apt-fast-1.8.3~121+gitaf73a17/apt-fast 2015-03-12 22:30:01.000000000 +0000 +++ apt-fast-1.8.3~137+git7b72bb7/apt-fast 2016-03-24 18:28:52.000000000 +0000 @@ -72,6 +72,10 @@ TMP_DLLIST="${DLLIST-${TMP_RANDOM}}" TMP_LISTDIR="${LISTDIR-${TMP_RANDOM}}" TMP__MAXNUM="${MAXNUM-${TMP_RANDOM}}" +TMP__MAXCONPERSRV="${MAXCONPERSRV-${TMP_RANDOM}}" +TMP__SPLITCON="${SPLITCON-${TMP_RANDOM}}" +TMP__MINSPLITSZ=${MINSPLITSZ-${TMP_RANDOM}} +TMP__PIECEALGO=${PIECEALGO-${TMP_RANDOM}} TMP_aptfast_prefix="${aptfast_prefix-${TMP_RANDOM}}" TMP_APT_FAST_TIMEOUT="${APT_FAST_TIMEOUT-${TMP_RANDOM}}" @@ -86,7 +90,11 @@ DLDIR="$TMP_DLDIR" \ DLLIST="$TMP_DLLIST" \ LISTDIR="$TMP_LISTDIR" \ - _MAXNUM="$TMP_MAXNUM" \ + _MAXNUM="$TMP__MAXNUM" \ + _MAXCONPERSRV="$TMP__MAXCONPERSRV" \ + _SPLITCON="$TMP__SPLITCON" \ + _MINSPLITSZ="$TMP__MINSPLITSZ" \ + _PIECEALGO="$TMP__PIECEALGO" \ aptfast_prefix="$TMP_aptfast_prefix" \ APT_FAST_TIMEOUT="$TMP_APT_FAST_TIMEOUT" "$0" "$@" fi @@ -114,7 +122,11 @@ # Currently not needed. eval $(apt-config shell LISTDIR Dir::State::lists/d) DLLIST="/tmp/apt-fast.list" -_MAXNUM=5 +_MAXNUM=8 +_MAXCONPERSRV=10 +_SPLITCON=8 +_MINSPLITSZ="1M" +_PIECEALGO="default" # Prefix in front of apt-fast output: aptfast_prefix= @@ -130,7 +142,7 @@ APT_FAST_TIMEOUT=60 # Download command. -_DOWNLOADER='aria2c -c -j ${_MAXNUM} -x ${_MAXNUM} -s ${_MAXNUM} -i ${DLLIST} --min-split-size=1M --connect-timeout=600 --timeout=600 -m0' +_DOWNLOADER='aria2c -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} -i ${DLLIST} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} --connect-timeout=600 --timeout=600 -m0' # Load config file. CONFFILE="/etc/apt-fast.conf" @@ -148,6 +160,10 @@ [ "$TMP_DLLIST" = "$TMP_RANDOM" ] || DLLIST="$TMP_DLLIST" [ "$TMP_LISTDIR" = "$TMP_RANDOM" ] || LISTDIR="$TMP_LISTDIR" [ "$TMP__MAXNUM" = "$TMP_RANDOM" ] || _MAXNUM="$TMP__MAXNUM" +[ "$TMP__MAXCONPERSRV" = "$TMP_RANDOM" ] || _MAXCONPERSRV="$TMP__MAXCONPERSRV" +[ "$TMP__SPLITCON" = "$TMP_RANDOM" ] || _SPLITCON="$TMP__SPLITCON" +[ "$TMP__MINSPLITSZ" = "$TMP_RANDOM" ] || _MINSPLITSZ="$TMP__MINSPLITSZ" +[ "$TMP__PIECEALGO" = "$TMP_RANDOM" ] || _PIECEALGO="$TMP__PIECEALGO" [ "$TMP_aptfast_prefix" = "$TMP_RANDOM" ] || aptfast_prefix="$TMP_aptfast_prefix" [ "$TMP_APT_FAST_TIMEOUT" = "$TMP_RANDOM" ] || APT_FAST_TIMEOUT="$TMP_APT_FAST_TIMEOUT" @@ -194,6 +210,12 @@ rm -f "$LCK_FILE.lock" } +# decode url string +# translates %xx but must not convert '+' in spaces +urldecode() +{ + printf '%b' "${1//%/\\x}" +} # Check if mirrors are available. And if so add all mirrors to download list. get_mirrors(){ @@ -227,17 +249,44 @@ echo "# apt-fast mirror list: $(date)" > "$DLLIST" #NOTE: aptitude doesn't have this functionality, so we use apt-get to get # package URIs. - for urimd5 in $(apt-get -y --print-uris "$@" | egrep "^'(http(s|)|(s|)ftp)://[^']+'.+ MD5Sum:\S+\s*$" | - sed "s/^'\(.\+\)'.*MD5Sum:\(\S\+\)\s*$/\1::MD5Sum:\2/"); do - #for urimd5 in $(cat foo | egrep "^'(http(s|)|(s|)ftp)://[^']+'.+ MD5Sum:\S+\s*$" | - # sed "s/^'\(.\+\)'.*MD5Sum:\(\S\+\)\s*$/\1::MD5Sum:\2/"); do - uri="${urimd5%::MD5Sum:*}" - checksum="${urimd5#*::MD5Sum:}" + apt-get -y --print-uris "$@" | egrep "^'(http(s|)|(s|)ftp)://" | \ + while read pkg_uri_info + do + ## --print-uris format is: + # 'fileurl' filename filesize checksum_hint:filechecksum + uri=$(echo "$pkg_uri_info" | cut -d' ' -f1 | tr -d "'") + filename=$(echo "$pkg_uri_info" | cut -d' ' -f2) + filesize=$(echo "$pkg_uri_info" | cut -d' ' -f3) + checksum=$(echo "$pkg_uri_info" | cut -d' ' -f4 | cut -d':' -f2) + ## whole uri comes encoded (urlencoded). Filename must NOT be decoded because + # plain aptitude do not decode it when download and install it. Therefore, we + # will have ugly named packages at /var/cache/apt/archives but is the standard + # behavior. + # But package version must be decoded, otherways package=version calls will + # not work. + + ## Aria only supports md5 and sha1. If --print-uris return other than + # MD5, we need to replace it (by now behavior is return strongest). + # Using apt-cache show package=version to ensure recover single and + # correct package version. + # Warning: assuming that package naming uses '_' as field separator. + # Therefore, this code expects package-name_version_arch.deb Otherways + # below code will fail resoundingly + if echo "$pkg_uri_info" | grep -q -v 'MD5Sum' + then + pkg_name=$(echo "$filename" | cut -d'_' -f1) + pkg_version=$(echo "$filename" | cut -d'_' -f2) + pkg_version=$(urldecode $pkg_version) + patch_md5=$(apt-cache show $pkg_name=$pkg_version | grep MD5sum | head -n 1) + checksum=$(echo $patch_md5 | cut -d' ' -f2) + fi + echo "$(get_mirrors "$uri")" >> "$DLLIST" #echo " dir=$DLDIR" >> "$DLLIST" echo " checksum=md5=$checksum" >> "$DLLIST" - echo " out=$(basename $uri)" >> "$DLLIST" + echo " out=$filename" >> "$DLLIST" done + #cat "$DLLIST" #LCK_RM #exit diff -Nru apt-fast-1.8.3~121+gitaf73a17/apt-fast.conf apt-fast-1.8.3~137+git7b72bb7/apt-fast.conf --- apt-fast-1.8.3~121+gitaf73a17/apt-fast.conf 2015-03-12 22:30:01.000000000 +0000 +++ apt-fast-1.8.3~137+git7b72bb7/apt-fast.conf 2016-03-24 18:28:52.000000000 +0000 @@ -47,6 +47,34 @@ #_MAXNUM=5 +# Maximum number of connections per server +# Default: 10 +# +# _MAXCONPERSRV=10 + + +# Download file using given number of connections +# If more than N URIs are given, first N URIs are used and remaining URIs are used for backup. +# If less than N URIs are given, those URIs are used more than once so that N connections total are made simultaneously. +# +# _SPLITCON=8 + + +# Split size i.e. size of each piece +# Possible Values: 1M-1024M +# +# _MINSPLITSZ="1M" + + +# Piece selection algorithm to use +# Available values are: default, inorder, geom +# default: selects piece so that it reduces the number of establishing connection, reasonable for most cases +# inorder: selects pieces in sequential order starting from first piece +# geom: selects piece which has minimum index like inorder, but it exponentially increasingly keeps space from previously selected pieces +# +# _PIECEALGO="default" + + # Downloadmanager listfile # You can use this value in _DOWNLOADER command. Escape with ${}: ${DLLIST} # @@ -68,11 +96,11 @@ # # Examples: # aria2c with a proxy (set username, proxy, ip and password!) -# _DOWNLOADER='aria2c -c -j ${_MAXNUM} -x ${_MAXNUM} -s ${_MAXNUM} --min-split-size=1M --http-proxy=http://username:password@proxy_ip:proxy_port -i ${DLLIST}' +# _DOWNLOADER='aria2c -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} --http-proxy=http://username:password@proxy_ip:proxy_port -i ${DLLIST}' # -# Default: _DOWNLOADER='aria2c -c -j ${_MAXNUM} -x ${_MAXNUM} -s ${_MAXNUM} --min-split-size=1M -i ${DLLIST} --connect-timeout=600 --timeout=600 -m0' +# Default: _DOWNLOADER='aria2c -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} -i ${DLLIST} --connect-timeout=600 --timeout=600 -m0' # -#_DOWNLOADER='aria2c -c -j ${_MAXNUM} -x ${_MAXNUM} -s ${_MAXNUM} --min-split-size=1M -i ${DLLIST} --connect-timeout=600 --timeout=600 -m0' +#_DOWNLOADER='aria2c -c -j ${_MAXNUM} -x ${_MAXCONPERSRV} -s ${_SPLITCON} --min-split-size=${_MINSPLITSZ} --stream-piece-selector=${_PIECEALGO} -i ${DLLIST} --connect-timeout=600 --timeout=600 -m0' # Download temp folder for Downloadmanager diff -Nru apt-fast-1.8.3~121+gitaf73a17/completions/bash/apt-fast apt-fast-1.8.3~137+git7b72bb7/completions/bash/apt-fast --- apt-fast-1.8.3~121+gitaf73a17/completions/bash/apt-fast 2014-08-14 13:44:27.000000000 +0000 +++ apt-fast-1.8.3~137+git7b72bb7/completions/bash/apt-fast 2016-03-24 18:28:52.000000000 +0000 @@ -22,7 +22,7 @@ remove|autoremove|purge) if [ -f /etc/debian_version ]; then # Debian system - COMPREPLY=( $( _comp_dpkg_installed_packages $cur ) ) + COMPREPLY=( $( _xfunc dpkg _comp_dpkg_installed_packages "$cur" ) ) else # assume RPM based _rpm_installed_packages diff -Nru apt-fast-1.8.3~121+gitaf73a17/debian/changelog apt-fast-1.8.3~137+git7b72bb7/debian/changelog --- apt-fast-1.8.3~121+gitaf73a17/debian/changelog 2015-04-23 22:30:40.000000000 +0000 +++ apt-fast-1.8.3~137+git7b72bb7/debian/changelog 2016-03-24 19:13:51.000000000 +0000 @@ -1,3 +1,39 @@ +apt-fast (1.8.3~137+git7b72bb7-0ubuntu1~ppa3~trusty1) trusty; urgency=low + + * Fix overridden targets' name. + + -- Saikrishna Arcot Thu, 24 Mar 2016 14:12:57 -0500 + +apt-fast (1.8.3~137+git7b72bb7-0ubuntu1~ppa2~trusty1) trusty; urgency=low + + * Fix debian/rules to not use the makefile. + + -- Saikrishna Arcot Thu, 24 Mar 2016 13:54:59 -0500 + +apt-fast (1.8.3~137+git7b72bb7-0ubuntu1~ppa1~trusty1) trusty; urgency=low + + [ Davide Zipeto ] + * Fixing _comp_dpkg_installed_packages problem #51 + + [ techgaun ] + * Added various aria2c args as config - maximum number of connection per server - split connection - split size - piece selection algorithm + + [ Victor Arribas ] + * rewrite get_uris() to overcome SHA256 issue + * fix get_uris() bug introduced at #91 + + [ Peter Dave Hello ] + * add Makefile to help install + * Update Makefile + + [ Victor Arribas ] + * get_uris(): recover grep filtering + * md5 patch: package version must be decoded to use it + + [ Saikrishna Arcot ] + + -- Saikrishna Arcot Thu, 24 Mar 2016 14:28:55 -0400 + apt-fast (1.8.3~121+gitaf73a17-0ubuntu1~ppa1~trusty1) trusty; urgency=low [ Alan Hoffmeister ] diff -Nru apt-fast-1.8.3~121+gitaf73a17/debian/rules apt-fast-1.8.3~137+git7b72bb7/debian/rules --- apt-fast-1.8.3~121+gitaf73a17/debian/rules 2014-05-11 03:42:08.000000000 +0000 +++ apt-fast-1.8.3~137+git7b72bb7/debian/rules 2016-03-24 19:12:45.000000000 +0000 @@ -3,3 +3,9 @@ %: dh $@ --with bash-completion + +override_dh_auto_build: + # Nothing to build + +override_dh_auto_install: + # Nothing to install diff -Nru apt-fast-1.8.3~121+gitaf73a17/Makefile apt-fast-1.8.3~137+git7b72bb7/Makefile --- apt-fast-1.8.3~121+gitaf73a17/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ apt-fast-1.8.3~137+git7b72bb7/Makefile 2016-03-24 18:28:52.000000000 +0000 @@ -0,0 +1,29 @@ +.PHONY: install uninstall reinstall + +install: apt-fast completions/bash/apt-fast + apt-get install --force-yes -y -qq aria2 + cp apt-fast /usr/bin/ + cp apt-fast.conf /etc/ + mkdir -p /etc/bash_completion.d/ + mkdir -p /usr/share/zsh/functions/Completion/Debian/ + cp completions/bash/apt-fast /etc/bash_completion.d/ + cp completions/zsh/_apt-fast /usr/share/zsh/functions/Completion/Debian/ + chown root:root /etc/bash_completion.d/apt-fast + chown root:root /usr/share/zsh/functions/Completion/Debian/_apt-fast + cp man/apt-fast.8 /usr/share/man/man8/ + cp man/apt-fast.conf.5 /usr/share/man/man5/ + gzip -f9 /usr/share/man/man8/apt-fast.8 + gzip -f9 /usr/share/man/man5/apt-fast.conf.5 + chmod +x /usr/bin/apt-fast + +uninstall: /usr/bin/apt-fast + rm -rf /usr/bin/apt-fast /etc/apt-fast.conf \ + /usr/share/man/man5/apt-fast.conf.5.gz /usr/share/man/man8/apt-fast.8.gz \ + /usr/share/zsh/functions/Completion/Debian/_apt-fast /etc/bash_completion.d/apt-fast + @echo "Please manually remove deb package - aria2 if you don't need it anymore." + +/usr/bin/apt-fast: + @echo "Not installed" 1>&2 + @exit 1 + +reinstall: uninstall install