Commit 3e9f52b3 authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmgs: improve update git repo from upstream

parent 412d08f5
...@@ -443,9 +443,13 @@ fi ...@@ -443,9 +443,13 @@ fi
test -z "$LISTNAMES" && print_error test -z "$LISTNAMES" && print_error
if [ -z "$GSSETVERSION" ] && $EPMCMD assure gear-rules-verify perl-Gear-Rules ; then if [ -z "$GSSETVERSION" ] && $EPMCMD assure gear-rules-verify perl-Gear-Rules ; then
# need for gear-rules-verify
# TODO: why we have changed dir to a spec placement before?
cd $(get_root_git_dir)
docmd gear-rules-verify docmd gear-rules-verify
gear-rules-verify 2>&1 | grep -q "gear-rules-verify should be run in clean repository" && warning "gear-rules-verify should be run in clean repository" if gear-rules-verify 2>&1 | grep -q "gear-rules-verify should be run in clean repository" ; then
if gear-rules-verify | grep -q "Ready for tarball update" ; then warning "gear-rules-verify should be run in clean repository, skipping"
elif gear-rules-verify | grep -q "Ready for tarball update" ; then
#[ -n "$GSSETVERSION" ] && warning "we will ignore version and update to the latest version from watch file" #[ -n "$GSSETVERSION" ] && warning "we will ignore version and update to the latest version from watch file"
# TODO: rpm-uscan 0.20.2.17.11 or above # TODO: rpm-uscan 0.20.2.17.11 or above
$EPMCMD assure rpm-uscan $EPMCMD assure rpm-uscan
...@@ -469,6 +473,7 @@ if [ -z "$GSSETVERSION" ] && $EPMCMD assure gear-rules-verify perl-Gear-Rules ; ...@@ -469,6 +473,7 @@ if [ -z "$GSSETVERSION" ] && $EPMCMD assure gear-rules-verify perl-Gear-Rules ;
else else
warning "skipping" warning "skipping"
fi fi
cd - >/dev/null
fi fi
[ -z "$GSSETRELEASE" ] || GSSKIPADDCHANGELOG=1 [ -z "$GSSETRELEASE" ] || GSSKIPADDCHANGELOG=1
...@@ -555,11 +560,16 @@ do ...@@ -555,11 +560,16 @@ do
if ! rhas "$GETSOURCE" "ps?://" ; then if ! rhas "$GETSOURCE" "ps?://" ; then
if [ "$SN" != "Source" ] && [ "$SN" != "Source0" ] ; then if [ "$SN" != "Source" ] && [ "$SN" != "Source0" ] ; then
info "No URL. Skipping $GETSOURCE downloading" info "No URL. Skipping $GETSOURCE downloading"
continue
else else
# only for main source # only for main source
warning "$SN $GETSOURCE has no URL. Skipping... " if [ -s $(get_root_git_dir)/.gear/upstream/remotes ] ; then
warning "$SN $GETSOURCE has no URL. We will try use existed .gear/upstream/remotes"
else
warning "$SN $GETSOURCE has no URL. Skipping... "
continue
fi
fi fi
continue
else else
download_any_tarball "$GETSOURCE" "$FTB" download_any_tarball "$GETSOURCE" "$FTB"
DOWNLOADSOME=1 DOWNLOADSOME=1
...@@ -584,21 +594,22 @@ do ...@@ -584,21 +594,22 @@ do
echo "Run svn rebase from $GETSOURCESVN" echo "Run svn rebase from $GETSOURCESVN"
docmd git svn rebase docmd git svn rebase
DOWNLOADSOME=1 DOWNLOADSOME=1
elif [ -n "${GETSOURCEGIT}" ] ; then elif [ -n "${GETSOURCEGIT}" ] || [ -s $(get_root_git_dir)/.gear/upstream/remotes ] ; then
if [ -s $(get_root_git_dir)/.gear/upstream/remotes ] ; then if [ -s $(get_root_git_dir)/.gear/upstream/remotes ] ; then
docmd gear-remotes-restore docmd gear-remotes-restore
else
echog "Try to fetch ${GETSOURCEGIT} for $spec"
#TODO error if incompatible
docmd git remote add upstream $GETSOURCEGIT
fi fi
echog "Try to fetch ${GETSOURCEGIT} for $spec" docmd git fetch --tags upstream
#TODO check upstream
#TODO error if incompatible
docmd git remote add upstream $GETSOURCEGIT
docmd git fetch --tags upstream || fatal
#TODO check tag: v%version or %version
if [ -z "$GSSETVERSION" ] ; then if [ -z "$GSSETVERSION" ] ; then
warning "Empty new version variable" warning "Empty new version variable"
elif [ "$GSSETVERSION" = "HEAD" ] ; then elif [ "$GSSETVERSION" = "HEAD" ] ; then
docmd git merge upstream/master docmd git merge upstream/master
else else
# check for GSSETVERSION tag
# some heuristics # some heuristics
rc=1 rc=1
alternate_tag1="$(echo "v$GSSETVERSION" | sed -e "s|\.|-|g")" alternate_tag1="$(echo "v$GSSETVERSION" | sed -e "s|\.|-|g")"
......
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