#
# 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.
#
# 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
# 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/<module>.git. --localonly only updates the final git
-# module to the state of the /var/lib/git/cvsimports/<module>-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
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"
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.
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
}
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
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
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))
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
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