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 ...@@ -6,10 +6,7 @@ load_mod git
test -r "$1" && fatal "Do not need any files in params" test -r "$1" && fatal "Do not need any files in params"
if is_girar_name $1 ; then set_girar_host $1 && shift
GIRARHOST=$1
shift
fi
mygetopts() mygetopts()
{ {
......
...@@ -310,10 +310,7 @@ fi ...@@ -310,10 +310,7 @@ fi
LISTRPMARGS=$(drop_args "$*" n v) LISTRPMARGS=$(drop_args "$*" n v)
} }
if is_girar_name $1 ; then set_girar_host $1 && shift
GIRARHOST=$1
shift
fi
parse_cmd_pre_spec "$@" parse_cmd_pre_spec "$@"
mygetopts $LISTARGS mygetopts $LISTARGS
......
...@@ -165,16 +165,7 @@ rpmbs_copying_built() ...@@ -165,16 +165,7 @@ rpmbs_copying_built()
fi fi
} }
if is_girar_name $1 ; then set_girar_host $1 && shift
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
parse_cmd_pre_spec "$@" parse_cmd_pre_spec "$@"
# quotes brokes option handling # quotes brokes option handling
......
...@@ -62,10 +62,7 @@ LISTRPMARGS=$@ ...@@ -62,10 +62,7 @@ LISTRPMARGS=$@
} }
############################# #############################
if is_girar_name $1 ; then set_girar_host $1 && shift
GIRARHOST=$1
shift
fi
parse_cmd_pre_spec "$@" parse_cmd_pre_spec "$@"
mygetopts $LISTARGS mygetopts $LISTARGS
......
...@@ -197,10 +197,7 @@ shift $((OPTIND - 1)) ...@@ -197,10 +197,7 @@ shift $((OPTIND - 1))
LISTRPMARGS=$@ LISTRPMARGS=$@
} }
if is_girar_name $1 ; then set_girar_host $1 && shift
GIRARHOST=$1
shift
fi
parse_cmd_pre "$@" parse_cmd_pre "$@"
mygetopts $LISTARGS mygetopts $LISTARGS
......
...@@ -18,10 +18,7 @@ if [ "$1" = "-r" ] ; then ...@@ -18,10 +18,7 @@ if [ "$1" = "-r" ] ; then
shift shift
fi fi
if is_girar_name $1 ; then set_girar_host $1 && shift
GIRARHOST=$1
shift
fi
SPEC=$1 SPEC=$1
VER=$2 VER=$2
......
...@@ -60,6 +60,23 @@ is_one_girar_name() ...@@ -60,6 +60,23 @@ is_one_girar_name()
[ -n "$RES" ] [ -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() _list_git_package()
{ {
while [ -n "$1" ] ; do 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