Commit 7853a972 authored by Vitaly Lipatov's avatar Vitaly Lipatov

fix binary repo using (-b handling)

parent d4060c66
...@@ -54,6 +54,8 @@ LISTRPMARGS=$@ ...@@ -54,6 +54,8 @@ LISTRPMARGS=$@
parse_cmd_pre "$@" parse_cmd_pre "$@"
mygetopts $LISTARGS mygetopts $LISTARGS
# see functions/alt:set_binaryrepo() for BINARYREPONAME
set_binaryrepo $MENV
RESULT=0 RESULT=0
......
...@@ -39,17 +39,18 @@ phelp() ...@@ -39,17 +39,18 @@ phelp()
echog " -q quiet" echog " -q quiet"
echo echo
echog "Examples:" echog "Examples:"
echog " $ rpmbph -b p6 -n -u - backport to p6 and ask to build it" echog " $ rpmbph -b $EXAMPLEALTDISTRVERSION -n -u - backport to $EXAMPLEALTDISTRVERSION and ask to build it"
# echog "Set ROOTDIR variable for backport to the other system" # echog "Set ROOTDIR variable for backport to the other system"
# echog " -m - send result via e-mail" # echog " -m - send result via e-mail"
} }
# FIXME: has difference between # FIXME: has difference between
UPLOADARG=
while getopts :hnvqb: opt; do while getopts :hnvqb: opt; do
case $opt in case $opt in
h) phelp; exit 0 ;; h) phelp; exit 0 ;;
n) NOBUILD=1 ;; n) NOBUILD=1 ;;
#u) UPLOADARG="-$opt" ;; u) UPLOADARG="-$opt" ;;
v) VERBOSE=1 ;; v) VERBOSE=1 ;;
b) BINARYREPONAME=$OPTARG ;; b) BINARYREPONAME=$OPTARG ;;
q) QUIET=1 ;; q) QUIET=1 ;;
...@@ -64,7 +65,7 @@ if [ $# -gt 0 ]; then ...@@ -64,7 +65,7 @@ if [ $# -gt 0 ]; then
fi fi
# pass other options to RPM (exclude -v): # pass other options to RPM (exclude -v):
LISTRPMARGS=$(drop_args "$*" v) LISTRPMARGS="$UPLOADARG $(drop_args "$*" v n q)"
} }
set_girar_host $1 && shift set_girar_host $1 && shift
...@@ -72,19 +73,16 @@ set_girar_host $1 && shift ...@@ -72,19 +73,16 @@ set_girar_host $1 && shift
parse_cmd_pre_spec "$@" parse_cmd_pre_spec "$@"
mygetopts $LISTARGS mygetopts $LISTARGS
# see functions/alt:set_binaryrepo() for BINARYREPONAME
set_binaryrepo $MENV
test -z "$LISTNAMES" && fatal "file not found in '$@'" test -z "$LISTNAMES" && fatal "file not found in '$@'"
if [ "$PKGVENDOR" = "alt" ] ; then if [ "$PKGVENDOR" = "alt" ] ; then
# FIXME: where we was detected MENV?
MDISTR=$MENV MDISTR=$MENV
if [ -n "$BINARYREPONAME" ] ; then
MDISTR=$(get_altdistr_mod $BINARYREPONAME)
else
BINARYREPONAME=$(get_altdistr_version $MDISTR)
fi
[ "$MDISTR" = "SS" ] && fatal "It makes no sense to backport to Sisyphus (You need to try with -b $EXAMPLEALTDISTRVERSION)." [ "$MDISTR" = "SS" ] && fatal "It makes no sense to backport to Sisyphus (You need to try with -b $EXAMPLEALTDISTRVERSION)."
# override by defined target version # override by defined target version
DISTRVERSION=$(get_altdistr_version $MDISTR) DISTRVERSION=$BINARYREPO
else else
MDISTR=LOCAL MDISTR=LOCAL
fi fi
...@@ -104,7 +102,7 @@ if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then ...@@ -104,7 +102,7 @@ if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then
[ -f "$LISTNAMES" ] || fatal "Run with one spec inside gear repo" [ -f "$LISTNAMES" ] || fatal "Run with one spec inside gear repo"
# set branch name # set branch name
USEBRANCH=$BINARYREPONAME USEBRANCH=$BINARYREPO
SPEC=$LISTNAMES SPEC=$LISTNAMES
BPSPEC=$SPEC.$USEBRANCH BPSPEC=$SPEC.$USEBRANCH
...@@ -138,7 +136,7 @@ if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then ...@@ -138,7 +136,7 @@ if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then
# Only one spec supported # Only one spec supported
cp -f $LISTNAMES $BPSPEC || fatal cp -f $LISTNAMES $BPSPEC || fatal
docmd $ETERBUILDBIN/rpmbps -b $BINARYREPONAME $BPSPEC || fatal docmd $ETERBUILDBIN/rpmbps -b $BINARYREPO $BPSPEC || fatal
docmd git checkout $USEBRANCH || fatal "Can't checkout branch $USEBRANCH. Use $BPSPEC manually or remove it." docmd git checkout $USEBRANCH || fatal "Can't checkout branch $USEBRANCH. Use $BPSPEC manually or remove it."
# TODO: check result message for merge? # TODO: check result message for merge?
...@@ -155,7 +153,7 @@ if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then ...@@ -155,7 +153,7 @@ if [ "$PKGVENDOR" = "alt" ] && is_gear $SPECDIR ; then
#git checkout $CURBRANCH #git checkout $CURBRANCH
fatal "Commit error. You are still in $CURBRANCH branch with modified and uncommitted spec file." fatal "Commit error. You are still in $CURBRANCH branch with modified and uncommitted spec file."
fi fi
docmd $BUILDCOMMAND $LISTRPMARGS $UPLOADARG $SPEC || { git checkout $CURBRANCH ; fatal "Can't build" ; } docmd $BUILDCOMMAND $MENVARG $LISTRPMARGS $UPLOADARG $SPEC || { git checkout $CURBRANCH ; fatal "Can't build" ; }
docmd git checkout $CURBRANCH docmd git checkout $CURBRANCH
exit $? exit $?
fi fi
...@@ -179,7 +177,7 @@ for i in $LISTBUILT ; do ...@@ -179,7 +177,7 @@ for i in $LISTBUILT ; do
SPECNAME=$RPMTOPDIR/SPECS/$(spec_by_srpm $i) SPECNAME=$RPMTOPDIR/SPECS/$(spec_by_srpm $i)
test -f "$SPECNAME" || fatal "Spec $SPECNAME is not found" test -f "$SPECNAME" || fatal "Spec $SPECNAME is not found"
docmd $ETERBUILDBIN/rpmbps -b $BINARYREPONAME $SPECNAME docmd $ETERBUILDBIN/rpmbps -b $BINARYREPO $SPECNAME
docmd $BUILDCOMMAND $LISTRPMARGS $UPLOADARG $SPECNAME || fatal "Can't build" docmd $BUILDCOMMAND $LISTRPMARGS $UPLOADARG $SPECNAME || fatal "Can't build"
uni_rpmrm $SPECNAME || true uni_rpmrm $SPECNAME || true
......
...@@ -32,7 +32,7 @@ phelp() ...@@ -32,7 +32,7 @@ phelp()
# echog " -q quiet" # echog " -q quiet"
echo echo
echog "Examples:" echog "Examples:"
echog " $ rpmbps -b p6 - backport spec to p6 form" echog " $ rpmbps -b $EXAMPLEALTDISTRVERSION - backport spec to $EXAMPLEALTDISTRVERSION form"
} }
# FIXME: has difference between # FIXME: has difference between
...@@ -57,6 +57,8 @@ LISTRPMARGS=$(drop_args "$*" v) ...@@ -57,6 +57,8 @@ LISTRPMARGS=$(drop_args "$*" v)
parse_cmd_pre_spec "$@" parse_cmd_pre_spec "$@"
mygetopts $LISTARGS mygetopts $LISTARGS
# see functions/alt:set_binaryrepo() for BINARYREPONAME
set_binaryrepo $MENV
# TODO # TODO
SPECNAME="$LISTNAMES" SPECNAME="$LISTNAMES"
...@@ -64,10 +66,9 @@ test -f "$SPECNAME" || fatal "file '$SPECNAME' is not found" ...@@ -64,10 +66,9 @@ test -f "$SPECNAME" || fatal "file '$SPECNAME' is not found"
if [ "$PKGVENDOR" = "alt" ] ; then if [ "$PKGVENDOR" = "alt" ] ; then
MDISTR=$MENV MDISTR=$MENV
[ -n "$BINARYREPONAME" ] && MDISTR=$(get_altdistr_mod $BINARYREPONAME)
[ "$MDISTR" = "SS" ] && fatal "It makes no sense to backport to Sisyphus (You need to try with -b $EXAMPLEALTDISTRVERSION)." [ "$MDISTR" = "SS" ] && fatal "It makes no sense to backport to Sisyphus (You need to try with -b $EXAMPLEALTDISTRVERSION)."
# override by defined target version # override by defined target version
DISTRVERSION=$(get_altdistr_version $MDISTR) DISTRVERSION=$BINARYREPO
else else
# then ROOTDIR is used? # then ROOTDIR is used?
MDISTR=LOCAL MDISTR=LOCAL
......
...@@ -63,6 +63,8 @@ set_girar_host $1 && shift ...@@ -63,6 +63,8 @@ set_girar_host $1 && shift
parse_cmd_pre_spec "$@" parse_cmd_pre_spec "$@"
mygetopts $LISTARGS mygetopts $LISTARGS
# see functions/alt:set_binaryrepo() for BINARYREPONAME
set_binaryrepo $MENV
[ -n "$LISTNAMES" ] || fatal "Run with exists specs as arg" [ -n "$LISTNAMES" ] || fatal "Run with exists specs as arg"
...@@ -76,6 +78,8 @@ fi ...@@ -76,6 +78,8 @@ fi
# FIXME: не обрабатывает два пропускаемых вместе параметра # FIXME: не обрабатывает два пропускаемых вместе параметра
pack_src_rpm $COMMIT $(drop_args "$LISTRPMARGS" s u i c l f a A) pack_src_rpm $COMMIT $(drop_args "$LISTRPMARGS" s u i c l f a A)
# TODO: use gear --hasher directly, drop myhsh
if rhas "$LISTNAMES" spec ; then if rhas "$LISTNAMES" spec ; then
set_specdir $LISTNAMES set_specdir $LISTNAMES
fi fi
......
...@@ -65,10 +65,15 @@ set_binaryrepo() ...@@ -65,10 +65,15 @@ set_binaryrepo()
BINARYREPO="$BINARYREPONAME" BINARYREPO="$BINARYREPONAME"
MENV="$(get_altdistr_mod $BINARYREPO)" MENV="$(get_altdistr_mod $BINARYREPO)"
MENVARG="-$MENV" MENVARG="-$MENV"
# already was in parse_cmd_pre, but call in again for refill with updated $MENV # fill with updated $MENV
detect_target_env detect_target_env
return return
else
# parse MENV
detect_target_env
BINARYREPO=$(get_altdistr_version $MENV)
fi fi
test -z "$1" && return test -z "$1" && return
BINARYREPO="`get_altdistr_version $1`" BINARYREPO="`get_altdistr_version $1`"
......
...@@ -429,8 +429,6 @@ do ...@@ -429,8 +429,6 @@ do
done done
LISTNAMES=$(strip_spaces "$LISTNAMES") LISTNAMES=$(strip_spaces "$LISTNAMES")
LISTARGS=$(strip_spaces "$LISTARGS") LISTARGS=$(strip_spaces "$LISTARGS")
# parse MENV
detect_target_env
[ -n "$VERBOSE" ] && echo "LISTNAMES=$LISTNAMES LISTARGS=$LISTARGS" || : [ -n "$VERBOSE" ] && echo "LISTNAMES=$LISTNAMES LISTARGS=$LISTARGS" || :
} }
......
...@@ -56,6 +56,7 @@ EXAMPLEALTDISTRVERSION="p7" ...@@ -56,6 +56,7 @@ EXAMPLEALTDISTRVERSION="p7"
CURRENTBRANCHNAME="M70" CURRENTBRANCHNAME="M70"
# Build for Sisyphus by default # Build for Sisyphus by default
# TODO: REMOVE IT
MENV=SS MENV=SS
[ -n "$DEBUG" ] && HASHERARG="-v $HASHERARG" [ -n "$DEBUG" ] && HASHERARG="-v $HASHERARG"
......
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