This commit is contained in:
Trevor Batley 2024-03-27 16:45:48 +11:00
parent fb6a44f132
commit 6fff2d19f5
2 changed files with 16 additions and 27 deletions

View File

@ -101,7 +101,7 @@ if [ $DEBUG ] ; then echo "WORKDIR=$WORKDIR" ; fi
# create repo name from perl- module with :: replaced by - # create repo name from perl- module with :: replaced by -
IFS=:: IFS=::
words=() words=()
for i in MODULENAME; do words+=($i) ; done for i in $MODULENAME; do words+=($i) ; done
RepoName="perl" RepoName="perl"
ShortName= ShortName=
for word in ${words[@]}; do for word in ${words[@]}; do
@ -191,7 +191,7 @@ fi
# Then get it fully from CVS # Then get it fully from CVS
mkdir -p $perlFiles/$RepoName mkdir -p $perlFiles/$RepoName
cd $perlFiles/$RepoName cd $perlFiles/$RepoName
cpanspec "MODULENAME" cpanspec "$MODULENAME"
# 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
@ -239,19 +239,9 @@ fi
# See if it exists on the Gitea host # See if it exists on the Gitea host
if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$RepoName exists" ; fi if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$RepoName exists" ; fi
READMECONTENTS=
RESPONSE=$(curl $checkSSL $SILENT4CURL -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$RepoName") RESPONSE=$(curl $checkSSL $SILENT4CURL -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$RepoName")
if [ "$RESPONSE" == "200" ]; then if [ "$RESPONSE" == "200" ]; then
if [ $DEBUG ] ; then echo "************Repository for $RepoName already exists!" ; fi if [ $DEBUG ] ; then echo "************Repository for $RepoName already exists!" ; fi
# If so, clone it (just want the README.md)
if [ $DEBUG ] ; then echo "git clone $GITEAHOST/$ORGGITEA/$RepoName.git" ; fi
cd $GITFiles
git clone "$GITEAHOST/$ORGGITEA/$RepoName.git"
if [[ -f $GITFILES/$RepoName/README.md ]] ; then
# Move it and remember its new (temp) name
READMECONTENTS=`mktemp`
mv -f README.md "$READMECONTENTS"
fi
# Now delete the repo, re-create it and clone it in to local # Now delete the repo, re-create it and clone it in to local
if [ $DEBUG ] ; then echo "Delete $ORGGITEA/$RepoName" ; fi if [ $DEBUG ] ; then echo "Delete $ORGGITEA/$RepoName" ; fi
RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -o /dev/null -w "%{http_code}" -X 'DELETE' \ RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -o /dev/null -w "%{http_code}" -X 'DELETE' \
@ -274,7 +264,6 @@ else
fi fi
cd $GITFiles cd $GITFiles
#git init $QUIET MODULENAME
# #
# Re-create the repo # Re-create the repo
@ -288,7 +277,7 @@ RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -X 'POST' \
-d '{ -d '{
"auto_init": true, "auto_init": true,
"default_branch": "master", "default_branch": "master",
"description": "'"$PACKAGETYPE git repo for $RepoName $ORGGITEA"'", "description": "'"perl git repo for $RepoName $ORGGITEA"'",
"gitignores": "", "gitignores": "",
"issue_labels": "Default", "issue_labels": "Default",
"license": "Apache-2.0", "license": "Apache-2.0",
@ -337,7 +326,7 @@ cd $GITFiles
git clone "$GITEAHOST/$ORGGITEA/$RepoName.git" git clone "$GITEAHOST/$ORGGITEA/$RepoName.git"
if [ ! -d $GITFiles/$RepoName ] ; then if [ ! -d $GITFiles/$RepoName ] ; then
echo "ERROR*******Unable to access the new repo directory for $HTTP_URL $GITFiles/$RepoName" echo "ERROR*******Unable to access the new repo directory for $GITFiles/$RepoName"
exit 1 exit 1
fi fi
@ -350,7 +339,7 @@ cp $perlFiles/$RepoName/* .
# create the Makefile # create the Makefile
cat > Makefile <<- _EOT cat > Makefile <<- _EOT
# Makefile for source rpm: $RepoName # Makefile for source rpm: $RepoName
# $Id: Makefile,v 1.1 2016/02/04 12:24:52 vip-ire Exp $ # \$Id: Makefile,v 1.1 2016/02/04 12:24:52 vip-ire Exp $
NAME := $RepoName NAME := $RepoName
SPECFILE = \$(firstword \$(wildcard *.spec)) SPECFILE = \$(firstword \$(wildcard *.spec))
@ -375,7 +364,7 @@ _EOT
# Add file indicating which release and contribs or base - this is matched by the makefile with the contents of the branch file in the common directory # Add file indicating which release and contribs or base - this is matched by the makefile with the contents of the branch file in the common directory
# to give the details of the release (EL7/8/9/ etc) # to give the details of the release (EL7/8/9/ etc)
# This assumes SME10 and contribs10 or sme10 directory names, later releases can update the value in the file and Makefile should still work. # This assumes SME10 and contribs10 or sme10 directory names, later releases can update the value in the file and Makefile should still work.
echo "sme10" > contriborbase echo "sme11" > contriborbase
# and see if the spec file is not according to specification of <packagename>.spec # and see if the spec file is not according to specification of <packagename>.spec
# if not rename it # if not rename it
@ -396,11 +385,11 @@ for fpath in $SOURCES; do
if [ $DEBUG ] ; then echo "$fpathfile" ; fi if [ $DEBUG ] ; then echo "$fpathfile" ; fi
translatefpath=$(rpm --queryformat "$fpathfile\n" --specfile $(basename $SPECFILE) | head -n 1) translatefpath=$(rpm --queryformat "$fpathfile\n" --specfile $(basename $SPECFILE) | head -n 1)
if [ $DEBUG ] ; then echo "$translatefpath" ; fi if [ $DEBUG ] ; then echo "$translatefpath" ; fi
if [[ -f $CVSFiles/$RepoName/$BASEORCONTRIB/$translatefpath ]] ; then if [[ -f $perlFiles/$RepoName/$BASEORCONTRIB/$translatefpath ]] ; then
if [ $DEBUG ] ; then echo "************Copying $CVSFiles/$RepoName/$BASEORCONTRIB/$translatefpath" ; fi if [ $DEBUG ] ; then echo "************Copying $perlFiles/$RepoName/$translatefpath" ; fi
cp $CVSFiles/$RepoName/$BASEORCONTRIB/$translatefpath . cp $perlFiles/$RepoName/$translatefpath .
else else
if [ $DEBUG ] ; then echo "************Not found $CVSFiles/$RepoName/$BASEORCONTRIB/$translatefpath ( $fpathfile )- so not copied" ; fi if [ $DEBUG ] ; then echo "************Not found $perlFiles/$RepoName/$translatefpath ( $fpathfile )- so not copied" ; fi
fi fi
done done
@ -418,11 +407,11 @@ git lfs install
git lfs track "*.$EXT" git lfs track "*.$EXT"
git add .gitattributes git add .gitattributes
#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/$RepoName/$BASEORCONTRIB/$ARCHIVEFILE ]] ; then if [[ -f $perlFiles/$RepoName/$ARCHIVEFILE ]] ; then
if [ $DEBUG ] ; then echo "************Copying archivefile $CVSFiles/$RepoName/$BASEORCONTRIB/$ARCHIVEFILE" ; fi if [ $DEBUG ] ; then echo "************Copying archivefile $perlFiles/$RepoName/$ARCHIVEFILE" ; fi
cp $CVSFiles/$RepoName/$BASEORCONTRIB/$ARCHIVEFILE . cp $perlFiles/$RepoName/$ARCHIVEFILE .
else else
if [ $DEBUG ] ; then echo "Unable to find archivefile: $CVSFiles/$RepoName/$BASEORCONTRIB/$ARCHIVEFILE - nothing copied" ; fi if [ $DEBUG ] ; then echo "Unable to find archivefile: $perlFiles/$RepoName/$ARCHIVEFILE - nothing copied" ; fi
fi fi
cd $GITFiles/$RepoName cd $GITFiles/$RepoName
@ -450,7 +439,7 @@ fi
# Edit the Readme.md - try to add a link to the wiki for this package - only if it is an SME package # Edit the Readme.md - try to add a link to the wiki for this package - only if it is an SME package
cd $GITFiles/$RepoName cd $GITFiles/$RepoName
DESCRIPTION=`rpm --queryformat '%{description}\n' --specfile "$SPECFILE" DESCRIPTION=`rpm --queryformat '%{description}\n' --specfile "$SPECFILE"`
cat > README.md <<- _EOT cat > README.md <<- _EOT
# $RepoName # $RepoName

@ -1 +1 @@
Subproject commit c25fa1943ac9074e506e52e9148e08f9ee1d723d Subproject commit fb6a44f132b39eee812b9e47256212d4dbd5d1e5