This is an automated email from the git hooks/post-receive script. stuart pushed a commit to branch master in repository latexdraw.
commit ac76e05672893f6247d0f7368023ccd3b9b866d5 Author: Stuart Prescott <[email protected]> Date: Mon Apr 20 22:24:37 2009 +0000 * new version of repackage script --- debian/repackage | 336 +++++++++++++++++++++++++++++++++++------------------ debian/repackagerc | 13 ++- 2 files changed, 234 insertions(+), 115 deletions(-) diff --git a/debian/repackage b/debian/repackage index 4b5706a..53f4037 100755 --- a/debian/repackage +++ b/debian/repackage @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/sh set -u set -e @@ -12,45 +12,50 @@ PACKAGE=frobinator UPSTREAM=sourceforge.net UNARCHIVE=do_unzip -RM_LIST="lib,src lib" -FIND_LIST="*.jar,*.class" +WRAPDIR=true -LOG=debian/README.Debian-source +LOG=README.Debian-source -VERBOSE=1 -CLEANUP=0 +VERBOSE=${VERBOSE:-1} +CLEANUP=${CLEANUP:-0} -RCFILE=debian/repackagerc +SCRIPTDIR=$(dirname $(readlink -f $0)) -if [ ! -f $RCFILE ] -then - cat <<EOT 1>&2 -$0 Error: No configuration parameters found in file $RCFILE. -Exiting. -EOT - exit 1 -fi +NAME=$(basename $0) +RCFILE=$SCRIPTDIR/repackagerc -. $RCFILE +EXCLUDE_LIST="" +# Originally '197001010000.00' but tar complains about an +# "implausibly old time stamp" +TOUCHTIME=199001010000.00 +# Set a consistent umask for repackaging so that the tarball is reproducible +# (overridable in the rc file) +umask 002 -if [ $# -lt 3 -o $# -gt 4 ] -then +usage() { cat <<EOT 1>&2 -Usage: $0 --upstream-version x.y.z filename.zip [src_package_revision] +Usage: $NAME --upstream-version x.y.z filename.zip + [src_package_revision] [target_dir] Where the the version x.y.z is the version number of the new version and -filename.zip is the new source filename for the package $PACKAGE. +filename.zip (or .tar.gz or whatever) is the new source filename for the +package $PACKAGE. + +If filename.zip starts with http:// or ftp:// then wget is used to download +the archive first. The file $RCFILE must exist and set the following environment variables (and these are their current versions): PACKAGE=$PACKAGE UPSTREAM=$UPSTREAM - + UNARCHIVE=$UNARCHIVE - RM_LIST=$RM_LIST - FIND_LIST=$FIND_LIST + EXCLUDE_LIST=$EXCLUDE_LIST + +(EXCLUDE_LIST is a list of exclusions for tar, one per line. Note that +spaces in path names are problematic) It is expected that this utility is run by uscan or and is run in the base directory of the source package. @@ -58,32 +63,27 @@ base directory of the source package. The optional argument 'src_package_revision' can be specified to indicate additional cycles of source package revision that may have been undertaken in addition to the regular packaging activities. +If not specified, the debian/changelog is parsed to try to work out what +the source revision should be. + +The optional argument 'target_dir' may be used to specify where the repackaged +source should be left. + EOT - exit 1 -fi +} -function progress() { - if [ $VERBOSE ] +progress() { + if [ "$VERBOSE" != 0 -a -n $VERBOSE ] then echo "$@" fi } -function logmsg() { +logmsg() { echo "$@" >> $LOGFILE } -# function logcmd() { -# logmsg "" -# logmsg "\$ $@" -# OUT="$($@)" -# if [ ! -z "$OUT" ] -# then -# logmsg "$OUT" -# fi -# } - -function logcmd() { +logcmd() { logcmdpieces "$@" "$@" >> $LOGFILE } @@ -92,65 +92,173 @@ function logcmd() { # maintain proper quoting in the log, it seems, unless each command is # double quoted to begin with... which is also an ugly, bug-attracting # hack. -function logcmdpieces() { - echo -ne "\n$" >> $LOGFILE - for i in "$@" - do - case "$i" in - *\ *) - echo -n " \"$i\"" >> $LOGFILE - ;; - *) - echo -n " $i" >> $LOGFILE - ;; - esac - done - echo >> $LOGFILE +logcmdpieces() { + printf "\n$ " >> $LOGFILE + echo "$@" >> $LOGFILE } -function carp() { - echo $(basename $0)": Error: $*" +carp() { + echo "E: ($NAME) $*" exit 1 } -function do_unzip() { - logcmd unzip -d "$1" "$2" +do_unzip() { + logcmd unzip -qq -d "$1" "$2" +} + +do_untargz() { + logcmd tar -C "$1" -zxf "$2" } -function do_untargz() { - logcmd tar -C "$1" -zvxf "$2" +do_untarbz2() { + logcmd tar -C "$1" -jxf "$2" } -function do_untarbz2() { - logcmd tar -C "$1" -jvxf "$2" +testarchive() { + case "$1" in + do_unzip) + ALLDIRS=$(zipinfo -1 "$2" | cut -f1 -d/ | sort -u) + if [ $(echo "$ALLDIRS" | wc -l) -gt 1 ] + then + testarchiveerror + fi + echo "$ALLDIRS" + ;; + do_untargz) + ALLDIRS=$(tar ztf "$2" | cut -f1 -d/ | sort -u) + if [ $(echo "$ALLDIRS" | wc -l) -gt 1 ] + then + testarchiveerror + fi + echo "$ALLDIRS" + ;; + do_untarbz2) + ALLDIRS=$(tar jtf "$2" | cut -f1 -d/ | sort -u) + if [ $(echo "$ALLDIRS" | wc -l) -gt 1 ] + then + testarchiveerror + fi + echo "$ALLDIRS" + ;; + esac } +testarchiverror() { + echo "E: More than one directory was found in the unwrapped archive." + echo "E: Set WRAPDIR to wrap the contents of the tarball in a directory." + exit 1 +} + +make_exclude_list() { + echo "$EXCLUDE_LIST" | grep -v -e ^$ | sed 's/^\(.*\)/--exclude=\1/' +} + +next_source_version() { + LAST_SRC=$(dpkg-parsechangelog | \ + sed -n 's/Version: \(.*\)+[0-9\-]*/\1/p') + #echo "LS=$LAST_SRC" + if [ $LAST_SRC = $VERSION ] + then + SRCVERSION=$(dpkg-parsechangelog | \ + sed -n 's/Version: [^+]*+\(.*\)-.*/\1/p') + SRCVERSION=$(($SRCVERSION+1)) + else + SRCVERSION=1 + fi + echo $SRCVERSION +} + +########################################################################### + +if [ ! -f $RCFILE ] +then + cat <<EOT 1>&2 +$0 Error: No configuration parameters found in file $RCFILE. +Exiting. +EOT + usage + exit 1 +fi + +# Read in the user/package settings +. $RCFILE + +if [ $# -lt 3 -o $# -gt 5 ] +then + usage + exit 1 +fi + +########################################################################### + DATE=$(date -R) VERSION=$2 -SRCFILE=$3 -SRCARCHIVE=$(basename "$SRCFILE") +SRCPATH=$3 + +SRCVERSION="" TARGETDIR=$(pwd) +if [ $# -eq 5 ] +then + SRCVERSION="$4" + TARGETDIR="$5" +elif [ $# -eq 4 ] +then + if [ -d $4 ] + then + TARGETDIR="$4" + SRCVERSION=$(next_source_version) + else + SRCVERSION="$4" + fi +else + SRCVERSION=$(next_source_version) +fi +VERSION="$VERSION+$SRCVERSION" + +if [ ! -d "$TARGETDIR" ] +then + carp "Target directory '$TARGETDIR' doesn't exist!" +fi + +progress "I: Making orig tarball for $VERSION" + +########################################################################### + LOGFILE=$TARGETDIR/$LOG -rm -f $LOGFILE -if [ $# -ge 4 ] +if [ -f "$LOGFILE" ] then - VERSION="$VERSION+$4" -else - VERSION="$VERSION+1" + progress "W: Deleting existing log file" + rm "$LOGFILE" fi -DIR=${PACKAGE}-$VERSION +########################################################################### + +DIR=${PACKAGE}-$VERSION.orig + +ARCHIVEFILE=${PACKAGE}_${VERSION}.orig.tar +ARCHIVELOCATION="$TARGETDIR" -ARCHIVEFILE=${PACKAGE}_${VERSION}.orig.tar.gz -ARCHIVELOCATION="$(pwd)/../" +TEMPDIR=$(mktemp -t -d $NAME.XXXXXXXXXX) || carp "Couldn't make temp dir" -TEMPDIR=$(mktemp -d) || carp "Couldn't make temp dir" -cp "$(pwd)/$SRCFILE" "$TEMPDIR" +########################################################################### + +progress "I: Locating source $SRCPATH" + +SRCARCHIVE=$(basename "$SRCPATH") +if [ $(expr substr "$SRCPATH" 1 7) = "http://" -o \ + $(expr substr "$SRCPATH" 1 6) = "ftp://" ] +then + UPSTREAMURL="$SRCPATH" + wget "$UPSTREAMURL" -O "$TEMPDIR/$SRCARCHIVE" +else + cp "$SRCPATH" "$TEMPDIR" +fi cd $TEMPDIR || carp "Couldn't cd to temp dir $TEMPDIR" +########################################################################### MD5="md5sum --binary" logmsg " @@ -159,63 +267,69 @@ Repackaging of original source for $PACKAGE $PACKAGE version $VERSION. -Downloaded file $SRCARCHIVE from $UPSTREAM." +Downloaded file: $SRCARCHIVE +From: $UPSTREAM +Path: $SRCPATH" logcmd $MD5 $SRCARCHIVE -progress "Details: -Directory: $DIR -Package name: $PACKAGE -Version: $VERSION -" +progress "I: Directory: $DIR +I: Package name: $PACKAGE +I: Version: $VERSION" logmsg " -The following commands were used to repackage the original source:" +The following commands were used to repackage the original source (the +'touch' commands ensure that the md5sum of the archives stays the same):" # get the source -progress "Copying source" -mkdir $DIR -$UNARCHIVE $DIR $SRCARCHIVE -cd $DIR || carp "Couldn't cd to archive dir $DIR" - - -# clean up the archive -progress "Cleaning up archive" - -OLDIFS=$IFS -IFS=, -for i in $RM_LIST -do - logcmd rm -rf "$i" -done - -for i in $FIND_LIST -do - logcmd find . -name "$i" -exec rm -f {} \; -done - -IFS=$OLDIFS +progress "I: Uncompressing source" +if $WRAPDIR +then + logcmd mkdir $DIR + $UNARCHIVE $DIR $SRCARCHIVE +else + INNERDIR=$(testarchive $UNARCHIVE $SRCARCHIVE) + $UNARCHIVE . $SRCARCHIVE + logcmd mv $INNERDIR $DIR +fi +# set a consistent time for the top directory +logcmd touch -t $TOUCHTIME $DIR +# repackage the archive +progress "I: Creating 'orig' tar archive" -cd .. || carp "Couldn't leave archive dir" +#echo "$(make_exclude_list)" -# repackage the archive -progress "Creating 'orig' archive" -logcmd tar zcf $ARCHIVEFILE $DIR +logcmd tar cf $ARCHIVEFILE --owner 0 --group 0 --numeric-owner \ + $(make_exclude_list) \ + $DIR -logcmd $MD5 $ARCHIVEFILE +# Also set a consistent time on the tar archive +logcmd touch -t $TOUCHTIME $ARCHIVEFILE +#logcmd md5sum $ARCHIVEFILE +progress "I: Compressing archive" +logcmd gzip -9 $ARCHIVEFILE +logcmd md5sum --binary $ARCHIVEFILE.gz logmsg " -- $DEBFULLNAME <$DEBEMAIL> $DATE --------------------------------------------------------------------- " -progress "Moving archive $ARCHIVEFILE" -mv $ARCHIVEFILE $ARCHIVELOCATION +########################################################################### + +progress "I: Moving archive $ARCHIVEFILE.gz" +#mv $ARCHIVEFILE $ARCHIVELOCATION +touch $ARCHIVEFILE.gz +mv $ARCHIVEFILE.gz $ARCHIVELOCATION + +########################################################################### -progress "Cleaning up $TEMPDIR" if [ $CLEANUP != 0 ] then + progress "I: Cleaning up $TEMPDIR" rm -rf $TEMPDIR +else + progress "I: Files left in $TEMPDIR for your inspection" fi - +########################################################################### diff --git a/debian/repackagerc b/debian/repackagerc index 0dbd0a4..ff3d5b2 100644 --- a/debian/repackagerc +++ b/debian/repackagerc @@ -1,9 +1,14 @@ # Settings for repackaging the upstream source code -# of the latexdraw package +# of the jlibeps package -PACKAGE=latexdraw +PACKAGE=jlibeps UPSTREAM=sourceforge.net UNARCHIVE=do_unzip -RM_LIST="lib,src lib,doc" -FIND_LIST="*.jar,*.class" +WRAPDIR=false +EXCLUDE_LIST=" +bin +doc +*.class +*.jar +" -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/latexdraw.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

