diff options
-rwxr-xr-x | Tools/portbuild/scripts/cpdistfiles | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/Tools/portbuild/scripts/cpdistfiles b/Tools/portbuild/scripts/cpdistfiles index bb2c1361c79d..6dbfa2773f29 100755 --- a/Tools/portbuild/scripts/cpdistfiles +++ b/Tools/portbuild/scripts/cpdistfiles @@ -1,39 +1,36 @@ #!/bin/sh -if [ $# != 1 ]; then - echo "usage: $0 branch" +if [ $# -lt 2 ]; then + echo "usage: $0 arch branch" exit 1 fi # configurable variables pb=/var/portbuild -. ${pb}/portbuild.conf +arch=$1 +branch=$2 -unset DISPLAY - -branch=$1 -shift - -# copy one distfile to remote host -cpdistfile () { - tar -C distfiles -cf - $1 | ssh $ftpsite -l $user tar -C $distfiledir --unlink -xvf - -} - -echo "================================================" -echo "md5 generation started at $(date)" +yesreally=0 +dryrun=-n +if [ "$3" = "-yesreally" ]; then + yesreally=1 + dryrun= +fi -cd $pb/${branch}/bak/distfiles -find . -type f | sort | xargs md5 > ../../md5-2 +distdir=${pb}/${arch}/${branch}/distfiles/ +log=${pb}/${arch}/${branch}/logs/.distfiles -echo "================================================" -echo "copying started at $(date)" +if [ -e ${distdir}/.pbtmp ]; then + echo "${distdir} has not been processed!" + exit 1 +fi -cd $pb/${branch}/bak -for i in $(diff ../md5 ../md5-2 | grep '^>' | sed -e 's^.*(\./^^' -e 's/).*//'); do - cpdistfile $i -done -mv ../md5-2 ../md5 +rsync ${dryrun} -r -v -l -t --exclude RESTRICTED/ ${pb}/${arch}/${branch}/distfiles/ portmgr@ftp-master:w/ports/distfiles/ | tee ${log} -echo "================================================" -echo "all done at $(date)" +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}" +fi |