common cvs-import.sh,1.15,1.16

Jens Petersen (petersen) fedora-extras-commits at redhat.com
Mon Apr 2 04:58:18 UTC 2007


Author: petersen

Update of /cvs/extras/common
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv26712

Modified Files:
	cvs-import.sh 
Log Message:
Synopsis: package modules are no longer created by cvs-import.sh
so the purpose of this update is to remove manipulation of the modules file.
We also add an onscreen cvs diff for imports and make importers write
a cvs changelog entry.  At the same time we take the opportunity to
clean away unnecessary checking of the modules file to speed up imports.

- remove modules file checkout and checking
- drop creation of new Makefile and empty .cvsignore and sources
- abort if cvs module cannot be checked out
- abort if requested branch does not exist
- output cvs diff and prompt before committing
- if no commit message given get one from user




Index: cvs-import.sh
===================================================================
RCS file: /cvs/extras/common/cvs-import.sh,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- cvs-import.sh	7 Feb 2007 05:03:48 -0000	1.15
+++ cvs-import.sh	2 Apr 2007 04:57:48 -0000	1.16
@@ -128,15 +128,6 @@
 TMPDIR=$(mktemp -d $WORKDIR/tmpcvsXXXXXX)
 trap "rm -rf $TMPDIR" 0 9 15
 
-echo "Checking out the modules file..."
-cd $TMPDIR
-$CVS -Q checkout modules || {
-    echo "ERROR: Could not check out the CVSROOT from $CSVROOT"
-    exit 1
-}
-# keep a reference to this checkout
-MODDIR="$TMPDIR/modules"
-
 # A cleanup function that can be called from random places
 CleanUp() {
     if [ -n "$LOGFILE" ] ; then
@@ -147,26 +138,6 @@
     echo
 }
 
-# First, make sure we track this package accordingly
-cd $MODDIR
-cvs -Q update modules
-
-# Now make sure we have the requested to operate on a branch
-if [ -n "$BRANCH" ] ; then
-    # check that this branch exists before importing anything into it
-    if [ -z "$(grep ""^$NAME-$BRANCH[[:space:]]"" modules 2>/dev/null)" ] ; then
-	# XXX: allow the creation of branches
-	cat <<EOF
-ERROR: You have requested to import a package into the branch $BRANCH of the
-module $NAME, but according to the modules file this branch does not exist.
-
-This tool allows you to import packages only on pre-existing branches. If you
-would like the new branch created, please email sysadmin-devel at redhat.com.
-EOF
-	exit -1
-    fi
-fi
-
 CreateBranchMakefile() {
     cat >Makefile <<EOF
 # Makefile for source rpm: $NAME
@@ -193,63 +164,16 @@
 EOF
 }
 
-# Figure out if we need to import a new module
-if [ -z "$(grep ""^$NAME[[:space:]]"" modules 2>/dev/null)" ] ; then
-    # This is a new module, it does not exist
-    cvs -Q update modules && \
-	echo "Creating new module: $NAME" && \
-	echo -e "$NAME\t\t$TOPLEVEL/$NAME &common" >> modules && \
-	cvs -Q commit -m "Added new module: $NAME" >/dev/null && \
-	{
-	    # Create a new module
-	    pushd $TMPDIR >/dev/null
-	    $CVS -Q checkout -l $TOPLEVEL
-	    cd $TOPLEVEL >/dev/null
-	    mkdir -p $NAME/devel && \
-		cvs -Q add $NAME $NAME/devel
-	    # handle the top level stuff
-	    cd $NAME
-	    touch import.log
-	    cat >Makefile <<EOF
-# Top level Makefile for module $NAME
-all : CVS/Root common-update
-	@cvs update
-
-common-update : common
-	@cd common && cvs update
-
-common : CVS/Root
-	@cvs checkout common
-
-CVS/Root :
-	@echo "ERROR: This does not look like a CVS checkout" && exit 1
-
-clean :
-	@find . -type f -name *~ -exec rm -fv {} \;
-EOF
-	    cvs -Q add Makefile import.log
-	    # handle the module build
-	    cd devel
-	    touch sources .cvsignore
-	    CreateBranchMakefile
-	    cvs -Q add Makefile sources .cvsignore
-            # commit all the added stuff
-	    cd .. && cvs -Q commit -m "Setup of module $NAME" >/dev/null
-	    popd >/dev/null
-	    rm -rf $TMPDIR/$TOPLEVEL
-	} && echo "Entry for module '$NAME' created."
-else
-    echo "Module '$NAME' already exists..."
-fi
-
 # Check out the existing module
 cd $TMPDIR
 echo "Checking out module: '$NAME'"
-$CVS -Q checkout $NAME
+$CVS -Q checkout $NAME || echo "\"$NAME\" module does not exist in cvs" && exit 1
 
 # this is our working directory
 cd $NAME
 
+[ -d ${BRANCH} ] || echo "\"$NAME/$BRANCH\" does not exist!" && exit 1
+
 # 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)"
@@ -364,15 +288,17 @@
 # setup finished
 echo "$LOG_ENTRY:$(date +%s)" >> ./import.log
 
-# prepare the commit message
-MESSAGE=$(cat <<EOF
-auto-import $NAME-$VERSION-$RELEASE ${BRANCH:+on branch $BRANCH} from $(basename $PACKAGE)
-$MESSAGE
-EOF
-)
+echo "======================================================================="
+cvs -Q diff
+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
+
 cvs -Q update && \
     echo "cvs commit..." && \
-    cvs -Q commit -m "$MESSAGE" >/dev/null && echo "Commit Complete" && \
+    cvs -Q commit ${MESSAGE:+-m "$MESSAGE"} && echo "Commit Complete" && \
     cd ${BRANCH} && cvs -Q tag "${TAG}" && echo "Tagging '${TAG}' complete."
 
 # Clean up




More information about the scm-commits mailing list