add quiet or suppress
This commit is contained in:
parent
4e00e4676b
commit
65e19bcdda
@ -78,7 +78,7 @@ if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
|
|||||||
# Make this null if you want lots of output. Still quite a bit anyway
|
# Make this null if you want lots of output. Still quite a bit anyway
|
||||||
QUIET="-q"
|
QUIET="-q"
|
||||||
curlsilent="-s"
|
curlsilent="-s"
|
||||||
suppress=" > /dev/null 2>&1"
|
suppress=" &> /dev/null"
|
||||||
if [ $DEBUG ] ; then
|
if [ $DEBUG ] ; then
|
||||||
QUIET=
|
QUIET=
|
||||||
curlsilent="-v"
|
curlsilent="-v"
|
||||||
@ -109,10 +109,24 @@ COMMONREPO=${smegit_COMMONREPO}
|
|||||||
# Name is re-initialised later on from the spec file
|
# Name is re-initialised later on from the spec file
|
||||||
NAME=$1
|
NAME=$1
|
||||||
|
|
||||||
cd $WORKDIR
|
# Prepare variable for file in repo to indicate core or contrib.
|
||||||
CVSFiles="$WORKDIR/$2/rpms"
|
# and init gitea organisation
|
||||||
#echo $CVSFiles
|
# Adjust where we put the repo locally accordingly.
|
||||||
mkdir -p $CVSFiles
|
ORGGITEA=$2
|
||||||
|
if [[ "$2" == "smecontribs" ]]; then
|
||||||
|
BASEORCONTRIB="contribs10"
|
||||||
|
PRODUCTBUGZILLA="SME%20Contribs"
|
||||||
|
else
|
||||||
|
BASEORCONTRIB="sme10"
|
||||||
|
PRODUCTBUGZILLA="SME%20Server%2010.X"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Work out if it is an SMEServer package or a 3rd party one
|
||||||
|
if [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
|
||||||
|
PACKAGETYPE="SMEServer Koozali developed"
|
||||||
|
else
|
||||||
|
PACKAGETYPE="3rd Party (Maintained by Koozali)"
|
||||||
|
fi
|
||||||
|
|
||||||
# Check that git-lfs is installed
|
# Check that git-lfs is installed
|
||||||
if command -v git-lfs > /dev/null; then
|
if command -v git-lfs > /dev/null; then
|
||||||
@ -145,9 +159,15 @@ else
|
|||||||
echo "ERROR********************BogusDateBot.sh is not installed*********** (try installing smeserver-mockbuild)"
|
echo "ERROR********************BogusDateBot.sh is not installed*********** (try installing smeserver-mockbuild)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Create work directories
|
||||||
|
cd $WORKDIR
|
||||||
|
CVSFiles="$WORKDIR/$2/rpms"
|
||||||
|
#echo $CVSFiles
|
||||||
|
mkdir -p $CVSFiles
|
||||||
|
|
||||||
# Make sure credentials taken from store
|
# Make sure credentials taken from store
|
||||||
# The first time you pull or push it will ask for credentials and then save them in a file.
|
# The first time you pull or push it will ask for credentials and then save them in a file.
|
||||||
git config --global credential.helper store
|
git config --global credential.helper store $QUIET
|
||||||
|
|
||||||
#
|
#
|
||||||
# Clone the CVS repository
|
# Clone the CVS repository
|
||||||
@ -160,24 +180,10 @@ if [ -d "$1" ] ; then
|
|||||||
rm -Rf $CVSFiles/$1
|
rm -Rf $CVSFiles/$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Then get it fully from CVS
|
# Then get it fully from CVS
|
||||||
cd $CVSFiles
|
cd $CVSFiles
|
||||||
cvs -d:ext:shell.koozali.org:/cvs/$2 $QUIET checkout $1
|
cvs -d:ext:shell.koozali.org:/cvs/$2 $QUIET checkout $1
|
||||||
|
|
||||||
# Prepare variable for file in repo to indicate core or contrib.
|
|
||||||
# and init gitea organisation
|
|
||||||
# Adjust where we put the repo locally accordingly.
|
|
||||||
ORGGITEA=$2
|
|
||||||
if [[ "$2" == "smecontribs" ]]; then
|
|
||||||
BASEORCONTRIB="contribs10"
|
|
||||||
PRODUCTBUGZILLA="SME%20Contribs"
|
|
||||||
else
|
|
||||||
BASEORCONTRIB="sme10"
|
|
||||||
PRODUCTBUGZILLA="SME%20Server%2010.X"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Check that the spec file is there
|
# Check that the spec file is there
|
||||||
# First bet is the packagename.spec
|
# First bet is the packagename.spec
|
||||||
SPECFILE=$1/$BASEORCONTRIB/$1.spec
|
SPECFILE=$1/$BASEORCONTRIB/$1.spec
|
||||||
@ -229,7 +235,6 @@ if [ -d "$1" ] ; then
|
|||||||
rm -Rf $GITFiles/$1
|
rm -Rf $GITFiles/$1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# See if it exists on the Gitea host
|
# See if it exists on the Gitea host
|
||||||
REPO_NAME=$1
|
REPO_NAME=$1
|
||||||
if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$REPO_NAME exists" ; fi
|
if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$REPO_NAME exists" ; fi
|
||||||
@ -238,7 +243,6 @@ RESPONSE=$(curl $checkSSL $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST
|
|||||||
if [ "$RESPONSE" == "200" ]; then
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
if [ $DEBUG ] ; then echo "************Repository for $1 already exists!" ; fi
|
if [ $DEBUG ] ; then echo "************Repository for $1 already exists!" ; fi
|
||||||
# If so, clone it (just want the README.md)
|
# If so, clone it (just want the README.md)
|
||||||
# And Clone it
|
|
||||||
if [ $DEBUG ] ; then echo "git clone $GITEAHOST/$ORGGITEA/$1.git" ; fi
|
if [ $DEBUG ] ; then echo "git clone $GITEAHOST/$ORGGITEA/$1.git" ; fi
|
||||||
cd $GITFiles
|
cd $GITFiles
|
||||||
git clone "$GITEAHOST/$ORGGITEA/$1.git"
|
git clone "$GITEAHOST/$ORGGITEA/$1.git"
|
||||||
@ -253,7 +257,7 @@ if [ "$RESPONSE" == "200" ]; then
|
|||||||
"$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \
|
"$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H "Authorization: token $GITEAACCESSTOKEN")
|
-H "Authorization: token $GITEAACCESSTOKEN")
|
||||||
if [[ $RESONSE == "204" || $RESPONSE == "404" ]] ; then
|
if [[ $RESPONSE == "204" || $RESPONSE == "404" ]] ; then
|
||||||
if [ $DEBUG ] ; then echo "************Repository $ORGGITEA/$1 deleted or does not exist" ; fi
|
if [ $DEBUG ] ; then echo "************Repository $ORGGITEA/$1 deleted or does not exist" ; fi
|
||||||
else
|
else
|
||||||
echo "************Can NOT delete Repository $ORGGITEA/$1 - results will be unknown - Aborting!"
|
echo "************Can NOT delete Repository $ORGGITEA/$1 - results will be unknown - Aborting!"
|
||||||
@ -271,18 +275,12 @@ fi
|
|||||||
cd $GITFiles
|
cd $GITFiles
|
||||||
#git init $QUIET $1
|
#git init $QUIET $1
|
||||||
|
|
||||||
# Work out if it is an SMEServer package or a 3rd party one
|
|
||||||
if [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
|
|
||||||
PACKAGETYPE="SMEServer Koozali developed"
|
|
||||||
else
|
|
||||||
PACKAGETYPE="3rd Party (Maintained by Koozali)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Re-create the repo
|
# Re-create the repo
|
||||||
#
|
#
|
||||||
if [ $DEBUG ] ; then echo "************Creating repo for $1 $PACKAGETYPE" ; fi
|
if [ $DEBUG ] ; then echo "************Creating repo for $1 $PACKAGETYPE" ; fi
|
||||||
RESPONSE=$(curl "$checkSSL" "$curlsilent" -X 'POST' "$GITEAHOST/api/v1/orgs/$ORGGITEA/repos" \
|
RESPONSE=$(curl "$checkSSL" "$curlsilent" -o /dev/null -w "%{http_code}" -X 'POST' \
|
||||||
|
"$GITEAHOST/api/v1/orgs/$ORGGITEA/repos" \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H "Authorization: token $GITEAACCESSTOKEN" \
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
@ -312,7 +310,7 @@ if [[ -z "${HTTP_URL}" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# And check it now exists
|
# And check it now exists
|
||||||
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$1")
|
RESPONSE=$(curl "$curlsilent" -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$1")
|
||||||
if [[ "$RESPONSE" == "200" ]]; then
|
if [[ "$RESPONSE" == "200" ]]; then
|
||||||
if [ $DEBUG ] ; then echo "************Repository for $1 exists" ; fi
|
if [ $DEBUG ] ; then echo "************Repository for $1 exists" ; fi
|
||||||
else
|
else
|
||||||
@ -323,7 +321,7 @@ fi
|
|||||||
# Pull in the auto created or updated files
|
# Pull in the auto created or updated files
|
||||||
cd $GITFiles
|
cd $GITFiles
|
||||||
#GIT_SSL_NO_VERIFY=true git clone "$GITEAHOST/$ORGGITEA/$1.git"
|
#GIT_SSL_NO_VERIFY=true git clone "$GITEAHOST/$ORGGITEA/$1.git"
|
||||||
git clone "$GITEAHOST/$ORGGITEA/$1.git"
|
git clone "$GITEAHOST/$ORGGITEA/$1.git" $QUIET
|
||||||
|
|
||||||
if [ ! -d $GITFiles/$1 ] ; then
|
if [ ! -d $GITFiles/$1 ] ; then
|
||||||
echo "ERROR*******Unable to access the new repo directory for $HTTP_URL $GITFiles/$1"
|
echo "ERROR*******Unable to access the new repo directory for $HTTP_URL $GITFiles/$1"
|
||||||
@ -335,7 +333,7 @@ cd $CVSFiles/$1/$BASEORCONTRIB
|
|||||||
# Fully populate the directory (gets the tar file - which is not strictly in CVS) and creates the directory source tree
|
# Fully populate the directory (gets the tar file - which is not strictly in CVS) and creates the directory source tree
|
||||||
# applying the patches to the base in the tar file.
|
# applying the patches to the base in the tar file.
|
||||||
# Might need to replace this by the code from the makefile if we decide to move "make prep" to git moe likely we'll implement a new one "make gitprep".
|
# Might need to replace this by the code from the makefile if we decide to move "make prep" to git moe likely we'll implement a new one "make gitprep".
|
||||||
make prep
|
make prep $suppress
|
||||||
|
|
||||||
# Extract the directory name for the file tree (it will include the name of the module plus some version information)
|
# Extract the directory name for the file tree (it will include the name of the module plus some version information)
|
||||||
# Same trick that we use in the makefile.common - taking the name and verison from the .spec file.
|
# Same trick that we use in the makefile.common - taking the name and verison from the .spec file.
|
||||||
@ -490,21 +488,21 @@ if [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
|
|||||||
#and copy in the source tree
|
#and copy in the source tree
|
||||||
mkdir -p "$CODEDIR"
|
mkdir -p "$CODEDIR"
|
||||||
if [ $DEBUG ] ; then echo "************Copying $CVSFiles/$1/$BASEORCONTRIB/root `pwd`/$CODEDIR" ; fi
|
if [ $DEBUG ] ; then echo "************Copying $CVSFiles/$1/$BASEORCONTRIB/root `pwd`/$CODEDIR" ; fi
|
||||||
rsync -a --no-prune-empty-dirs "$CVSFiles/$1/$BASEORCONTRIB/$TREEPATH/root/" "`pwd`/$CODEDIR/"
|
rsync "$QUIET" -a --no-prune-empty-dirs "$CVSFiles/$1/$BASEORCONTRIB/$TREEPATH/root/" "`pwd`/$CODEDIR/"
|
||||||
# copy createlinks to base
|
# copy createlinks to base
|
||||||
if [ -e "$CVSFiles/$1/$BASEORCONTRIB/$TREEPATH/createlinks" ] ; then cp "$CVSFiles/$1/$BASEORCONTRIB/$TREEPATH/createlinks" "`pwd`/." ; fi
|
if [ -e "$CVSFiles/$1/$BASEORCONTRIB/$TREEPATH/createlinks" ] ; then cp "$CVSFiles/$1/$BASEORCONTRIB/$TREEPATH/createlinks" "`pwd`/." ; fi
|
||||||
# copy anything else in the base directory of $TREEPATH into the additional directory
|
# copy anything else in the base directory of $TREEPATH into the additional directory
|
||||||
if [ ! -d "`pwd`/additional" ] ; then mkdir -p "`pwd`/additional" ; fi
|
if [ ! -d "`pwd`/additional" ] ; then mkdir -p "`pwd`/additional" ; fi
|
||||||
rsync -av --exclude "createlinks" --exclude "root/" "$CVSFiles/$1/$BASEORCONTRIB/$TREEPATH/" "`pwd`/additional/"
|
rsync "$QUIET" -av --exclude "createlinks" --exclude "root/" "$CVSFiles/$1/$BASEORCONTRIB/$TREEPATH/" "`pwd`/additional/"
|
||||||
# and plug a dummy into any empty directories
|
# and plug a dummy into any empty directories
|
||||||
find "`pwd`/root"/* -type d -empty -exec touch {}/.gitignore \;
|
find "`pwd`/root"/* -type d -empty -exec touch {}/.gitignore \;
|
||||||
else
|
else
|
||||||
# Third party package
|
# Third party package
|
||||||
# copy over the archive file and make sure the extension is tracked by git-lfs
|
# copy over the archive file and make sure the extension is tracked by git-lfs
|
||||||
if [ $DEBUG ] ; then echo "************Found 3rd party package $NAME" ; fi
|
if [ $DEBUG ] ; then echo "************Found 3rd party package $NAME" ; fi
|
||||||
git lfs install
|
git lfs install $QUIET
|
||||||
git lfs track "*.$EXT"
|
git lfs track "*.$EXT" $QUIET
|
||||||
git add .gitattributes
|
git add .gitattributes $QUIET
|
||||||
#git config lfs.http://gitea.bjsystems.co.uk/SMEContribs/bugzilla.git/info/lfs.locksverify true
|
#git config lfs.http://gitea.bjsystems.co.uk/SMEContribs/bugzilla.git/info/lfs.locksverify true
|
||||||
if [[ -f $CVSFiles/$1/$BASEORCONTRIB/$ARCHIVEFILE ]] ; then
|
if [[ -f $CVSFiles/$1/$BASEORCONTRIB/$ARCHIVEFILE ]] ; then
|
||||||
if [ $DEBUG ] ; then echo "************Copying archivefile $CVSFiles/$1/$BASEORCONTRIB/$ARCHIVEFILE" ; fi
|
if [ $DEBUG ] ; then echo "************Copying archivefile $CVSFiles/$1/$BASEORCONTRIB/$ARCHIVEFILE" ; fi
|
||||||
@ -521,7 +519,7 @@ if [[ $ARCHIVEFILE != "$TREEPATH.tar.gz" ]] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Take out any bogus dates:
|
# Take out any bogus dates:
|
||||||
/usr/bin/BogusDateBot.sh $(basename $SPECFILE)
|
/usr/bin/BogusDateBot.sh $(basename $SPECFILE) $suppress
|
||||||
|
|
||||||
# If it is an SME package, take out the patches and then update the release.
|
# If it is an SME package, take out the patches and then update the release.
|
||||||
if [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
|
if [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
|
||||||
@ -529,7 +527,7 @@ if [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
|
|||||||
sed -i '/^Patch/d; /^%patch/d' $(basename $SPECFILE)
|
sed -i '/^Patch/d; /^%patch/d' $(basename $SPECFILE)
|
||||||
# no paths need adjusting at this time!
|
# no paths need adjusting at this time!
|
||||||
# Bump the release and add changelog
|
# Bump the release and add changelog
|
||||||
change-log $(basename $SPECFILE)
|
change-log $(basename $SPECFILE) $suppress
|
||||||
# and edit in the reason
|
# and edit in the reason
|
||||||
# sed - TBD - to look for "fix [SME: ]"
|
# sed - TBD - to look for "fix [SME: ]"
|
||||||
sed -i 's/fix \[SME: \]/Roll up patches and move to git repo \[SME: 12338\]/' $(basename $SPECFILE)
|
sed -i 's/fix \[SME: \]/Roll up patches and move to git repo \[SME: 12338\]/' $(basename $SPECFILE)
|
||||||
@ -568,7 +566,7 @@ fi
|
|||||||
if [ ! -e $GITFiles/common ]; then
|
if [ ! -e $GITFiles/common ]; then
|
||||||
#Get it
|
#Get it
|
||||||
cd $GITFiles
|
cd $GITFiles
|
||||||
git clone "${smegit_COMMONREPO}"
|
git clone "${smegit_COMMONREPO}" $QUIET
|
||||||
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 $1"
|
||||||
exit 1
|
exit 1
|
||||||
@ -576,7 +574,7 @@ if [ ! -e $GITFiles/common ]; then
|
|||||||
else
|
else
|
||||||
# Just refresh it
|
# Just refresh it
|
||||||
cd $GITFiles/common
|
cd $GITFiles/common
|
||||||
git pull
|
git pull $QUIET
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Now make sure that the make-archive is executible
|
# Now make sure that the make-archive is executible
|
||||||
@ -726,18 +724,16 @@ COMMENT="initial commit of file from CVS for $1 on `date`"
|
|||||||
git commit -m "$COMMENT" $QUIET
|
git commit -m "$COMMENT" $QUIET
|
||||||
|
|
||||||
# push the converted git repository to the remote
|
# push the converted git repository to the remote
|
||||||
git remote remove origin
|
git remote remove origin $QUIET
|
||||||
git remote add origin "$GITEAHOST/$ORGGITEA/$1.git"
|
git remote add origin "$GITEAHOST/$ORGGITEA/$1.git" $QUIET
|
||||||
#GIT_SSL_NO_VERIFY=true git push --force -u $QUIET origin master
|
#GIT_SSL_NO_VERIFY=true git push --force -u $QUIET origin master
|
||||||
git push --force -u $QUIET origin master
|
git push --force -u $QUIET origin master $QUIET
|
||||||
|
|
||||||
# Now create the version and release tag for these files
|
# Now create the version and release tag for these files
|
||||||
RELEASE=`rpm --queryformat '%{release}\n' --specfile $NAME.spec | head -n 1`
|
RELEASE=`rpm --queryformat '%{release}\n' --specfile $NAME.spec | head -n 1`
|
||||||
TAG=$VERSION-$RELEASE
|
TAG=$VERSION-$RELEASE
|
||||||
git tag -a $TAG -m "$COMMENT"
|
git tag -a $TAG -m "$COMMENT" $QUIET
|
||||||
git push origin $TAG
|
git push origin $TAG $QUIET
|
||||||
|
|
||||||
echo "Created $1 Repo: $HTTP_URL - Comment:$COMMENT tag:$TAG"
|
echo "Created $1 Repo: $HTTP_URL - Comment:$COMMENT tag:$TAG"
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user