[Pkg-octave-commit] r1159 - utils

Rafael Laboissiere rafael at alioth.debian.org
Fri Jan 11 10:30:00 UTC 2008


Author: rafael
Date: 2008-01-11 10:29:59 +0000 (Fri, 11 Jan 2008)
New Revision: 1159

Added:
   utils/svn-import-pkg
Log:
Script for automating the import of packages into the SVN repository

Added: utils/svn-import-pkg
===================================================================
--- utils/svn-import-pkg	                        (rev 0)
+++ utils/svn-import-pkg	2008-01-11 10:29:59 UTC (rev 1159)
@@ -0,0 +1,132 @@
+#!/bin/bash
+
+### svn-import-pgk - Import new Debian packages into the DOG SVN repository
+###
+### Copyright (C) 2008  Rafael Laboissiere
+### This script is releaed under the terms of the GNU GPL-3. No warranties
+### $Id$
+
+### Get program name
+PROG=${0/.*\//}
+
+### Customizable variables
+GROUP="Debian Octave Group"
+SYNOPSIS="$PROG [options] [pkg]"
+
+### These variables can be set via command-line options.  Set here
+### the defaiult values.
+SERVER=svn.debian.org
+REPO="/svn/pkg-octave"
+USER=
+
+### Usage message
+usage="\
+SYNOPSIS
+    $SYNOPSIS
+
+DESCRIPTION
+    Import Debian packages into the $GROUP SVN repository
+    at Alioth, creating the trunk and tags subdirectories, and putting
+    the debian/* files into the trunk directory.  Note that write access
+     to the repository $SERVER:$REPO is required.
+
+    If no package name is not given, the program assumes that the
+    package is unpacked in the current directory and looks for the
+    its name and version in ./debian/changelog.
+
+OPTIONS
+    -h | --help          Print this usage message.
+
+    -u | --user name     User name at Alioth. If your user name is the
+                         same locally and at $HOST, you do
+                         not need this option.
+                         [default value: \"$USER\"]
+
+    -r | --repo path     Location of the repository on the remote server.
+                         [default value: \"$REPO\"]
+
+    -s | --server host   Host name of the SVN server
+                         [default value: \"$SERVER\"]
+
+    -n | --no-tag        Do not create a tag for this release.  Note that
+                         setting the distribution in debian/changelog
+                         to \"UNRELEASED\" has the same effect of this
+                         option.
+
+    -d | --dry-run       Show the SVN commands without running them.
+"
+
+### Check command-line options
+set -- $(getopt --options hu:r:s:nd				\
+                --long help,user:,repo:,server:no-tag,dry-run	\
+                --name $PROG					\
+                -u -- "$@")
+
+### Parse command-line arguments
+while true; do
+    case "$1" in
+        -h|--help)		HELP=1 ;;
+        -u|--user)		USER=$2 ; shift ;;
+        -r|--repo)		REPO=$2 ; shift ;;
+        -s|--server)		SERVER=$2 ; shift ;;
+        -n|--no-tag)            NOTAG=1 ;;
+        -d|--dry-run)		DRYRUN=1 ;;
+        --)			;;
+        *)			PKG=$1 ; break ;;
+    esac
+    shift
+done
+
+### Exit showing error/warning message.  First argument is the return
+### status and second argument is the message string.
+croak() {
+  echo "$2"
+  exit $1
+}
+
+### User needs help
+test -z "$HELP" || croak 0 "$usage"
+
+### If user name is given, add an "@" to it, otherwise the URL will
+### be wrong
+test -n "$USER" && USER="$USER@"
+
+### More than one package name argument is npot allowed
+(( $# > 1 )) && croak 1 "Usage: $SYNOPSIS"
+
+### If no package name is given get it through apt-get
+if test -n "$PKG" ; then
+    apt-get source $PKG || croak 1
+    cd $(ls -td $PKG-* | head --lines=1)
+fi
+
+### Parse version line in debian/changelog to get source package name,
+### the newest version number, and the distribution
+test -e debian/changelog \
+       || croak 1 "$PROG:E: debian/changelog not found"
+LINE=( $(head --lines=1 debian/changelog) )
+PKG=${LINE[0]}
+VER=${LINE[1]/(/}
+VER=${VER/)/}
+DIST=${LINE[2]}
+DIST=${DIST/;/}
+
+URL="svn+ssh://$USER$SERVER/$REPO/$PKG"
+
+### Echo the command given as argument and run it if dry run is not required
+run() {
+  echo "$*"
+  test -n "$DRYRUN" || eval "$*" || croak 1 "$PROG:E: Command failed"
+}
+
+### Run SVN commands
+
+run svn mkdir $URL $URL/trunk $URL/trunk/debian $URL/tags \
+    --message "'Created directory structure for $PKG package'"
+
+run svn import debian $URL/trunk/debian \
+    --message "'Initial import of package $PKG'"
+
+test -z "$NOTAG" -a "$DIST" != UNRELEASED \
+    && run svn copy $URL/trunk $URL/tags/$VER \
+           --message "'Debian release $PKG $VER'"


Property changes on: utils/svn-import-pkg
___________________________________________________________________
Name: svn:executable
   + *




More information about the Pkg-octave-commit mailing list