btrfs-progs: ci: check for local copy of branch tar before downloading

The ci/test-build script unconditionally downloads the latest devel
snapshot. This is not practical for local development. Add a conditional
check for a file named devel.tar.gz, either it's missing or empty, then
download.

The empty file is also considered because this allows to use a docker
image that does not support conditional contents, so a stub file is a
fallback.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-02-24 16:16:08 +01:00
parent 405e36d53c
commit a7043efdf7
1 changed files with 12 additions and 5 deletions

View File

@ -1,15 +1,22 @@
#!/bin/sh
# usage: $0 [branch name] [configure parameters]
urlbase="https://github.com/kdave/btrfs-progs/archive/"
urlbase="https://github.com/kdave/btrfs-progs/archive"
branch=${1:-devel}
url=${urlbase}${branch}.tar.gz
fname=${branch}.tar.gz
url="${urlbase}/${fname}"
shift
echo "btrfs-progs build test of branch ${branch}"
cd /tmp
wget "$url" -O ${branch}.tar.gz
tar xf ${branch}.tar.gz
cd btrfs-progs-${branch}
if [ -f "$fname" -a -s "$fname" ]; then
echo "Found local file $fname, not downloading"
else
echo "Missing or empty tar, downloading devel branch from git"
rm -- "$fname"
wget "$url" -O "$fname"
fi
tar xf "$fname"
cd btrfs-progs-$branch
ci/build-default "$@"