From: Pat Riehecky riehecky@fnal.gov
--- into_srpm.sh | 32 ++++++++++++++++++++------------ 1 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/into_srpm.sh b/into_srpm.sh index 6ff2260..8c2434c 100755 --- a/into_srpm.sh +++ b/into_srpm.sh @@ -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