[csw-devel] SF.net SVN: gar:[10373] csw/mgar/pkg/cswutils/trunk/files/createpkg

theferret at users.sourceforge.net theferret at users.sourceforge.net
Mon Jun 28 19:51:23 CEST 2010


Revision: 10373
          http://gar.svn.sourceforge.net/gar/?rev=10373&view=rev
Author:   theferret
Date:     2010-06-28 17:51:23 +0000 (Mon, 28 Jun 2010)

Log Message:
-----------
cswutils:createpkg - Added auto-date-expantion and BASEDIR flexibility

Modified Paths:
--------------
    csw/mgar/pkg/cswutils/trunk/files/createpkg

Modified: csw/mgar/pkg/cswutils/trunk/files/createpkg
===================================================================
--- csw/mgar/pkg/cswutils/trunk/files/createpkg	2010-06-28 17:28:57 UTC (rev 10372)
+++ csw/mgar/pkg/cswutils/trunk/files/createpkg	2010-06-28 17:51:23 UTC (rev 10373)
@@ -23,12 +23,17 @@
 fi
 
 #This is only relevant for a relative-path package
-INSTALLBASEDIR=/opt/csw
+SRCBASEDIR=/opt/csw
 if [[ "$1" = "-b" ]] ; then
-	INSTALLBASEDIR="$2"
+	SRCBASEDIR="$2"
 	mode=relative
 	shift
 	shift
+	BASEDIR=`sed -n 's/^BASEDIR=//p' pkginfo`
+	if [[ "$BASEDIR" = "" ]] ; then
+		echo Note: no BASEDIR in pkginfo. Defaulting to /opt/csw
+		BASEDIR=/opt/csw
+	fi
 fi
 
 if [[ $# -ne 0 ]] ; then
@@ -84,9 +89,17 @@
 fi
 
 PKG=`sed -n 's/^PKG=//p' pkginfo`
-PKGREV=`sed -n 's/^VERSION=//p' pkginfo`
+VERSIONVAR=`grep '^VERSION=' pkginfo`
+case $VERSIONVAR in
+	*YYYY.MM.DD*)
+		datestring=`date '+%Y.%m.%d'`
+		VERSIONVAR=`echo $VERSIONVAR|sed "s/YYYY.MM.DD/$datestring/"`
+		;;
+esac
+PKGREV=`echo $VERSIONVAR|sed -n 's/^VERSION=//p'`
 SOFTNAME=`sed -n 's/^NAME=//p' pkginfo|awk '{print $1}'`
 
+
 isLower(){
 	typeset -l LOWER=$1
 	[ "$LOWER" = "$1" ]
@@ -105,9 +118,9 @@
 fi
 
 if [[ "$mode" = "absolute" ]] ; then
-	pkgmk -r $ROOTDIR -a $ARCH -f $PROTO "$@"
+	pkgmk -r $ROOTDIR -a $ARCH -f $PROTO "$VERSIONVAR" "$@"
 else
-	pkgmk -b $INSTALLBASEDIR -a $ARCH -f $PROTO BASEDIR=/opt/csw "$@"
+	pkgmk -b $SRCBASEDIR -a $ARCH -f $PROTO BASEDIR=$BASEDIR "$VERSIONVAR" "$@"
 fi
 
 if [[ $? -ne 0 ]] ; then die package creation failed ; fi
@@ -129,7 +142,7 @@
 if [[ "$mode" = "absolute" ]] ; then
 	print packaging of files under $ROOTDIR complete
 else
-	print packaging of files under $INSTALLBASEDIR complete
+	print packaging of files under $SRCBASEDIR complete
 fi
 
 echo gzipping pkgfile


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