ouline of git work

This commit is contained in:
Trevor Batley 2023-05-30 18:08:55 +10:00
parent ca0dc63f6f
commit 0eeda2655a

View File

@ -129,21 +129,16 @@ fi
#Fork e-smith-<pkg> into users repositories as smeserver-<pkg>
# - add bugzilla and wiki references
if [ $DEBUG ] ; then echo "Forking $SORCEORG/$SOURCEPKG into $TARGETORG/$TARGETPKG!" ; fi
RESPONSE=$(curl "$SILENT" "$checkSSL" -X 'POST' \
"https://src.koozali.org/api/v1/repos/$SOURCEORG/$SOURCEPKG/forks" \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H "Authorization: token $SOURCEACCESSTOKEN"
-H "Authorization: token $SOURCEACCESSTOKEN" \
-d '{
"name": "'"$TARGETPKG"'",
"description": "'"SMEServer Koozali developed git repo for $TARGETPKG base"'"
}')
if [ $RESPONSE == "202" ] ; then
if [ $DEBUG ] ; then echo "$SOURCEPKG successfully forked" ; fi
else
echo "************Repository $SOURCEORG/$SOURCEPKG NOT forked on $SOURCEHOST ($RESPONSE)"
exit 1
fi
# create a Bugzilla URL
PRODUCTBUGZILLA="SME%20Server%2010.X"
@ -177,31 +172,57 @@ WIKILINK=$(while read -r TITLE; do \
if [[ ! "$URL" =~ 'fr' ]] ; then echo "${URL}"; break; fi \
done <<< "${RESULTS}" )
if [ $DEBUG ] ; then echo "Updating Description, Bug and Wiki links" ; fi
RESPONSE=$(curl "$SILENT" "$checkSSL" -X 'PATCH' \
"$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \
-H 'accept: application/json' \
-H "Authorization: token $SOURCEACCESSTOKEN" \
-H 'Content-Type: application/json' \
-d '{
"external_tracker": {
"description": "'"SMEServer Koozali developed repo for $TARGETPKG base"'",
"has_issues": true,
"external_tracker": {
"external_tracker_format": "https://bugs.koozali.org/show_bug.cgi?id={index}",
"external_tracker_style": "numeric",
"external_tracker_url": "'"https://bugs.koozali.org/buglist.cgi?component=$TARGETPKG&product=$PRODUCTBUGZILLA"'"
},
"has_wiki": true,
"external_wiki": {
"external_wiki_url": "'"$WIKILINK"'"
}
}'
)
# Create the local Git repository
GITFiles=$WORKDIR/GITFiles/$TARGETORG
mkdir -p $GITFiles
cd $GITFiles
# Delete the local first
if [ -d "$TARGETPKG" ] ; then
if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi
rm -Rf $GITFiles/$TARGETPKG
fi
# Clone the package
if [ $DEBUG ] ; then echo "git clone $SOURCEHOST/$TARGETORG/$TARGETPKG.git" ; fi
cd $GITFiles
git clone "$SOURCEHOST/$TARGETORG/$TARGETPKG.git"
cd $GITFiles/$TARGETPKG
#Update README.md
# - new name
# - Bugzilla link to new name whilst keeping old link for Legacy
sed -i '/^e-smith/a smeserver' README.md
git add README.md
#Update Makefile
# - NAME := smeserver-<pkg>
git add Makefile
#Rename e-smith-<pkg>.spec as smeserver-<pkg>.spec
mv "$SOURCEPKG.spec" "$TARGETPKG.spec"
#Update smeserver-<pkg>.spec
# - change name to smeserver-<pkg> (%define name)
@ -211,7 +232,12 @@ RESPONSE=$(curl "$SILENT" "$checkSSL" -X 'PATCH' \
# - delete archivefilename file
# - add changelog entry (Bugzilla #12359)
git rm "$SOURCEPKG.spec"
git add "$TARGETPKG.spec"
#Update createlinks
# - if there is an e-smith-<pkg>-update event rename to smeserver-<pkg>-update
git commit -m "rename-e-smith-pkg"
#Convert repository to a Regular Repository (rather than fork)