]> oss.titaniummirror.com Git - tinyos-utils.git/commitdiff
Remove cvsimports git repos. Make verbose output an option. Add additional
authorR. Steve McKown <rsmckown@gmail.com>
Thu, 9 Apr 2009 23:55:38 +0000 (23:55 +0000)
committerR. Steve McKown <rsmckown@gmail.com>
Thu, 9 Apr 2009 23:55:38 +0000 (23:55 +0000)
output, such as pointing out when tasks are complete.

tinyos-mirror.sh

index 9c4f5c184ff0b7cc46bb92082782e23248c22db2..9cca17476cb4d4b4774f8013b7bfa6a85c0621b7 100755 (executable)
@@ -73,6 +73,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 +115,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 +139,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 +162,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 +186,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 +202,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 +223,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 +265,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 +305,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 +320,5 @@ else
     exit 1
     do_import_git
 fi
+echo "Import actions complete."
 exit 0