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

X Strike Force X.Org X11 SVN commit: r492 - trunk/debian/scripts



Author: branden
Date: 2005-08-03 16:00:14 -0500 (Wed, 03 Aug 2005)
New Revision: 492

Modified:
   trunk/debian/scripts/find-avail-patch-number
Log:
"Port" script to work with the new quilt-enabled patch directory structure.


Modified: trunk/debian/scripts/find-avail-patch-number
===================================================================
--- trunk/debian/scripts/find-avail-patch-number	2005-08-03 17:20:51 UTC (rev 491)
+++ trunk/debian/scripts/find-avail-patch-number	2005-08-03 21:00:14 UTC (rev 492)
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# $Id: find-avail-patch-number 1076 2004-02-19 21:40:15Z branden $
+# $Id$
 
 # Run this from the debian/patches directory of the unpacked source tree.
 
@@ -11,11 +11,15 @@
 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.
+       $PROGNAME { -h | --help }
+Identify the first (least) free patch number in a patch directory, which should
+be the current working directory.  The patch directory may contain
+subdirectories.  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.
+
+The "-h" and "--help" options display this usage message.
 EOF
 }
 
@@ -36,7 +40,17 @@
 # parse command line
 case $# in
     0) ;;
-    1) FLOOR="$1" ;;
+    1)
+        case "$1" in
+            -h|--help)
+                usage
+                exit 0
+                ;;
+            *)
+                FLOOR="$1"
+                ;;
+        esac
+        ;;
     2) FLOOR="$1" CEILING="$2" ;;
     *) die 2 "too many arguments" ;;
 esac
@@ -52,11 +66,17 @@
     die 2 "ceiling argument must be greater than floor argument"
 fi
 
+# Find all regular files (that aren't in a Subversion metadata directory), and
+# strip directory components from each file specification (sed does greedy
+# matching).
+ALL_PATCHES=$(find . -wholename '*/.svn/*' -prune -o -type f -print \
+              | sed 's/.*\///')
+
 FOUND=
 for N in $(seq $FLOOR $CEILING); do
     PNUM=$(printf "%03d" $N)
-    if [ "$(echo $PNUM*)" = "$PNUM*" ]; then
-        echo $N
+    if ! echo "$ALL_PATCHES" | grep -q "^${PNUM}_"; then
+        printf "%03d\n" $N
         FOUND=yes
         break
     fi



Reply to: