Skip to content

Instantly share code, notes, and snippets.

@thmo
Last active February 12, 2018 11:31
Show Gist options
  • Save thmo/cd9314ceaf84828f5bd2a7c35742e9e4 to your computer and use it in GitHub Desktop.
Save thmo/cd9314ceaf84828f5bd2a7c35742e9e4 to your computer and use it in GitHub Desktop.
#! /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