Last active
February 12, 2018 11:31
-
-
Save thmo/cd9314ceaf84828f5bd2a7c35742e9e4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# | |
# Show nvr for all remote branches | |
# | |
# Author: Thomas Moschny <[email protected]> | |
# | |
do_ref() { | |
local ref=$1 | |
local prettyref=${ref##refs/remotes/origin/} | |
local tmp=${tmpdir}/${prettyref} | |
mkdir -p "${tmp}" | |
git archive "$ref" | tar -x -C "${tmp}" | |
for s in ${tmp}/*.spec ; do | |
nvr=($(rpm -q --specfile \ | |
--define "_sourcedir ${tmp}" \ | |
--define 'dist %{nil}' \ | |
--define 'python3_pkgversion 3' \ | |
--qf '[%{name}-%{version}-%{release} ]' "${s}")) | |
printf "%6s: %s\n" "${prettyref}" "${nvr[0]}" | |
break | |
done | |
} | |
trap 'rm -rf "${tmpdir}"' EXIT | |
tmpdir=$(mktemp -d) | |
while read sha type ref ; do | |
do_ref $ref | |
done < <(git for-each-ref refs/remotes/origin/{f26,f27,f28,f29,master,el6,epel7}) | | |
sort -bV |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment