diff options
author | Timo Teräs <timo.teras@iki.fi> | 2016-07-08 13:44:31 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2016-07-08 13:44:31 +0300 |
commit | 90899669c2da9cce4b54851c45fb482e6950a876 (patch) | |
tree | c279c5a7a208f13f8a9bb8b90d76d56467cf55ef | |
parent | 580dd46c588ef71bc852d2b9a5bb4426a2c47665 (diff) | |
download | abuild-90899669c2da9cce4b54851c45fb482e6950a876.tar.bz2 abuild-90899669c2da9cce4b54851c45fb482e6950a876.tar.xz |
abuild: rename distfile copy when checksum does not match
The previous deletion of file did not work properly at all. Fix
this instead to rename the file, so we keep the previous download.
This allows builders to redownload upstream file if the checksum
has been changed in aports.
-rw-r--r-- | abuild.in | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -247,11 +247,14 @@ sumcheck() { if [ $? -ne 0 ]; then endreturnval=1 is_remote $origin || continue - echo "Because the remote file above failed the ${algo}sum check it will be deleted." + + local csum="${src:0:8}" + local file="$SRCDEST/$(filename_from_uri $origin)" + + echo "Because the remote file above failed the ${algo}sum check it will be renamed." echo "Rebuilding will cause it to re-download which in some cases may fix the problem." - file=`echo "$src" | sed 's/.*[ \t\n]\(.*\)/\1/'` - echo "Deleting: $file" - rm $file + echo "Renaming: ${file##*/} to ${file##*/}.$csum" + mv "$file" "$file.$csum" fi done unset IFS |