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
|
||||
QUIET="-q"
|
||||
curlsilent="-s"
|
||||
suppress=" > /dev/null 2>&1"
|
||||
suppress=" &> /dev/null"
|
||||
if [ $DEBUG ] ; then
|
||||
QUIET=
|
||||
curlsilent="-v"
|
||||
@ -109,10 +109,24 @@ COMMONREPO=${smegit_COMMONREPO}
|
||||
# Name is re-initialised later on from the spec file
|
||||
NAME=$1
|
||||
|
||||
cd $WORKDIR
|
||||
CVSFiles="$WORKDIR/$2/rpms"
|
||||
#echo $CVSFiles
|
||||
mkdir -p $CVSFiles
|
||||
# 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
|
||||
|
||||
# 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
|
||||
if command -v git-lfs > /dev/null; then
|
||||
@ -145,9 +159,15 @@ else
|
||||
echo "ERROR********************BogusDateBot.sh is not installed*********** (try installing smeserver-mockbuild)"
|
||||
fi
|
||||
|
||||
# Create work directories
|
||||
cd $WORKDIR
|
||||
CVSFiles="$WORKDIR/$2/rpms"
|
||||
#echo $CVSFiles
|
||||
mkdir -p $CVSFiles
|
||||
|
||||
# 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.
|
||||
git config --global credential.helper store
|
||||
git config --global credential.helper store $QUIET
|
||||
|
||||
#
|
||||
# Clone the CVS repository
|
||||
@ -160,24 +180,10 @@ if [ -d "$1" ] ; then
|
||||
rm -Rf $CVSFiles/$1
|
||||
fi
|
||||
|
||||
|
||||
# Then get it fully from CVS
|
||||
cd $CVSFiles
|
||||
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
|
||||
# First bet is the packagename.spec
|
||||
SPECFILE=$1/$BASEORCONTRIB/$1.spec
|
||||
@ -229,7 +235,6 @@ if [ -d "$1" ] ; then
|
||||
rm -Rf $GITFiles/$1
|
||||
fi
|
||||
|
||||
|
||||
# See if it exists on the Gitea host
|
||||
REPO_NAME=$1
|
||||
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 [ $DEBUG ] ; then echo "************Repository for $1 already exists!" ; fi
|
||||
# If so, clone it (just want the README.md)
|
||||
# And Clone it
|
||||
if [ $DEBUG ] ; then echo "git clone $GITEAHOST/$ORGGITEA/$1.git" ; fi
|
||||
cd $GITFiles
|
||||
git clone "$GITEAHOST/$ORGGITEA/$1.git"
|
||||
@ -253,7 +257,7 @@ if [ "$RESPONSE" == "200" ]; then
|
||||
"$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \
|
||||
-H 'accept: application/json' \
|
||||
-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
|
||||
else
|
||||
echo "************Can NOT delete Repository $ORGGITEA/$1 - results will be unknown - Aborting!"
|
||||
@ -271,18 +275,12 @@ fi
|
||||
cd $GITFiles
|
||||
#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
|
||||
#
|
||||
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 "Authorization: token $GITEAACCESSTOKEN" \
|
||||
-H 'Content-Type: application/json' \
|
||||
@ -312,7 +310,7 @@ if [[ -z "${HTTP_URL}" ]]; then
|
||||
fi
|
||||
|
||||
# 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 [ $DEBUG ] ; then echo "************Repository for $1 exists" ; fi
|
||||
else
|
||||
@ -323,7 +321,7 @@ fi
|
||||
# Pull in the auto created or updated files
|
||||
cd $GITFiles
|
||||
#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
|
||||
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
|
||||
# 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".
|
||||
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)
|
||||
# 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
|
||||
mkdir -p "$CODEDIR"
|
||||
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
|
||||
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
|
||||
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
|
||||
find "`pwd`/root"/* -type d -empty -exec touch {}/.gitignore \;
|
||||
else
|
||||
# Third party package
|
||||
# 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
|
||||
git lfs install
|
||||
git lfs track "*.$EXT"
|
||||
git add .gitattributes
|
||||
git lfs install $QUIET
|
||||
git lfs track "*.$EXT" $QUIET
|
||||
git add .gitattributes $QUIET
|
||||
#git config lfs.http://gitea.bjsystems.co.uk/SMEContribs/bugzilla.git/info/lfs.locksverify true
|
||||
if [[ -f $CVSFiles/$1/$BASEORCONTRIB/$ARCHIVEFILE ]] ; then
|
||||
if [ $DEBUG ] ; then echo "************Copying archivefile $CVSFiles/$1/$BASEORCONTRIB/$ARCHIVEFILE" ; fi
|
||||
@ -521,7 +519,7 @@ if [[ $ARCHIVEFILE != "$TREEPATH.tar.gz" ]] ; then
|
||||
fi
|
||||
|
||||
# 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 [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
|
||||
@ -529,7 +527,7 @@ if [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
|
||||
sed -i '/^Patch/d; /^%patch/d' $(basename $SPECFILE)
|
||||
# no paths need adjusting at this time!
|
||||
# Bump the release and add changelog
|
||||
change-log $(basename $SPECFILE)
|
||||
change-log $(basename $SPECFILE) $suppress
|
||||
# and edit in the reason
|
||||
# sed - TBD - to look for "fix [SME: ]"
|
||||
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
|
||||
#Get it
|
||||
cd $GITFiles
|
||||
git clone "${smegit_COMMONREPO}"
|
||||
git clone "${smegit_COMMONREPO}" $QUIET
|
||||
if [ ! -e $GITFiles/common ]; then
|
||||
echo "ERROR*******No Common Repo found - package $1"
|
||||
exit 1
|
||||
@ -576,7 +574,7 @@ if [ ! -e $GITFiles/common ]; then
|
||||
else
|
||||
# Just refresh it
|
||||
cd $GITFiles/common
|
||||
git pull
|
||||
git pull $QUIET
|
||||
fi
|
||||
|
||||
# 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
|
||||
|
||||
# push the converted git repository to the remote
|
||||
git remote remove origin
|
||||
git remote add origin "$GITEAHOST/$ORGGITEA/$1.git"
|
||||
git remote remove origin $QUIET
|
||||
git remote add origin "$GITEAHOST/$ORGGITEA/$1.git" $QUIET
|
||||
#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
|
||||
RELEASE=`rpm --queryformat '%{release}\n' --specfile $NAME.spec | head -n 1`
|
||||
TAG=$VERSION-$RELEASE
|
||||
git tag -a $TAG -m "$COMMENT"
|
||||
git push origin $TAG
|
||||
git tag -a $TAG -m "$COMMENT" $QUIET
|
||||
git push origin $TAG $QUIET
|
||||
|
||||
echo "Created $1 Repo: $HTTP_URL - Comment:$COMMENT tag:$TAG"
|
||||
exit 0
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user