Commit b31bad93 authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmbs: rewrite check_gear_and_tag with is_last_commit_tag

parent 10e1c2a2
#!/bin/bash #!/bin/bash
# (c) Etersoft 2003-2010 # (c) Etersoft 2003-2012
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>, 2012
# Public domain # Public domain
# #
# BS - build source # BS - build source
...@@ -99,43 +99,49 @@ LISTRPMARGS=$@ ...@@ -99,43 +99,49 @@ LISTRPMARGS=$@
} }
# create tag according to package release # create tag according to package release
# used: SPECDIR, LISTNAMES, FORCE
check_gear_and_tag() check_gear_and_tag()
{ {
local RESULT=0 local RESULT=0
local GEARCTAG=gear-create-tag local GEARCTAG=gear-create-tag
local TAG="$1"
# set SPECDIR from LISTNAMES if empty
[ -n "$SPECDIR" ] || set_specdir $LISTNAMES
# do check only on gear repo
is_gear $SPECDIR || return 0
if [ -z "$FORCE" ] && is_last_commit_tag $TAG ; then
echo "Tag $TAG already exists for the last commit"
return 0
fi
test -n "$TAG" && echo "Create $TAG tag..."
# FIXME: uncomment use-agent in ~/.gnupg/gpg.conf, but with ssh access to build server I got # FIXME: uncomment use-agent in ~/.gnupg/gpg.conf, but with ssh access to build server I got
# gpg: problem with the agent - disabling agent use # gpg: problem with the agent - disabling agent use
# gpg: Invalid passphrase; please try again ... # gpg: Invalid passphrase; please try again ...
# needed correct user.name/user.email for get GPG id
# gpg tries to use the agent but will fallback to the regular mode # gpg tries to use the agent but will fallback to the regular mode
# if there is a problem connecting to the agent. # if there is a problem connecting to the agent.
# GPG_AGENT_INFO= # GPG_AGENT_INFO=
# set SPECDIR from LISTNAMES if empty [ -n "$FORCE" ] && echo "Force create $TAG tag..." || echo "Create $TAG tag..."
[ -n "$SPECDIR" ] || set_specdir $LISTNAMES
cd $SPECDIR >/dev/null
if is_gear $SPECDIR ; then # default: <VERSION>-<RELEASE>
# needed correct user.name/user.email for get GPG id docmd $GEARCTAG $FORCE || RESULT=1
cd $SPECDIR >/dev/null if [ "$RESULT" = 1 ] ; then
# default: <VERSION>-<RELEASE> if $GEARCTAG $FORCE 2>&1 | grep -q "Too many specfiles found"; then
docmd $GEARCTAG $FORCE || RESULT=1 docmd $GEARCTAG $FORCE -r .gear/$(readlink .gear/rules) && RESULT=0
# try direct set rule file elif $GEARCTAG $FORCE 2>&1 | grep -q "already exists"; then
# FIXME: always use for gear repo path to rule file echog "Note! Tag unchanged! Use -f key for override tag"
# Note: gear-create-tag can't use links, hack with readlink RESULT=1
# TODO: skip notification if tag still at last commit
if [ "$RESULT" = 1 ] ; then
if $GEARCTAG $FORCE 2>&1 | grep -q "Too many specfiles found"; then
docmd $GEARCTAG $FORCE -r .gear/$(readlink .gear/rules) && RESULT=0
elif $GEARCTAG $FORCE 2>&1 | grep -q "already exists"; then
echog "Note! Tag unchanged! Use -f key for override tag"
RESULT=0
fi
fi fi
test -z "$TAG" || docmd git tag -v "$TAG" || fatal "Tag $TAG is missed in repo"
cd - >/dev/null
fi fi
test -z "$TAG" || docmd git tag -v "$TAG" || fatal "Tag $TAG still missed in the repo"
cd - >/dev/null
return $RESULT return $RESULT
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment