[PATCH RFC:modular] release.sh: Attempt to autodetect section and current/previous tags

Gaetan Nadon memsize at videotron.ca
Fri Sep 16 12:38:48 PDT 2011


On Fri, 2011-09-16 at 11:11 -0700, Alan Coopersmith wrote:

> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
>  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 <<HELP
> -Usage: `basename $0` [options] <section> <tag_previous> <tag_current>
> +Usage: `basename $0` [options] [<section> [<tag_previous> [<tag_current>]]]
> +   or: `basename $0` [options] <section> initial [<tag_current>]
>  
>  Options:
>    --force       force overwritting an existing release
> @@ -123,19 +124,68 @@ while [ $# != 0 ]; do
>          exit 1
>          ;;
>      *)
> -        if [ $# != 3 ]; then
> -            echo "error: invalid argument count"
> +        section="$1"
> +        shift
> +        if [ $# != 0 ]; then
> +            tag_previous="$1"
> +            shift
> +            if [ $# != 0 ]; then
> +                tag_current="$1"
> +                shift
> +            fi
> +        fi
> +        if [ $# != 0 ]; then
> +            echo "error: unknown parameter"
>              usage
>              exit 1
>          fi
> -        section="$1"
> -        tag_previous="$2"
> -        tag_current="$3"
> -        shift 3
>          ;;
>      esac
>  done
>  
> +
> +# Attempt to auto-detect values if not specified
> +if [ -z "$section" ]; then
> +    section="$(git config --get "remote.${remote}.url" | sed -n 's%^.*freedesktop.org/git/xorg/\([^/]*\).*$%\1%p')"

The parsing of the git url will not work for xcb, which is now part of
x.org.

        git://anongit.freedesktop.org/git/xcb/libxcb

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.

> +    echo "Detected section: $section"
> +fi
> +
> +if [ -z "$tag_previous" ]; then
> +    tag_previous="$(git describe --abbrev=0 HEAD^)"
> +    echo "Detected previous tag: $tag_previous"
> +fi
> +
> +if [ -z "$tag_current" ]; then
> +    tag_current="$(git describe --abbrev=0)"
> +    echo "Detected current tag: $tag_current"
> +fi
> +
> +
> +# Check for required values
> +if [ -z "$section" ]; then
> +    echo "error: section not found."
> +    usage
> +    exit 1
> +fi
> +
> +if [ -z "$tag_previous" ] ; then
> +    echo "error: previous tag not found."
> +    usage
> +    exit 1
> +fi
> +
> +if [ -z "$tag_current" ] ; then
> +    echo "error: current tag not found."
> +    usage
> +    exit 1
> +fi
> +
> +if [ "x$tag_previous" = "x$tag_current" ] ; then
> +    echo "current tag ($tag_current) must be different than"
> +    echo "previous tag ($tag_previous)"
> +    exit 1
> +fi
> +
>  # Check for uncommitted/queued changes.
>  if [ "x$ignorechanges" != "x1" ]; then
>      set +e
> @@ -201,13 +251,6 @@ if ! [ -f "$tarball_dir/$tarbz2" ] ||
>      exit 1
>  fi
>  
> -if [ -z "$tag_previous" ] ||
> -   [ -z "$section" ]; then
> -    echo "error: previous tag or section not found."
> -    usage
> -    exit 1
> -fi
> -
>  if [ -n "$moduleset" ]; then
>      echo "checking for moduleset"
>      if ! [ -w "$moduleset" ]; then


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110916/80324c35/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110916/80324c35/attachment.pgp>


More information about the xorg-devel mailing list