r682 - /scripts/export-boinc

fst-guest at users.alioth.debian.org fst-guest at users.alioth.debian.org
Wed Jun 27 18:55:02 UTC 2007


Author: fst-guest
Date: Wed Jun 27 18:55:01 2007
New Revision: 682

URL: http://svn.debian.org/wsvn/pkg-boinc/?sc=1&rev=682
Log:
Massive clean-up of the export-boinc script.

Modified:
    scripts/export-boinc

Modified: scripts/export-boinc
URL: http://svn.debian.org/wsvn/pkg-boinc/scripts/export-boinc?rev=682&op=diff
==============================================================================
--- scripts/export-boinc (original)
+++ scripts/export-boinc Wed Jun 27 18:55:01 2007
@@ -9,82 +9,60 @@
 
 set -e
 
-# space separated list of directories where to put the tarball
+SVN_ROOT="http://boinc.berkeley.edu/svn"
+
+# Define default values which can be overriden by command line options
+# and get the command line options.
+#
+SNAPSHOT=0
 DIRS="tarfiles/boinc tarfiles tarballs/boinc tarballs"
 
-SVN_ROOT="http://boinc.berkeley.edu/svn"
-
-# get options
-SNAPSHOT=0
-VERBOSE=0
-while getopts "r:d:s:v:t:h" FLAG
+while getopts "r:d:s:t:h" FLAG
 do
-    if test "$FLAG" = "r"; then
+    if [ "$FLAG" = "r" ]; then
         VERSION=$OPTARG
-    elif test "$FLAG" = "d"; then
+    elif [ "$FLAG" = "d" ]; then
         DATE=$OPTARG
-    elif test "$FLAG" = "t"; then
+    elif [ "$FLAG" = "s" ]; then
+        SNAPSHOT=1
+    elif [ "$FLAG" = "t" ]; then
         DIRS=$OPTARG
-    elif test "$FLAG" = "s"; then
-        SNAPSHOT=1
-    elif test "$FLAG" = "v"; then
-        VERBOSE=1
-    elif test "$FLAG" = "h"; then
+    elif [ "$FLAG" = "h" ]; then
         cat <<EOHELP
-
 Usage: export-boinc <options>
 
-       -d YYYYMMDD retrieve version of particular day
-       -r X.Y	   retrieve particular release
-       -s          retrieve snapshot        
-       -h          this usage description
-       -t path     specify directory at which to store tarfile
-       -v          verbose output and debug messages
+  -r X.Y.Z    retrieve particular release
+  -d YYYYMMDD retrieve version of particular day
+  -s          retrieve snapshot
+  -h          print this usage description
+  -t PATH     specify directory at which to store tarfile
 
-       These flags can be combined. The retrieval of the 
-       very latest version (HEAD) is the default.
-       This script can be executed from any directory. It is
-       however suggested to chose one at CWD that has any
-       of the following as a subdirectory for compatibility
-       with the tool svn-buildpackage:
+  These options can be combined. The retrieval of the very latest
+  version (HEAD) is the default. This script can be executed from any
+  directory. If executed from one that has any of the following as a
+  subdirectory, it will place it in the first suitable one:
 EOHELP
-	for dd in $DIRS
-	do
-	    echo "          $dd"
-	done
-	exit -1
+	    echo "    $DIRS"
+	    exit 0
     fi
 done
 
-SVN=`which svn`
-if [ -z "$SVN" ]; then
-    cat <<EOSVNPROB
-Error: The subversion tool (svn) is not found.
-       Please modify the PATH environment variable
-       and crosscheck that the package subversion
-       is installed.
-EOSVNPROB
-    exit -1
-elif [ "$VERBOSE" -gt 0 ]; then
-    echo "Using subversion binary at '$SVN'"
-fi
 
-# validate options
+# Parse/validate the given command line options to construct the
+# appropriate Subversion command to download the upstream source ccode.
+#
 if [ -z "$VERSION" ]; then
-    if [ $VERBOSE -gt 0 ]; then
-        echo "Warning: version number was not specified, assuming 'HEAD'"
-    fi
+    echo "Warning: version number was not specified, assuming 'HEAD'"
     VERSION="HEAD"
     SVN_DIR="trunk/boinc"
 fi
 
-# parse options
-if [ -z "$DATE" -a "$SNAPSHOT" -eq 0 ]; then
+if [ -z "$DATE" ] && [ "$SNAPSHOT" -eq 0 ]; then
     DEBIAN_VERSION="$VERSION"
     ORIG_DIR="boinc-$DEBIAN_VERSION.orig"
     if [ "$VERSION" != "HEAD" ]; then
 	    SVN_VERSION=$(echo $VERSION | tr '.' '_')
-        if [ $(echo $VERSION | tr -c -d '[:digit:]') -ge 594 ]; then
+        if dpkg --compare-versions $VERSION ge 5.9.4 ; then
 	        SVN_DIR="tags/boinc_core_release_$SVN_VERSION"
         else
 	        SVN_DIR="tags/boinc_core_release_$SVN_VERSION/boinc"
@@ -92,17 +70,17 @@
     fi
     SVN_COMMAND="svn export $SVN_ROOT/$SVN_DIR $ORIG_DIR"
 
