Commit 0599ff37 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add get_repo_name() and use it

parent f91e6d02
......@@ -44,13 +44,13 @@ mygetopts()
# one param
if [ -z "$2" ] ; then
[ "$1" = "show" ] || fatal "See $0 --help for correct options"
PROJECTNAME=$(get_gear_name)
PROJECTNAME=$(get_repo_name)
COMMAND=$1
# two param: add newuser or package show
elif [ -z "$3" ] ; then
if [ "$1" = "add" ] ; then
# add newuser
PROJECTNAME=$(get_gear_name)
PROJECTNAME=$(get_repo_name)
COMMAND=$1
PARAM=$2
else
......
......@@ -225,12 +225,14 @@ set_binaryrepo $MENV
# If we build from gear repo, run task
if [ -n "$UPLOADNOW" ] && is_gear $SPECDIR ; then
[ -n "$VERBOSE" ] && echo "Run with gear repo..."
echo "Prepare to publish to $GIRARHOST..."
# check release
build_rpms_name "$LISTNAMES"
# FIXME: hack: get project name from package name
PROJECTNAME=$(echo $BASENAME | filter_gear_name)
#PROJECTNAME=$(get_gear_name)
pkg_release_check
pkg_release_check $RELEASE
PROJECTNAME=$(get_repo_name)
check_gear_and_tag || fatal "Can't make tag"
TAG=$(get_last_tag)
......
......@@ -258,9 +258,12 @@ filter_gear_name()
# FIXME: use in rpmbs, fix for package name from spec
get_gear_name()
{
local gn
local gitdir=$(get_root_git_dir)
[ -n "$gitdir" ] || return
basename "$gitdir" | filter_gear_name
gn=$(basename "$gitdir" | filter_gear_name)
echo "$gn"
[ -n "$gn" ]
}
......
......@@ -31,6 +31,31 @@ get_current_branch()
git branch | grep '^\*' | sed 's/^..//' | tr -d "\n"
}
# get name from current remote repository name
get_remote_repo_name()
{
local branch remote url basename
branch=$(get_current_branch)
[ -n "$branch" ] || return
remote=$(git config --get branch.$branch.remote)
url=$(git config --get remote.$remote.url)
[ -n "$url" ] || return
basename=$(basename "$url" .git)
echo "$basename"
[ -n "$basename" ]
}
get_repo_name()
{
# try use remote repo name firstly
get_remote_repo_name && return
# use repo dir name in other way
get_gear_name && return
# get name from spec
#build_rpms_name "$LISTNAMES"
#PROJECTNAME=$(echo $BASENAME | filter_gear_name)
}
get_remote_git_list()
{
local i
......
......@@ -11,3 +11,12 @@ is_gear && echo "IS GEAR" || echo "IS NOT GEAR"
echo "test gear for root_git_dir"
is_gear $(get_root_git_dir) && echo "IS GEAR" || echo "IS NOT GEAR"
echo
echo -n "get_repo_name: "
get_repo_name
echo -n "get_gear_name: "
get_gear_name
echo -n "get_remote_repo_name: "
get_remote_repo_name
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