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