68 lines
1.4 KiB
Bash
Executable file
68 lines
1.4 KiB
Bash
Executable file
#!/bin/sh
|
|
set -o nounset
|
|
set -o errexit
|
|
|
|
FORGEURL='https://github.com/wtclarke/pymapvbvd'
|
|
|
|
print_help()
|
|
{
|
|
cat <<EOF
|
|
Usage: $1 VERSION
|
|
|
|
Generate a source archive containing the test data files for pyMapVBVD that are
|
|
tracked in git LFS and are not included in the default source archive. The
|
|
result will be named pyMapVBVD-\${VERSION}-test-data.tar.xz and will be written
|
|
into the current working directory.
|
|
EOF
|
|
}
|
|
|
|
if [ "$#" != '1' ]
|
|
then
|
|
exec 1>&2
|
|
print_help "${0}"
|
|
exit 1
|
|
elif [ "${1-}" = '-h' ] || [ "${1-}" = '--help' ]
|
|
then
|
|
print_help "${0}"
|
|
exit 0
|
|
fi
|
|
|
|
if ! git lfs help >/dev/null 2>/dev/null
|
|
then
|
|
exec 1>&2
|
|
echo 'Please install the git-lfs package to use this script.'
|
|
exit 1
|
|
fi
|
|
|
|
VERSION="${1}"
|
|
TAG="${VERSION}"
|
|
GITDIR="$(echo "${FORGEURL}" | sed -r 's@.*/@@')"
|
|
|
|
#SOURCE0="${FORGEURL}/archive/${VERSION}/pdfminer.six-${VERSION}.tar.gz"
|
|
#TARNAME="$(basename "${SOURCE0}")"
|
|
TARDIR="pyMapVBVD-${VERSION}"
|
|
NEWTAR="${TARDIR}-test-data.tar.xz"
|
|
|
|
SAVEDIR="${PWD}"
|
|
XDIR="$(mktemp -d)"
|
|
trap "rm -rvf '${XDIR}'" INT TERM EXIT
|
|
|
|
cd "${XDIR}"
|
|
git clone "${FORGEURL}" "${GITDIR}"
|
|
cd "${GITDIR}"
|
|
git checkout "${TAG}"
|
|
git lfs pull
|
|
ls -lh tests/test_data
|
|
git lfs ls-files -n |
|
|
while read -r fn
|
|
do
|
|
DESTDIR="${XDIR}/${TARDIR}/$(dirname "${fn}")"
|
|
mkdir -p "${DESTDIR}"
|
|
ln "${fn}" "${DESTDIR}/$(basename "${fn}")"
|
|
done
|
|
|
|
cd "${XDIR}"
|
|
tar -cv "${TARDIR}/" | xz -9e > "${NEWTAR}"
|
|
|
|
cd "${SAVEDIR}"
|
|
mv -v "${XDIR}/${NEWTAR}" .
|