Ports: Do not download sources if they're already present

When running ./package.sh to rebuild an already installed port, we would not
want to spend time re-downlodaing the same tarball again. Ideally, this should
use some sort of hash checking to ensure the file is not truncated or something,
but this is good enough for now.
This commit is contained in:
Sergey Bugaev 2019-12-23 15:24:56 +03:00 committed by Andreas Kling
commit ccfc9d8923
Notes: sideshowbarker 2024-07-19 10:45:30 +09:00
2 changed files with 12 additions and 4 deletions

View file

@ -42,7 +42,11 @@ func_defined fetch || fetch() {
for f in $files; do for f in $files; do
IFS=$OLDIFS IFS=$OLDIFS
read url filename <<< $(echo "$f") read url filename <<< $(echo "$f")
run_nocd curl ${curlopts:-} "$url" -o "$filename" if [ -f "$filename" ]; then
echo "$filename already exists"
else
run_nocd curl ${curlopts:-} "$url" -o "$filename"
fi
case "$filename" in case "$filename" in
*.tar*|.tbz*|*.txz|*.tgz) *.tar*|.tbz*|*.txz|*.tgz)
run_nocd tar xf "$filename" run_nocd tar xf "$filename"
@ -57,7 +61,7 @@ func_defined fetch || fetch() {
echo "Note: no case for file $filename." echo "Note: no case for file $filename."
;; ;;
esac esac
done done
if [ -d patches ]; then if [ -d patches ]; then
for f in patches/*; do for f in patches/*; do
run patch -p"$patchlevel" < "$f" run patch -p"$patchlevel" < "$f"

View file

@ -9,8 +9,12 @@ installopts="DESTDIR=$SERENITY_ROOT/Root install-gcc install-target-libgcc insta
depends="binutils" depends="binutils"
fetch() { fetch() {
read url filename <<< $(echo "$files") read url filename <<< $(echo "$files")
run_nocd curl -O "$url" -o "$filename" if [ -f "$filename" ]; then
echo "$filename already exists"
else
run_nocd curl -O "$url" -o "$filename"
fi
run_nocd tar xf "$filename" run_nocd tar xf "$filename"
run contrib/download_prerequisites run contrib/download_prerequisites
for f in patches/*; do for f in patches/*; do