Added option to set explicit %dist per request

This commit is contained in:
Pat Riehecky 2014-07-10 14:12:38 -05:00 committed by Johnny Hughes
parent db2f8e733d
commit 733e0e2cd7

View file

@ -13,7 +13,7 @@
#####################################################################
usage() {
echo '' >&2
echo "$0 [-htq] [-b branch] [-c shasum]" >&2
echo "$0 [-hqts] [-d dist] [-b branch] [-c shasum]" >&2
echo '' >&2
echo 'You need to run this from inside a sources git repo' >&2
echo '' >&2
@ -22,6 +22,8 @@ usage() {
echo ' -t: Set srpm timestamp to commit date' >&2
echo ' -s: Allow building as a SCL style package' >&2
echo '' >&2
echo ' -d: Use this %{dist} instead of automatic value'>&2
echo '' >&2
echo ' -b: specify a branch to examine' >&2
echo " defaults to repo's current branch" >&2
echo " NOTE: your repo will be set to this branch">&2
@ -32,6 +34,8 @@ usage() {
echo '' >&2
echo " $0" >&2
echo " $0 -b c7 -t" >&2
echo " $0 -b c7 -s" >&2
echo " $0 -b c7 -d yourdisthere" >&2
echo " $0 -b remotes/origin/c7" >&2
echo " $0 -c 865ae5909b2b5d5fb37971b7ad7960f1fd5a5ffa" >&2
echo " $0 -b c7 -c 865ae5909b2b5d5fb37971b7ad7960f1fd5a5ffa" >&2
@ -45,13 +49,14 @@ KEEPTIMESTAMP=0
ALLOWSCL=0
COMMITHASH=""
BRANCH=""
DIST=''
#####################################################################
# setup args in the right order for making getopt evaluation
# nice and easy. You'll need to read the manpages for more info
# utilizing 'while' construct rather than 'for arg' to avoid unnecessary
# shifting of program args
args=$(getopt -o htsqb:c: -- "$@")
args=$(getopt -o htsqb:c:d: -- "$@")
eval set -- "$args"
while [[ 0 -eq 0 ]]; do
@ -76,6 +81,11 @@ while [[ 0 -eq 0 ]]; do
ALLOWSCL=1
shift
;;
-d )
# Set %{dist} to this instead the automatic value
DIST=$2
shift
;;
-c )
# Use this commit id
COMMITHASH=$2
@ -118,12 +128,6 @@ if [[ $? -ne 0 ]]; then
exit 1
fi
which get_sources.sh >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo 'You need get_sources.sh from centos-git-common in PATH' >&2
exit 1
fi
which show_possible_srpms.sh >/dev/null 2>&1
if [[ $? -ne 0 ]]; then
echo 'You need show_possible_srpms.sh from centos-git-common in PATH' >&2
@ -180,10 +184,14 @@ fi
# build our rpmopts list
RPMOPTS="-bs --nodeps"
if [[ ${QUIET} -eq 1 ]]; then
DIST=$(return_disttag.sh -q)
else
DIST=$(return_disttag.sh)
# determine automatically unless we've got one set
if [[ "x${DIST}" == 'x' ]]; then
if [[ ${QUIET} -eq 1 ]]; then
DIST=$(return_disttag.sh -q)
else
DIST=$(return_disttag.sh)
fi
fi
# put it all together