Commit 0d8ffd58 authored by Vitaly Lipatov's avatar Vitaly Lipatov

introduce set_girar_host and use it

parent 1ba38790
......@@ -6,10 +6,7 @@ load_mod git
test -r "$1" && fatal "Do not need any files in params"
if is_girar_name $1 ; then
GIRARHOST=$1
shift
fi
set_girar_host $1 && shift
mygetopts()
{
......
......@@ -310,10 +310,7 @@ fi
LISTRPMARGS=$(drop_args "$*" n v)
}
if is_girar_name $1 ; then
GIRARHOST=$1
shift
fi
set_girar_host $1 && shift
parse_cmd_pre_spec "$@"
mygetopts $LISTARGS
......
......@@ -165,16 +165,7 @@ rpmbs_copying_built()
fi
}
if is_girar_name $1 ; then
GIRARHOST=$1
shift
else
REMOTELIST="$(get_remote_git_list)"
if is_one_girar_name "$REMOTELIST" ; then
# use one target if it one
GIRARHOST="$REMOTELIST"
fi
fi
set_girar_host $1 && shift
parse_cmd_pre_spec "$@"
# quotes brokes option handling
......
......@@ -62,10 +62,7 @@ LISTRPMARGS=$@
}
#############################
if is_girar_name $1 ; then
GIRARHOST=$1
shift
fi
set_girar_host $1 && shift
parse_cmd_pre_spec "$@"
mygetopts $LISTARGS
......
......@@ -197,10 +197,7 @@ shift $((OPTIND - 1))
LISTRPMARGS=$@
}
if is_girar_name $1 ; then
GIRARHOST=$1
shift
fi
set_girar_host $1 && shift
parse_cmd_pre "$@"
mygetopts $LISTARGS
......
......@@ -18,10 +18,7 @@ if [ "$1" = "-r" ] ; then
shift
fi
if is_girar_name $1 ; then
GIRARHOST=$1
shift
fi
set_girar_host $1 && shift
SPEC=$1
VER=$2
......
......@@ -60,6 +60,23 @@ is_one_girar_name()
[ -n "$RES" ]
}
# Try autodetect GIRARHOST. Return true, if get it from arg (need for shift args)
set_girar_host()
{
if is_girar_name "$1" ; then
GIRARHOST="$1"
return 0
fi
# Try get from remote list, if unique record there
REMOTELIST="$(get_remote_git_list)"
if is_one_girar_name "$REMOTELIST" ; then
# use one target if it one
GIRARHOST="$REMOTELIST"
fi
return 1
}
_list_git_package()
{
while [ -n "$1" ] ; do
......
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