diff --git a/rename-e-smith-pkg.sh b/rename-e-smith-pkg.sh index c6331c1..d2c0ca0 100644 --- a/rename-e-smith-pkg.sh +++ b/rename-e-smith-pkg.sh @@ -129,21 +129,16 @@ fi #Fork e-smith- into users repositories as smeserver- # - 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- +git add Makefile + #Rename e-smith-.spec as smeserver-.spec +mv "$SOURCEPKG.spec" "$TARGETPKG.spec" #Update smeserver-.spec # - change name to smeserver- (%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--update event rename to smeserver--update +git commit -m "rename-e-smith-pkg" + #Convert repository to a Regular Repository (rather than fork)