<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/3.32.2">
</HEAD>
<BODY>
On Fri, 2011-09-16 at 11:11 -0700, Alan Coopersmith wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
Signed-off-by: Alan Coopersmith &lt;<A HREF="mailto:alan.coopersmith@oracle.com">alan.coopersmith@oracle.com</A>&gt;
---
 release.sh |   71 ++++++++++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 57 insertions(+), 14 deletions(-)

An update to the version I've been using for about a year - after a discussion
at XDC with Keith about adding section autodetection by having a file in every
repo with the directory name, I realized we basically already have one in the
git origin URL.

Still needs a confirmation prompt, which I haven't had time to add, though
it really should be just a few lines of scripting.   Anyone want to contribute
that?  It could even be a separate patch applied before this one.

diff --git a/release.sh b/release.sh
index c522e1e..073114d 100755
--- a/release.sh
+++ b/release.sh
@@ -17,7 +17,8 @@ moduleset=
 usage()
 {
     cat &lt;&lt;HELP
-Usage: `basename $0` [options] &lt;section&gt; &lt;tag_previous&gt; &lt;tag_current&gt;
+Usage: `basename $0` [options] [&lt;section&gt; [&lt;tag_previous&gt; [&lt;tag_current&gt;]]]
+   or: `basename $0` [options] &lt;section&gt; initial [&lt;tag_current&gt;]
 
 Options:
   --force       force overwritting an existing release
@@ -123,19 +124,68 @@ while [ $# != 0 ]; do
         exit 1
         ;;
     *)
-        if [ $# != 3 ]; then
-            echo &quot;error: invalid argument count&quot;
+        section=&quot;$1&quot;
+        shift
+        if [ $# != 0 ]; then
+            tag_previous=&quot;$1&quot;
+            shift
+            if [ $# != 0 ]; then
+                tag_current=&quot;$1&quot;
+                shift
+            fi
+        fi
+        if [ $# != 0 ]; then
+            echo &quot;error: unknown parameter&quot;
             usage
             exit 1
         fi
-        section=&quot;$1&quot;
-        tag_previous=&quot;$2&quot;
-        tag_current=&quot;$3&quot;
-        shift 3
         ;;
     esac
 done
 
+
+# Attempt to auto-detect values if not specified
+if [ -z &quot;$section&quot; ]; then
+&nbsp;&nbsp;&nbsp; section=&quot;$(git config --get &quot;remote.${remote}.url&quot; | sed -n 's%^.*freedesktop.org/git/xorg/\([^/]*\).*$%\1%p')&quot;
</PRE>
</BLOCKQUOTE>
The parsing of the git url will not work for xcb, which is now part of x.org.
<BLOCKQUOTE>
<PRE>
git://anongit.freedesktop.org/git/xcb/libxcb
</PRE>
</BLOCKQUOTE>
The best, but not the easiest, solution is for x.org to complete the hosting of the xcb reposiroties. The git url is the only indication about which repositories belong to x.org and which don't.
<BLOCKQUOTE TYPE=CITE>
<PRE>
+    echo &quot;Detected section: $section&quot;
+fi
+
+if [ -z &quot;$tag_previous&quot; ]; then
+    tag_previous=&quot;$(git describe --abbrev=0 HEAD^)&quot;
+    echo &quot;Detected previous tag: $tag_previous&quot;
+fi
+
+if [ -z &quot;$tag_current&quot; ]; then
+    tag_current=&quot;$(git describe --abbrev=0)&quot;
+    echo &quot;Detected current tag: $tag_current&quot;
+fi
+
+
+# Check for required values
+if [ -z &quot;$section&quot; ]; then
+    echo &quot;error: section not found.&quot;
+    usage
+    exit 1
+fi
+
+if [ -z &quot;$tag_previous&quot; ] ; then
+    echo &quot;error: previous tag not found.&quot;
+    usage
+    exit 1
+fi
+
+if [ -z &quot;$tag_current&quot; ] ; then
+    echo &quot;error: current tag not found.&quot;
+    usage
+    exit 1
+fi
+
+if [ &quot;x$tag_previous&quot; = &quot;x$tag_current&quot; ] ; then
+    echo &quot;current tag ($tag_current) must be different than&quot;
+    echo &quot;previous tag ($tag_previous)&quot;
+    exit 1
+fi
+
 # Check for uncommitted/queued changes.
 if [ &quot;x$ignorechanges&quot; != &quot;x1&quot; ]; then
     set +e
@@ -201,13 +251,6 @@ if ! [ -f &quot;$tarball_dir/$tarbz2&quot; ] ||
     exit 1
 fi
 
-if [ -z &quot;$tag_previous&quot; ] ||
-   [ -z &quot;$section&quot; ]; then
-    echo &quot;error: previous tag or section not found.&quot;
-    usage
-    exit 1
-fi
-
 if [ -n &quot;$moduleset&quot; ]; then
     echo &quot;checking for moduleset&quot;
     if ! [ -w &quot;$moduleset&quot; ]; then
</PRE>
</BLOCKQUOTE>
<BR>
</BODY>
</HTML>