[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

X Strike Force XFree86 SVN commit: r1076 - in trunk/debian: . scripts



Author: branden
Date: 2004-02-19 16:40:15 -0500 (Thu, 19 Feb 2004)
New Revision: 1076

Added:
   trunk/debian/scripts/find-avail-patch-number
Modified:
   trunk/debian/changelog
Log:
Add script to help package maintainers identify available patch numbers.


Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2004-02-19 20:56:25 UTC (rev 1075)
+++ trunk/debian/changelog	2004-02-19 21:40:15 UTC (rev 1076)
@@ -40,8 +40,11 @@
     find_culprits() returns.
     - debian/shell-lib.sh
 
- -- Branden Robinson <branden@debian.org>  Thu, 19 Feb 2004 15:06:51 -0500
+  * Add script to help package maintainers identify available patch numbers.
+    - debian/scripts/find-avail-patch-number
 
+ -- Branden Robinson <branden@debian.org>  Thu, 19 Feb 2004 16:39:12 -0500
+
 xfree86 (4.3.0-2) unstable; urgency=low
 
   * The "It's like I have a shotgun in my mouth, I've got my finger on the

Added: trunk/debian/scripts/find-avail-patch-number
===================================================================
--- trunk/debian/scripts/find-avail-patch-number	2004-02-19 20:56:25 UTC (rev 1075)
+++ trunk/debian/scripts/find-avail-patch-number	2004-02-19 21:40:15 UTC (rev 1076)
@@ -0,0 +1,69 @@
+#!/bin/sh
+
+# $Id$
+
+# Run this from the debian/patches directory of the unpacked source tree.
+
+PROGNAME=${0##*/}
+FLOOR=0
+CEILING=999
+
+usage () {
+    cat <<EOF
+Usage: $PROGNAME [ FLOOR [ CEILING ] ]
+Identify the first (least) free patch number in a DBS patch directory, which
+should be the current working directory.  FLOOR specifies the number at which to
+start searching (default: 0).  CEILING, if used, must be preceded by FLOOR, at
+specifies the number at which to stop searching (default: 999).  Do not put
+leading zeroes on FLOOR or CEILING.
+EOF
+}
+
+die () {
+    EXITSTATUS=$1
+    shift
+    echo "$PROGNAME: fatal error; $*" >&2
+    if [ "$EXITSTATUS" = "2" ]; then
+        usage >&2
+    fi
+    exit $EXITSTATUS
+}
+
+if ! expr "$(pwd)" : ".*/debian/patches" >/dev/null 2>&1; then
+    die 3 "not in a debian/patches directory"
+fi
+
+# parse command line
+case $# in
+    0) ;;
+    1) FLOOR="$1" ;;
+    2) FLOOR="$1" CEILING="$2" ;;
+    *) die 2 "too many arguments" ;;
+esac
+
+# validate arguments
+for N in "$FLOOR" "$CEILING"; do
+    if expr "$N" : ".*[^[:digit:]].*" >/dev/null 2>&1; then
+        die 2 "non-numeric argument \"$N\""
+    fi
+done
+
+if [ ! $CEILING -gt $FLOOR ]; then
+    die 2 "ceiling argument must be greater than floor argument"
+fi
+
+FOUND=
+for N in $(seq $FLOOR $CEILING); do
+    PNUM=$(printf "%03d" $N)
+    if [ "$(echo $PNUM*)" = "$PNUM*" ]; then
+        echo $N
+        FOUND=yes
+        break
+    fi
+done
+
+if [ -z "$FOUND" ]; then
+    die 1 "no patch numbers available in range $FLOOR to $CEILING"
+fi
+
+# vim:set ai et sts=4 sw=4 tw=80:


Property changes on: trunk/debian/scripts/find-avail-patch-number
___________________________________________________________________
Name: svn:executable
   + *
Name: svn:keywords
   + Id



Reply to: