From 69559e626a5f4f4e2564b66db7ce3454bc343a12 Mon Sep 17 00:00:00 2001 From: Hasan Wan Date: Wed, 18 Jan 2012 11:29:52 +0800 Subject: [PATCH] fix bug# PTINF-43, get project name failure if not in remote.origin --- data/build.sh | 21 ++++++++++++++------- data/import.sh | 17 ++++++++++------- data/packaging.sh | 20 ++++++++++++++------ 3 files changed, 38 insertions(+), 20 deletions(-) diff --git a/data/build.sh b/data/build.sh index 7873f9b..35cc068 100644 --- a/data/build.sh +++ b/data/build.sh @@ -47,15 +47,22 @@ git branch -a|sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/'|grep "release" > /dev/null 2 git status|grep "modified">/dev/null 2>&1 &&echo "Warning: Uncommited local changes found. Sending local changes to build remotely. " -# Get project name from git url -git_url=`git config remote.origin.url` -echo $git_url|grep ^ssh > /dev/null -if [ $? == 0 ]; then - prj_name=`basename $git_url` -else - prj_name=$(echo $git_url|cut -d ':' -f2) +# If project name is set in gitbuildsystem.project, use it, else use the default remote.origin.url +prj_name=$(git config gitbuildsystem.project) +if [ -z "$prj_name" ]; then + + git_url=`git config remote.origin.url` + echo $git_url|grep ^ssh > /dev/null + if [ $? == 0 ]; then + prj_name=$(echo $git_url|sed 's/ssh\:.*\:[0-9]*\/\(.*\)/\1/') + else + prj_name=$(echo $git_url|cut -d ':' -f2) + fi + fi +[ -z "$prj_name" ] && die "Can't find the project name, you might need 'git config --add gitbuildsystem.project ' to set it." + # tar the local changes tar jcf package.tar.bz2 `git ls-files` diff --git a/data/import.sh b/data/import.sh index 0680747..22e0ba7 100644 --- a/data/import.sh +++ b/data/import.sh @@ -60,13 +60,16 @@ passwdx=$(gbs cfg passwdx) source_tarball_name=$(basename $source_tarball) if [ -z "$target_project" ]; then -# Get project name from git url - git_url=`git config remote.origin.url` - echo $git_url|grep ^ssh > /dev/null - if [ $? == 0 ]; then - target_project=`basename $git_url` - else - target_project=$(echo $git_url|cut -d ':' -f2) + # If project name is set in gitbuildsystem.project, use it, else use the default remote.origin.url + target_project=$(git config gitbuildsystem.project) + if [ -z "$target_project" ]; then + git_url=`git config remote.origin.url` + echo $git_url|grep ^ssh > /dev/null + if [ $? == 0 ]; then + target_project=$(echo $git_url|sed 's/ssh\:.*\:[0-9]*\/\(.*\)/\1/') + else + target_project=$(echo $git_url|cut -d ':' -f2) + fi fi fi diff --git a/data/packaging.sh b/data/packaging.sh index f999ebf..5fc431c 100644 --- a/data/packaging.sh +++ b/data/packaging.sh @@ -320,14 +320,22 @@ user=$(gbs cfg user) passwd=$(gbs cfg passwd) HUDSON_SERVER=$(gbs cfg src_server) -git_url=`git config remote.origin.url` -echo $git_url|grep ^ssh > /dev/null -if [ $? == 0 ]; then - project=`basename $git_url` -else - project=$(echo $git_url|cut -d ':' -f2) +# If project name is set in gitbuildsystem.project, use it, else use the default remote.origin.url +project=$(git config gitbuildsystem.project) +if [ -z "$project" ]; then + + git_url=`git config remote.origin.url` + echo $git_url|grep ^ssh > /dev/null + if [ $? == 0 ]; then + project=$(echo $git_url|sed 's/ssh\:.*\:[0-9]*\/\(.*\)/\1/') + else + project=$(echo $git_url|cut -d ':' -f2) + fi + fi +[ -z "$project" ] && die "Can't find the project name, you might need 'git config --add gitbuildsystem.project ' to set it." + info_msg "Packaging for major release ${tag}" srctar_md5sum="" get_srctar_md5sum $version $project $commitid -- 2.7.4