aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2007-09-24 15:25:55 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2007-09-24 15:25:55 +0000
commit1833439f4dac3205e9ff6bb08a3240c33b525da4 (patch)
tree44c435808754bf1eac0ec79b63757452f56d2bca
parent8f769872cac72fcfb5dd1ee75ad68d7cbb1cc8c0 (diff)
downloadgsc-1833439f4dac3205e9ff6bb08a3240c33b525da4.tar.gz
gsc-1833439f4dac3205e9ff6bb08a3240c33b525da4.tar.bz2
* cvs/mksnapshot (COMPRESS,ZSUFFIX,VERBOSE): New configuration
variables. (module): Abort creating snapshot if get_sources returned failure. Report it, if VERBOSE is set. Compression method is configurable via the COMPRESS variable. * doc/gsc.texi: Update the desctiption of mksnapshot. git-svn-id: file:///svnroot/gsc/trunk@310 d2de0444-eb31-0410-8365-af798a554d48
-rw-r--r--ChangeLog9
-rwxr-xr-xcvs/mksnapshot90
-rw-r--r--doc/gsc.texi34
3 files changed, 117 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 31181de..c8af3b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-09-24 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ * cvs/mksnapshot (COMPRESS,ZSUFFIX,VERBOSE): New configuration
+ variables.
+ (module): Abort creating snapshot if get_sources returned
+ failure. Report it, if VERBOSE is set.
+ Compression method is configurable via the COMPRESS variable.
+ * doc/gsc.texi: Update the desctiption of mksnapshot.
+
2007-09-05 Sergey Poznyakoff <gray@gnu.org.ua>
* lib/gsc.h: Keep the namespace clean.
diff --git a/cvs/mksnapshot b/cvs/mksnapshot
index 2160d7b..80033fe 100755
--- a/cvs/mksnapshot
+++ b/cvs/mksnapshot
@@ -15,13 +15,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-PROGRAM=$0
CONFIG=$HOME/etc/cvsdaily.conf
+MSG=/tmp/$0.$$
+
+trap "rm -f $MSG" 1 2 13 15
# Print short usage notice
usage() {
fmt <<EOF
-$0 -- Generate snapshot tarballs from the user's CVS repository
+$0 -- Generate snapshot tarballs from the user's CVS or SVN repository
usage: $0 [ARGS]
$0 --help
@@ -35,6 +37,7 @@ exists.
EOF
cat - <<EOF
CVSROOT CVS repository directory
+ SVNROOT SVN repository directory
WD Working directory
FTP Target directory where tarballs should be placed
@@ -49,18 +52,31 @@ EOF
well. Default is SAVANE.
MAXSNAPSHOTS Keep that number of snapshots. Default is 3.
+ COMPRESS Name of the compress program.
+ Recognized values are "compress", "gzip" (default), and "bzip2".
+ Any other value is also accepted, provided that you also
+ set the ZSUFFIX variable (see below).
+ ZSUFFIX Additional suffix for compressed tarballs (without leading dot).
+ Default values are "Z", for COMPRESS=compress, "gz", for
+ COMPRESS=gzip, and "bz2", for COMPRESS=bzip2.
+ VERBOSE Set verbosity level. Allowed values are "yes", "no", or any
+ decimal number. Default is "no".
EOF
exit 0
}
# Bail out and abort the program
abort() {
- echo "$PROGRAM: $*" >&2
+ echo "$0: $*" >&2
exit 1
}
+warning() {
+ echo "$0: warning: $*" >&2
+}
+
# Read the default config file, if available
-[ -r $CONFIG ] && . $CONFIG
+[ -r $CONFIG ] && . $CONFIG || exit 1
# Parse command line options
while [ $# -ne 0 ]
@@ -87,6 +103,33 @@ export CVSROOT SVNROOT
[ -d "$FTP" ] || abort "$FTP is not a directory"
: ${MAXSNAPSHOTS:=3}
+case ${COMPRESS:=gzip} in
+gzip) ZSUFFIX=gz
+ COMPRESS=-z
+ ;;
+bzip2) ZSUFFIX=bz2
+ COMPRESS=-j
+ ;;
+compress)
+ ZSUFFIX=Z
+ COMPRESS=-Z
+ ;;
+*) if [ -z "$ZSUFFIX" ]; then
+ abort "Non-standard COMPRESS value ($COMPRESS); you must specify ZSUFFIX for it to work"
+ fi
+ COMPRESS="--use-compress-program=$COMPRESS"
+ ;;
+esac
+
+TARSUF=tar.$ZSUFFIX
+
+case ${VERBOSE:=0} in
+[0-9]*) ;;
+yes) VERBOSE=1;;
+no) VERBOSE=0;;
+*) abort "Invalid value for VERBOSE (must be integer or boolean)"
+esac
+
cvs_get_change_date() {
cvs -Q -d $1 co -p $2/ChangeLog 2>/dev/null | head -1
}
@@ -111,7 +154,7 @@ svn_release_sources() {
rm -rf $1
}
-# Process the specified CVS module.
+# Process the specified CVS or SVN module.
# usage: module MODNAME ROOT getdate getsources relsources
# $1 $2 $3 $4 $5
# FIXME: DIR is not actually used
@@ -131,21 +174,36 @@ module() {
*) echo "$root/$modname: Cannot extract last modification date"
return ;;
esac
- tarname=${modname}-${last}.tar.gz
+ tarname=${modname}-${last}.$TARSUF
if [ -r ${FTP}/${tarname} ]; then
echo "$tarname already exists"
else
echo "Creating $tarname"
- $get_sources $root $modname
- if [ -d $1 ]; then
- tar -czf ${FTP}/$tarname \
- --exclude CVS --exclude .svn --exclude .cvsignore $1
+ if $get_sources $root $modname >$MSG; then
+ if [ -d $1 ]; then
+ tar -c $COMPRESS -f ${FTP}/$tarname \
+ --exclude CVS --exclude .svn --exclude .cvsignore $1
+ $release_sources $modname || break
+
+ (
+ cd $FTP || break
+ rm -f ${modname}-latest.$TARSUF
+ ln -s $tarname ${modname}-latest.$TARSUF
+ echo "Removing old snapshots of $modname"
+ ls -t "{modname}-"*.$TARSUF 2>/dev/null |
+ sed "1,${MAXSNAPSHOTS}d" |
+ xargs -rt rm
+ )
+ fi
+ else
$release_sources $modname
-
- echo "Removing old snapshots of $modname"
- ls -t "${FTP}/${modname}-"*.tar.gz |
- sed "1,${MAXSNAPSHOTS}d" |
- xargs -rt rm
+ if [ $VERBOSE -gt 0 ]; then
+ warning "ignoring $root/$modname"
+ if [ $VERBOSE -gt 1 ]; then
+ warning "checkout reported:"
+ cat $MSG >&2
+ fi
+ fi
fi
fi
done
@@ -206,4 +264,6 @@ PLAIN|plain) main_plaincvs;;
*) abort "Unknown REPOSITORY value";;
esac
+rm -f $MSG
+
# End of mksnapshot
diff --git a/doc/gsc.texi b/doc/gsc.texi
index 2b03461..a5251c7 100644
--- a/doc/gsc.texi
+++ b/doc/gsc.texi
@@ -202,7 +202,12 @@ distribution directory.
The resulting archive is named @file{@var{project}-@var{DATE}.tar.gz},
where @var{project} is the name of the module and @var{date} is latest
-@file{ChangeLog} date in @samp{YYYY-MM-DD} format.
+@file{ChangeLog} date in @samp{YYYY-MM-DD} format. In addition, a
+symbolic link to the latest snapshot is created. The link is named
+@file{@var{project}-latest.tar.gz}.
+
+ The actual compression method, and the tarball suffix are
+configurable (see the description of @code{COMPRESS} variable below).
If the module is not found in the @acronym{CVS},
@command{mksnapshot} tries out the @acronym{SVN} repository, if it is
@@ -247,6 +252,33 @@ repository. Lower-case values are accepted as well. Default is
@acronym{CVS} repositories.
@end defvar
+@defvar COMPRESS
+Name of the compress program to use. Recognized values are
+@samp{compress}, @samp{gzip} (default), and @samp{bzip2}.
+Any other value is also accepted, provided that you also set the
+@code{ZSUFFIX} variable (see below).
+@end defvar
+
+@defvar ZSUFFIX
+Additional suffix for compressed tarballs (without leading
+dot). Default values depend on the value of the @code{COMPRESS}
+variable, as shown in the table below:
+
+@multitable @columnfractions 0.6 0.4
+@headitem COMPRESS value @tab Suffix
+@item compress @tab Z
+@item gzip @tab gz
+@item bzip2 @tab bz2
+@end multitable
+@end defvar
+
+@defvar VERBOSE
+Set verbosity level. Allowed values are @samp{yes}, @samp{no}, or any
+decimal number. The bigger the number, the more information is
+displayed. The value of @samp{yes} is equivalent to @samp{1}, that of
+@samp{no} is equivalent to @samp{0}. Default is @samp{no}.
+@end defvar
+
The behaviour of @command{mksnapshot} differs depending on the
type of repository used. For plain repositories, @command{mksnapshot}
processes all the modules in the repository, except

Return to:

Send suggestions and report system problems to the System administrator.