[csw-devel] SF.net SVN: opencsw:[321] gar-wrapper/mgar
skayser at users.sourceforge.net
skayser at users.sourceforge.net
Tue Feb 22 18:42:44 CET 2011
Revision: 321
http://opencsw.svn.sourceforge.net/opencsw/?rev=321&view=rev
Author: skayser
Date: 2011-02-22 17:42:44 +0000 (Tue, 22 Feb 2011)
Log Message:
-----------
mgar: add (advanced and undocumented) up --self option
Modified Paths:
--------------
gar-wrapper/mgar
Modified: gar-wrapper/mgar
===================================================================
--- gar-wrapper/mgar 2011-02-22 09:43:11 UTC (rev 320)
+++ gar-wrapper/mgar 2011-02-22 17:42:44 UTC (rev 321)
@@ -15,8 +15,10 @@
# ----------------------------------------------------------------------------
#
# Todos:
+# * When packaging mgar, shield mgar up --self so that it won't override
+# the package binary, but place it somewhere else.
+# * In commit mode, if (msg -eq ""): Fire up $EDITOR (with prepoulated msg)
# * In commit mode, if (pwd.endswith('trunk') and svn.rev -eq 0) commit ..
-# * Add command to update mgar itself
# * Recipes: Move from svn:externals to GARTYPE
# * Integrate the creation of a new package (with sanity check whether
# package already exists). Use per-directory Makefile.template files.
@@ -44,6 +46,8 @@
EDITOR=${EDITOR:-vi}
PATH=$PATH:/opt/csw/bin
DEF_BUILDTREE=~/opencsw
+
+SVN_SELF=https://opencsw.svn.sourceforge.net/svnroot/opencsw/gar-wrapper/mgar
GAR_REPO=https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/gar/
PKG_REPO=https://gar.svn.sourceforge.net/svnroot/gar/csw/mgar/pkg/
@@ -65,6 +69,37 @@
done
}
+function update_self {
+ __rev=${1:-HEAD}
+
+ [ -f $0.tmp ] && rm $0.tmp
+ svn export -r $__rev $SVN_SELF $0.tmp >/dev/null
+
+ if [ $? -ne 0 ]; then
+ echo "Error: Retrieval from SVN failed. Script untouched." >&2
+ exit 1;
+ fi
+
+ oldv=`grep '# $Id' $0 | head -1`
+ newv=`grep '# $Id' $0.tmp | head -1`
+
+ if [ "$oldv" == "$newv" ]; then
+ echo "Script is already at the desired version. No replacement needed."
+ echo "Current version: $oldv"
+ rm $0.tmp
+ exit;
+ fi
+
+ mv $0.tmp $0
+
+ cat <<EOM
+Script replaced.
+
+Old version: $oldv
+New version: $newv
+EOM
+}
+
function read_config_value {
__param=$1
[ -f ~/.garrc ] || die_config_missing
@@ -330,9 +365,11 @@
commit|ci) shift; verify_local_status_and_commit "$@";;
scm) shift; svn $@;;
up) if [ "${2:-}" == "--all" ]; then
- $0 up-all;
+ $0 up-all
+ elif [ "${2:-}" == "--self" ]; then
+ update_self ${3:-}
else
- $0 up-pkg;
+ $0 up-pkg
fi
;;
up-all) echo "Updating full build tree (this will take some time)"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the devel
mailing list