X-Git-Url: https://oss.titaniummirror.com/gitweb?a=blobdiff_plain;f=tinyos-mirror.sh;h=d459503af2742b51b4941e5bc803e14acd590e72;hb=HEAD;hp=9c4f5c184ff0b7cc46bb92082782e23248c22db2;hpb=df2b12e48c822c866fb85cabe22bd226504532f5;p=tinyos-utils.git diff --git a/tinyos-mirror.sh b/tinyos-mirror.sh index 9c4f5c1..d459503 100755 --- a/tinyos-mirror.sh +++ b/tinyos-mirror.sh @@ -1,10 +1,16 @@ #!/bin/bash # tinyos-mirror.sh - Maintain a local git mirror of the tinyos CVS repository. # +# ------ +# NOTE: On or shortly after 2010-07-12, the official TinyOS repository was +# migrated from CVS to Subversion, at http://tinyos-main.googlecode.com/svn. +# As of this writing, tinyos-2.x-contrib remains hosted on CVS at sf.net. +# ------ +# # This utility allows updating a local mirror of the TinyOS CVS modules as # a set of three git repositories, one per notable CVS module: # # (don't need) tinyos-1.x -> tinyos-1.x.git -# tinyos-2.x -> tinyos-2.x.git +# # (deprecated) tinyos-2.x -> tinyos-2.x.git # tinyos-2.x-contrib -> tinyos-2.x-contrib.git # # The utility actually allows both for creation and update of the local @@ -64,7 +70,7 @@ # Ensure these variables are correct for your installation -MODULES="tinyos-2.x tinyos-2.x-contrib" +MODULES="tinyos-2.x-contrib" GITBASE=/var/lib/git UPGITBASE=git://hinrg.cs.hju.edu/git CVSBASE=/var/lib/cvs @@ -73,6 +79,9 @@ CVSROOT=$CVSBASE/$CVSREPO UPCVSROOT=:pserver:anonymous@tinyos.cvs.sourceforge.net:/cvsroot/tinyos UPCVSRSYNC=rsync://tinyos.cvs.sourceforge.net/cvsroot/tinyos +# Uncomment this or export DEBUG=-v in your shell to get verbose output +#DEBUG=-v + # There should be no need to change anything below this line do_backups() @@ -112,7 +121,8 @@ do_rsync() filters="$filters --include '/$i' --include '/$i/**'" done filters="$filters --exclude '/**'" - eval rsync -avz --delete --no-g --chmod=Dg+s,Du+w $links $filters $UPCVSRSYNC/ $CVSROOT + eval rsync -az $DEBUG --delete --no-g --chmod=Dg+s,Du+w $links $filters \ + $UPCVSRSYNC/ $CVSROOT if [ $? -ne 0 ]; then echo "rsync failed" exit 1 @@ -135,8 +145,8 @@ do_bare() 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. + # git-cvsimport doesn't know how to work with bare repos, so + # create in each repo a .git that is a symlink to itself. ln -s ../$i.git $i.git/.git fi done @@ -158,43 +168,18 @@ do_import() # Now, do the imports. We limit the number of commits to prevent memory # leaks from taking out the VE. This command is incremental, just adding # new commits since the last run. - if [ ! -d $GITBASE/cvsimports ]; then - rm -rf $GITBASE/cvsimports - mkdir $GITBASE/cvsimports - chgrp repo $GITBASE/cvsimports - chmod 755 $GITBASE/cvsimports - chmod g+s $GITBASE/cvsimports - fi - cd $GITBASE/cvsimports + cd $GITBASE for i in $MODULES; do if locks_present $i; then echo "SKIP cvs module $i; locks present in the CVS repo." else echo "Import cvs module $i -> git" - git cvsimport -v -o master -d $CVSROOT -C $i-import -i -k \ + git cvsimport $DEBUG -o master -d $CVSROOT -C $i.git -i -k \ -L2000 $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-import/.git/description - fi - fi - done -} - -do_push() -{ - # Now we need to push the new commits in each of the import repos into the - # bare repos which are the pseudo-centralized shared repos. - cd $GITBASE/cvsimports - for i in $MODULES; do - echo "Push git import module cvsimports/$i-import -> $i.git" - git --git-dir=$i-import/.git push --mirror ../$i.git/ - if [ $? -ne 0 ]; then - echo "git push failed" - exit 1 fi done } @@ -207,10 +192,11 @@ do_import_cvsdirect() # memory leaks from taking out the VE. This command is incremental, just # adding new commits since the last run. + echo "Importing directly from remote CVS repository" cd $GITBASE for i in $MODULES; do echo "Update from CVS module DIRECT $i -> git" - git cvsimport -v -o master -d $UPCVSROOT -C $i.git -i -k -L2000 $i + git cvsimport $DEBUG -o master -d $UPCVSROOT -C $i.git -i -k -L2000 $i if [ $? -ne 0 ]; then echo "cvsimport failed" exit 1 @@ -222,9 +208,9 @@ do_import_localonly() { # Do the cvs-gitimports from the local CVS. + echo "Importing from local copy of remote CVS repository" do_bare do_import - do_push } do_import_cvslocal() @@ -243,6 +229,7 @@ do_import_git() # tinyos-1.x is 14 months old when the last update was 3/17/09, and # tinyos-2.x-contrib.git is 5 months old when the last update was 4/7/09. + echo "Importing from remote git repositories" fail=0 cd $GITBASE for i in $MODULES; do @@ -284,10 +271,6 @@ env_ok() echo "$GITBASE must have permissions drwxr-sr-x" >&2 ret=1 fi - if [ ! -d "$GITBASE/cvsimports" ]; then - echo "$GITBASE/cvsimports is not a directory" >&2 - ret=1 - fi fi if [ ! -d "$CVSBASE" ]; then echo "$CVSBASE is not a directory" >&2 @@ -328,7 +311,7 @@ done if [ -n "$opt_modules" ]; then MODULES="$opt_modules" fi -echo "Updating modules $MODULES" +echo "Updating modules: $MODULES" if [ "$option" = "--cvsdirect" ]; then do_import_cvsdirect @@ -343,4 +326,5 @@ else exit 1 do_import_git fi +echo "Import actions complete." exit 0