freebsd-ports/Tools/portbuild/scripts/cpdistfiles
Kris Kennaway 5918a825ad Add an option to clean up old distfiles. We don't have enough space to
keep dozens of full distfile sets lying around.
2008-08-08 16:19:38 +00:00

49 lines
1 KiB
Bash
Executable file

#!/bin/sh
if [ $# -lt 3 ]; then
echo "usage: $0 arch branch buildid"
exit 1
fi
# configurable variables
pb=/var/portbuild
arch=$1
branch=$2
buildid=$3
builddir=${pb}/${arch}/${branch}/builds/${buildid}
yesreally=0
dryrun=-n
cleanup=0
if [ "$4" = "-yesreally" ]; then
yesreally=1
dryrun=
elif [ "$4" = "-cleanup" ]; then
cleanup=1
fi
distdir=${builddir}/distfiles/
log=${builddir}/logs/.distfiles
if [ "${cleanup}" -eq 1 ]; then
echo "Removing distfiles"
rm -rf ${distdir} || exit 1
exit 0
fi
if [ -e ${distdir}/.pbtmp ]; then
echo "${distdir} has not been processed!"
exit 1
fi
rsync ${dryrun} -r -v -l -t --exclude RESTRICTED/ ${builddir}/distfiles/ portmgr@ftp-master:w/ports/distfiles/ | tee ${log}
num=$(wc -l ${log} | awk '{print $1}')
if [ "$yesreally" = "0" ]; then
echo "--> Will transfer ${num} files - make sure this is what you want and rerun '$0 $* -yesreally'"
else
echo "--> Transferred ${num} files - results in ${log}"
echo " Now run '$0 $1 $2 $3 -cleanup' to remove distfiles and save space"
fi