correctly arrange $1=repo and $2=org in all places

This commit is contained in:
Trevor Batley 2023-06-06 19:23:05 +10:00
parent 96094332ef
commit dc0ed1b79d

View File

@ -30,7 +30,7 @@ while read -r line || [[ -n "$line" ]]; do
done < "$inifilename" done < "$inifilename"
if [[ -z $1 && -z $2 ]] ; then if [[ -z $1 && -z $2 ]] ; then
echo "get-repo-and-build.sh <organisation> <reponame> [<local>]" echo "get-repo-and-build.sh <reponame> <organisation> [<local>]"
exit 0 exit 0
fi fi
@ -49,8 +49,8 @@ if [ $3 ] ; then
ACCESSTOKEN=${local_GITEAACCESSTOKEN} ACCESSTOKEN=${local_GITEAACCESSTOKEN}
fi fi
fi fi
ORG_NAME="$1" ORG_NAME="$2"
REPO_NAME="$2" REPO_NAME="$1"
if [[ $smegit_WORKDIR == ~* ]] ; then if [[ $smegit_WORKDIR == ~* ]] ; then
# relative to users home dir # relative to users home dir
WORKDIR=$(echo ~)${smegit_WORKDIR:1} WORKDIR=$(echo ~)${smegit_WORKDIR:1}
@ -78,7 +78,7 @@ if [ ! -e $GITFiles/common ]; then
cd $GITFiles cd $GITFiles
git clone "${smegit_COMMONREPO}" git clone "${smegit_COMMONREPO}"
if [ ! -e $GITFiles/common ]; then if [ ! -e $GITFiles/common ]; then
echo "ERROR*******No Common Repo found - package $1" echo "ERROR*******No Common Repo found - package $REPO_NAME"
exit 1 exit 1
fi fi
else else
@ -93,10 +93,10 @@ chmod +x $GITFiles/common/make-archive.sh
# See if repo exits in git # See if repo exits in git
RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME") RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME")
if [ "$RESPONSE" == "200" ]; then if [ "$RESPONSE" == "200" ]; then
if [ $DEBUG ] ; then echo "Repository for $1/$2 exists!" ; fi if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME exists!" ; fi
else else
if [ $DEBUG ] ; then echo "Repository for $1/$2 does not exist" ; fi if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME does not exist" ; fi
logname="git-cvs2git-create-$2-$1-$(date +'%FT%H%M').log" logname="git-cvs2git-create-$ORG_NAME-$REPO_NAME-$(date +'%FT%H%M').log"
while true; do while true; do
read -p "Do you wish to run git-cvs2git?(y/n) " yn read -p "Do you wish to run git-cvs2git?(y/n) " yn
case $yn in case $yn in
@ -108,9 +108,9 @@ else
# And check it is now there # And check it is now there
RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME") RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME")
if [ "$RESPONSE" == "200" ]; then if [ "$RESPONSE" == "200" ]; then
if [ $DEBUG ] ; then echo "Repository for $1/$2 created sucessfully!" ; fi if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME created sucessfully!" ; fi
else else
echo "git-cvs2git.sh was unable to create $1/$2 sucessfully" echo "git-cvs2git.sh was unable to create $ORG_NAME/$REPO_NAME sucessfully"
exit 1 exit 1
fi fi
fi fi
@ -135,13 +135,13 @@ if [[ ! -d $REPO_NAME ]] ; then
fi fi
cd $GITFiles/$REPO_NAME cd $GITFiles/$REPO_NAME
# and run mockbuild # and run mockbuild
logname="mockbuild-$2-$1-$(date +'%FT%H%M').log" logname="mockbuild-$ORG_NAME-$REPO_NAME-$(date +'%FT%H%M').log"
if make mockbuild 2>&1 > $logname ; then if make mockbuild 2>&1 > $logname ; then
echo "Looks like mockbuild worked for $1/$2" echo "Looks like mockbuild worked for $ORG_NAME/$REPO_NAME"
echo "$(date +'%FT%H%M') Mockbuild worked for $1/$2 " >> $GITFiles/mockbuilds.log echo "$(date +'%FT%H%M') Mockbuild worked for $ORG_NAME/$REPO_NAME " >> $GITFiles/mockbuilds.log
else else
echo "Mockbuild failed" echo "Mockbuild failed"
echo "$(date +'%FT%H%M') Mockbuild failed for $1/$2 " >> $GITFiles/mockbuilds.log echo "$(date +'%FT%H%M') Mockbuild failed for $ORG_NAME/$REPO_NAME " >> $GITFiles/mockbuilds.log
exit 1 exit 1
fi fi