--- common/cvs-import.sh 2007/12/25 05:10:12 1.2 +++ common/cvs-import.sh 2008/11/25 16:20:10 1.7 @@ -5,7 +5,9 @@ # Copyright (C) 2004-2005 Red Hat, Inc. # Copyright (C) 2005 Fedora Foundation # -# $Id: cvs-import.sh,v 1.1 2007/11/08 18:10:19 slords Exp $ +# $Id: cvs-import.sh,v 1.5 2008/07/30 18:02:28 slords Exp $ + +shopt -s nocasematch # Initial setup CVSTREE=${CVSTREE:=extras} @@ -27,6 +29,8 @@ if test -w $(pwd) ; then WORKDIR="$(pwd)" fi +[ -f branch ] && BRANCH=$(cat branch) + # short usage help Usage() { cat <&2 +test -f CVS/Root && { cvs -Q -d \$\$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 endef MAKEFILE_COMMON := \$(shell \$(checkout-makefile-common)) @@ -173,6 +176,12 @@ cd $TOPLEVEL/$NAME # check if we have imported this entry TAG=$(echo "${NAME##[0-9]}-$VERSION-$RELEASE" | sed -e 's/[$,.:;@]/_/g') LOG_ENTRY="$TAG:${BRANCH:-HEAD}:$(basename $PACKAGE)" +if [ -n "$(grep ""^$LOG_ENTRY"" ./${BRANCH}/import.log 2>/dev/null)" ] ; then + echo "ERROR: $PACKAGE was already imported on branch ${BRANCH:-HEAD}" + CleanUp + exit -2 +fi +# Check here as well because back in the old days we used to write it here if [ -n "$(grep ""^$LOG_ENTRY"" ./import.log 2>/dev/null)" ] ; then echo "ERROR: $PACKAGE was already imported on branch ${BRANCH:-HEAD}" CleanUp @@ -200,6 +209,7 @@ FILES=$(rpm -qpl $PACKAGE 2>/dev/null) # Remove the files that are no longer present OLDFILES=$(find ${BRANCH} -maxdepth 1 -type f \ -not -name branch \ + -not -name import.log \ -not -name sources \ -not -name Makefile \ -not -name .cvsignore \ @@ -242,9 +252,9 @@ for _f in $FILES ; do pushd ${BRANCH} >/dev/null if [ "$add_file" = "yes" ] ; then case $f in - *.tar | *gz | *.bz2 | *.Z | *.zip | *.ZIP | \ - *.ttf | *.bin | *.tbz | *.pdf | *.rpm | \ - *.jar | *.war | *.db | *.cpio | *.jisp | *.egg ) + *.tar | *gz | *.bz2 | *.lzma | *.Z | *.zip | \ + *.ttf | *.bin | *.tbz | *.tbz2 | *.pdf | *.rpm | \ + *.jar | *.war | *.db | *.cpio | *.jisp | *.egg | *.gem ) UPLOADFILES="$UPLOADFILES $f" if [ -n "$(grep $f sources 2>/dev/null)" ] ; then # this file existed before with a different md5sum @@ -282,7 +292,8 @@ popd >/dev/null rm -rf $TMP2 # setup finished -echo "$LOG_ENTRY:$(date +%s)" >> ./import.log +[ -f ./${BRANCH}/import.log ] || $(touch ./${BRANCH}/import.log; cvs add ./${BRANCH}/import.log) +echo "$LOG_ENTRY:$(date +%s)" >> ./${BRANCH}/import.log echo "=======================================================================" cvs -Q diff -u @@ -290,11 +301,12 @@ echo "================================== echo "Please check the above cvs diff." echo "If you want to make any changes before committing, please press Ctrl-C." echo "Otherwise press Enter to proceed to commit." -#read +read cvs -Q update && \ echo "cvs commit..." && \ - cvs -Q commit ${MESSAGE:+-m "$MESSAGE"} && echo "Commit Complete" + cvs -Q commit ${MESSAGE:+-m "$MESSAGE"} && echo "Commit Complete" && \ + cd ${BRANCH} && make tag && echo "Tagging '${TAG}' complete." # Clean up CleanUp