[CentOS-devel] [PATCH] Added script for extracting what I think is the dist tag

Tue Jun 10 14:29:26 UTC 2014
Pat Riehecky <riehecky at fnal.gov>

derp, thanks! I sent the wrong diff....

On 06/10/2014 09:27 AM, Mike McLean wrote:
> typo
>
>
> On Tue, Jun 10, 2014 at 10:12 AM, Karanbir Singh <mail-lists at karan.org 
> <mailto:mail-lists at karan.org>> wrote:
>
>     Applied, pushed, thanks
>     https://git.centos.org/summary/centos-git-common
>
>
>     On 06/10/2014 03:08 PM, Pat Riehecky wrote:
>     > From: Pat Riehecky <riehecky at fnal.gov <mailto:riehecky at fnal.gov>>
>     >
>     > ---
>     >  return_disttag.sh |   71
>     +++++++++++++++++++++++++++++++++++++++++++++++++++++
>     >  1 files changed, 71 insertions(+), 0 deletions(-)
>     >  create mode 100755 return_disttag.sh
>     >
>     > diff --git a/return_disttag.sh b/return_disttag.sh
>     > new file mode 100755
>     > index 0000000..cc4829c
>     > --- /dev/null
>     > +++ b/return_disttag.sh
>     > @@ -0,0 +1,71 @@
>     > +#!/bin/bash -u
>     > +#
>     > +# Extracts what appears to be the value of %{dist} from the
>     commit message
>     > +#
>     > +# Might want to drop this in ~/bin/ and chmod u+x it
>     > +
>     >
>     +#####################################################################
>     > +usage() {
>     > +    echo ''           >&2
>     > +    echo "$0 [-hr]"           >&2
>     > +    echo ''           >&2
>     > +    echo ' -h: This help message'           >&2
>     > +    echo ' -r: Use the Redhat tag rather than centos tag' >&2
>     > +    echo ''           >&2
>     > +    echo '  Attempt to extract what appears to be the value of
>     %{dist}' >&2
>     > +    echo '  from the git.centos.org <http://git.centos.org>
>     commit message'       >&2
>     > +    exit 1
>     > +}
>     > +
>     > +
>     >
>     +#####################################################################
>     > +# setup args in the right order for making getopt evaluation
>     > +# nice and easy.  You'll need to read the manpages for more info
>     > +args=$(getopt -o hr -- "$@")
>     > +if [[ $? -ne 0 ]]; then
>     > +    usage
>     > +fi
>     > +eval set -- "$args"
>     > +
>     > +RHELTAG=0
>     > +for arg in $@; do
>     > +    case $1 in
>     > +        -- )
>     > +            # end of getopt args, shift off the -- and get out
>     of the loop
>     > +            shift
>     > +            break 2
>     > +           ;;
>     > +         -r )
>     > +            # skip any package with 'centos' in the dist area
>     > +            RHELTAG=1
>     > +           ;;
>     > +         -h )
>     > +            # get help
>     > +            usage
>     > +           ;;
>     > +    esac
>     > +done
>     > +
>     > +packagename=$(basename `pwd`)
>     > +metadata=.${packagename}.metadata
>     > +
>     > +if [[ ! -e ${metadata} ]] ||  [[ ! -d .git ]] || [[ ! -d
>     SOURCES ]]; then
>     > +    echo 'You need to run this from inside a sources git repo'
>     > +    exit 1
>     > +fi
>     > +
>     > +msg=$(git log --pretty=format:"%s")
>     > +pkg=$(echo ${msg} | cut -d' ' -f2)
>     > +
>     > +if [[ ${RHELTAG} -eq 0 ]]; then
>     > +    thispkg=(echo ${pkg} | head -1)
>     > +elif [[ ${RHELTAG} -eq 1 ]]; then
>     > +    thispkg=(echo ${pkg} grep -v centos | head -1)
>     > +else
>     > +    echo 'Something went terribly wrong'
>     > +    exit 1
>     > +fi
>     > +
>     > +tag=$(echo ${thispkg} | awk -F"-" '{print $NF}' | tr '.'
>     '\012'| grep -e el[[:digit:]])
>     > +
>     > +echo ${tag}
>     >
>
>
>     --
>     Karanbir Singh
>     +44-207-0999389 <tel:%2B44-207-0999389> | http://www.karan.org/ |
>     twitter.com/kbsingh <http://twitter.com/kbsingh>
>     GnuPG Key : http://www.karan.org/publickey.asc
>     _______________________________________________
>     CentOS-devel mailing list
>     CentOS-devel at centos.org <mailto:CentOS-devel at centos.org>
>     http://lists.centos.org/mailman/listinfo/centos-devel
>
>
>
>
> _______________________________________________
> CentOS-devel mailing list
> CentOS-devel at centos.org
> http://lists.centos.org/mailman/listinfo/centos-devel


-- 
Pat Riehecky

Scientific Linux developer
http://www.scientificlinux.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.centos.org/pipermail/centos-devel/attachments/20140610/627aa9ad/attachment-0007.html>