From a998b5fd1c77d342bebbc942b56a0b3d4f612723 Mon Sep 17 00:00:00 2001 From: "R. Steve McKown" Date: Thu, 9 Apr 2009 03:51:13 +0000 Subject: [PATCH] Added some new features to slice up the import from remote CVS via local CVS a couple of different ways. But the real change was preventing rsync from modifying the permissions of incoming files. This fixed the problem where our local git derived via --localcvs had different commit hashes that the remote git repo at http://hinrg.cs.jhu.edu/git/. Now, as long as enough memory is present, the local git and remote git have exactly the same contents and same commit hashes. --- tinyos-mirror.sh | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/tinyos-mirror.sh b/tinyos-mirror.sh index 1f75bdc..d0f6604 100755 --- a/tinyos-mirror.sh +++ b/tinyos-mirror.sh @@ -34,7 +34,7 @@ # # Usage: # -# tinyos-mirror.sh [--cvslocal|--cvsdirect|--localonly] [module [module ...]] +# tinyos-mirror.sh [--cvslocal|--cvsdirect|--localonly|--rsynconly] [module [module ...]] # No --xxx option implies update from upstream git. # No module(s) implies update of all as defined in $MODULES. # @@ -44,6 +44,8 @@ # 2. To create or update the local git repos from the upstream CVS source, # which may be more definitive but much slower, run tinyos-mirror.sh with # the --cvslocal option. +# --rsynconly does only the rsync update of the remote CVS to local CVS. +# --localonly does everything of --cvslocal except the rsync. # # 3. To update (not create!) the local git repos from the upstream CVS source # directly via pserver (see the UPCVSROOT variable), then run the @@ -51,12 +53,6 @@ # perhaps faster than option #2 above if relatively few changesets have # been added upstream since the last invocation of tinyos-mirror.sh. # -# 4. If you just wish to update the final git repositories with the interim -# git repositories created by --cvslocal, then give --localonly. You can -# do a full recreate of the final git repo this way by first removing it, -# from /var/lib/git/.git. --localonly only updates the final git -# module to the state of the /var/lib/git/cvsimports/-import repo. -# # It should be possible to invoke tinyos-mirror.sh using different update # methods without creating problems. We have tested creating and initially # populating the local git repos using --cvslocal and then following with @@ -104,7 +100,8 @@ do_rsync() fi echo "Rsync from sourceforge -> $CVSBASE/tinyos" echo " links: $links" - rsync -avz --delete --no-p --no-g --chmod=Dg+s,Du+w,Fu+w $links \ + rsync -avz --delete --no-g --chmod=Dg+s,Du+w $links \ + --exclude "CVSROOT/CVS" \ $UPCVSRSYNC $CVSBASE/tinyos/ if [ $? -ne 0 ]; then echo "rsync failed" @@ -136,6 +133,7 @@ do_bare() echo "git init failed" exit 1 fi + echo "Mirror of the $i CVS module" > $i.git/description # This line allows us to do cvsimport directly into this git repo, # as git-cvsimport doesn't know how to work with bare repos. @@ -159,12 +157,14 @@ do_import() cd $GITBASE/cvsimports for i in $MODULES; do echo "Import cvs module $i -> git" - git cvsimport -v -o master -d $CVSBASE/tinyos -C $i-import -i -k \ - -L2000 $i + git cvsimport -v -o master -d $CVSBASE/tinyos -C $i-import -i -k $i if [ $? -ne 0 ]; then echo "cvsimport failed" exit 1 fi + if [ ! -f $i-import/.git/description ]; then + echo "Mirror of the $i CVS module" > $i.git/description + fi done } @@ -202,12 +202,10 @@ do_import_cvsdirect() done } -do_import_cvslocal() +do_import_localonly() { - # Do the imports by first using rsync to sync a local CVS from sf.net, - # then do cvs-gitimports from the local CVS. + # Do the cvs-gitimports from the local CVS. - do_rsync if locks_present; then echo "Locks present in the CVS upstream. We won't import this time." else @@ -217,6 +215,15 @@ do_import_cvslocal() fi } +do_import_cvslocal() +{ + # Do the imports by first using rsync to sync a local CVS from sf.net, + # then do cvs-gitimports from the local CVS. + + do_rsync + do_import_localonly +} + do_import_git() { # Update from the git repos at hinrg. As of 4/8/09, only the tinyos-2.x @@ -241,7 +248,7 @@ do_import_git() ln -s ../$i.git $i.git/.git else echo "Pull gitupstream -> $i.git" - git --git-dir=$i.git fetch $UPGITBASE/$i.git + git --git-dir=$i.git fetch $UPGITBASE/$i.git master:master if [ $? -ne 0 ]; then echo "git fetch failed" fail=$(($fail + 1)) @@ -260,7 +267,7 @@ unset option unset opt_modules while [ -n "$1" ]; do if echo "$1" | grep -q -- "--"; then - if [ "$1" = "--cvslocal" -o "$1" = "--cvsdirect" ]; then + if [ "$1" = "--cvslocal" -o "$1" = "--cvsdirect" -o "$1" = "--localonly" -o "$1" = "--rsynconly" ]; then if [ -z "$option" ]; then option=$1 fi @@ -283,7 +290,9 @@ if [ "$option" = "--cvsdirect" ]; then elif [ "$option" = "--cvslocal" ]; then do_import_cvslocal elif [ "$option" = "--localonly" ]; then - do_push + do_import_localonly +elif [ "$option" = "--rsynconly" ]; then + do_rsync else do_import_git fi -- 2.39.2