-elif [ -n "$DATE" -a "$SNAPSHOT" -eq 0 ]; then
+elif [ -n "$DATE" ] && [ "$SNAPSHOT" -eq 0 ]; then
     DEBIAN_VERSION="$VERSION"
     ORIG_DIR="boinc-$DEBIAN_VERSION.orig"
     SVN_COMMAND="svn export -r {$DATE} $SVN_ROOT/$SVN_DIR $ORIG_DIR"
 
-elif [ -n "$DATE" -a "$SNAPSHOT" -eq 1 ]; then
+elif [ -n "$DATE" ] && [ "$SNAPSHOT" -eq 1 ]; then
     DEBIAN_VERSION="$VERSION~snapshot.$DATE"
     ORIG_DIR="boinc-$DEBIAN_VERSION.orig"
     SVN_COMMAND="svn export -r {$DATE} $SVN_ROOT/$SVN_DIR $ORIG_DIR"
 
-elif [ -z "$DATE" -a "$SNAPSHOT" -eq 1 ]; then
+elif [ -z "$DATE" ] && [ "$SNAPSHOT" -eq 1 ]; then
     DATE=$(date +%Y%m%d)
     DEBIAN_VERSION="$VERSION~snapshot.$DATE"
     ORIG_DIR="boinc-$DEBIAN_VERSION.orig"
@@ -111,45 +89,56 @@
 
 ORIG_ARCHIVE="boinc_$DEBIAN_VERSION.orig.tar.gz"
 
-if test -e $ORIG_ARCHIVE; then
+if [ -e $ORIG_ARCHIVE ]; then
     echo "Error: $ORIG_ARCHIVE already exists"
     exit 1
 fi 
 
+
+# Print the svn command invocation and export the BOINC source code
+# from upstream's Subversion repository.
+#
 echo "$SVN_COMMAND"
 $SVN_COMMAND
 
-###
-### remove non-free or unneeded things
-###
 
-# non-free: binary textured font files (.txf) without source
+# Remove non-free or unneeded sources or cruft from the upstream source
+# code before creating the tarball.
+#
+# [non-free] Contains binary textured font files (.txf) without source.
 rm -rf "$ORIG_DIR/api/txf"
 
-# non-free: BOINC Public License
+# [non-free] File is licensed under the BOINC Public License which is
+# DFSG-incompatible.
 rm -f "$ORIG_DIR/zip/configure"
 
-# non-free and unneeded: unneeded build systems and binaries without source
+# [non-free, unneeded] Unneeded build systems and binaries without
+# source.
 rm -rf "$ORIG_DIR/client/mac"
 rm -rf "$ORIG_DIR/clientgui/mac"
 rm -rf "$ORIG_DIR/mac_build"
 rm -rf "$ORIG_DIR/mac_installer"
 rm -rf "$ORIG_DIR/win_build"
 
-# unneeded: already in Debian and we build depend on it
+# [non-free] The file lib/mac/dyld_gdb.h is licensed under the
+# DFSG-incompatible Apple Public Source License (APSL).
+rm -rf "$ORIG_DIR/lib/mac"
+
+# [unneeded] This 3rd party software is already in Debian and we added
+# them to boinc's Build-Depends.
 rm -rf "$ORIG_DIR/curl"
 rm -rf "$ORIG_DIR/openssl"
 rm -rf "$ORIG_DIR/zlib"
 
-# unneeded: (CVS) cruft
+# [unneeded] Cruft that is not needed to build the BOINC software.
 rm -f "$ORIG_DIR/.vimrc"
 find $ORIG_DIR -name .cvsignore -exec rm '{}' \;
 
-###
-### preparations of the tarball
-###
 
-# replace HEAD with the actual version number
+# If HEAD was specified as version number, read the actual version
+# number from $ORIG_DIR/configure.ac and rename the $ORIG_DIR
+# accordingly.
+#
 if [ $VERSION = "HEAD" ]; then
     CFG_AC="$ORIG_DIR/configure.ac"
     VERSION="$(grep AC_INIT $CFG_AC | cut -d ',' -f 2 | sed 's/\s*)*//g')"
@@ -162,24 +151,26 @@
     mv $OLD_ORIG_DIR $ORIG_DIR
 fi
 
-# look for directories where we can place the orig tarball
 
-DEST_DIR=""
-for dd in $DIRS
+# Look for suitable directories where we can place the orig tarball.
+# If none default directory is suitable we use the current working
+# directory.
+#
+DEST_DIR="."
+for dir in $DIRS
 do
-    if [ -z "$DEST_DIR" -a -d "$dd" -a -w "$dd" ]; then
-        DEST_DIR="$dd"
+    if [ "$DEST_DIR" = "." ] && [ -d "$dir" ] && [ -w "$dir" ]; then
+        DEST_DIR="$dir"
     fi
 done
-
-if [ -z "$DEST_DIR" ]; then
-    cat <<EODESTDIRPROB
-Could not assign destination directory after inspecting
-all directories at '$DIRS'.
-EODESTDIRPROB
-    exit -1
+if [ "$DEST_DIR" = "." ]; then
+    echo "Warning: no suitable destination directory for the tarball found"
 fi
 
+
+# Put the exported source into a tarball, compress it with maximum
+# compression and save it in $DEST_DIR.
+#
 echo "Preparing source tarball as '$DEST_DIR/$ORIG_ARCHIVE'."
 tar cf - $ORIG_DIR | gzip -c9 > "$DEST_DIR/$ORIG_ARCHIVE"
 rm -rf $ORIG_DIR




More information about the pkg-boinc-commits mailing list