add back in update of external issues and wiki
This commit is contained in:
parent
ce96666422
commit
a7b3cda711
@ -64,7 +64,7 @@ else
|
|||||||
WORKDIR=${smegit_WORKDIR}
|
WORKDIR=${smegit_WORKDIR}
|
||||||
fi
|
fi
|
||||||
|
|
||||||
SOURCEHOST=${remote_GITEAHOST}
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
SOURCEACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
SOURCEACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
SOURCEORG="smeserver"
|
SOURCEORG="smeserver"
|
||||||
TARGETORG=${remote_USER}
|
TARGETORG=${remote_USER}
|
||||||
@ -74,7 +74,7 @@ for param in $2 $3 $4 $5 $6; do
|
|||||||
if [ $param ] ; then
|
if [ $param ] ; then
|
||||||
case $param in
|
case $param in
|
||||||
local )
|
local )
|
||||||
SOURCEHOST=${local_GITEAHOST}
|
GITEAHOST=${local_GITEAHOST}
|
||||||
SOURCEACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
SOURCEACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
TARGETORG=${local_USER} ;;
|
TARGETORG=${local_USER} ;;
|
||||||
force )
|
force )
|
||||||
@ -107,17 +107,17 @@ TARGETPKG=${SOURCEPKG/e-smith/smeserver}
|
|||||||
|
|
||||||
#Check that source package exists
|
#Check that source package exists
|
||||||
if [ $DEBUG ] ; then echo "Check if $SOURCEORG/$SOURCEPKG is there!" ; fi
|
if [ $DEBUG ] ; then echo "Check if $SOURCEORG/$SOURCEPKG is there!" ; fi
|
||||||
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$SOURCEHOST/api/v1/repos/$SOURCEORG/$SOURCEPKG")
|
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$SOURCEORG/$SOURCEPKG")
|
||||||
if [ "$RESPONSE" == "200" ]; then
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
if [ $DEBUG ] ; then echo "Repository for $SOURCEORG/$SOURCEPKG exists!" ; fi
|
if [ $DEBUG ] ; then echo "Repository for $SOURCEORG/$SOURCEPKG exists!" ; fi
|
||||||
else
|
else
|
||||||
echo "************Repository for $SOURCEORG/$SOURCEPKG does not exist on $SOURCEHOST ($RESPONSE)"
|
echo "************Repository for $SOURCEORG/$SOURCEPKG does not exist on $GITEAHOST ($RESPONSE)"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Check that target package does not exist
|
#Check that target package does not exist
|
||||||
if [ $DEBUG ] ; then echo "Check if $TARGETORG/$TARGETPKG is there!" ; fi
|
if [ $DEBUG ] ; then echo "Check if $TARGETORG/$TARGETPKG is there!" ; fi
|
||||||
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG")
|
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$TARGETORG/$TARGETPKG")
|
||||||
if [ "$RESPONSE" == "200" ]; then
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
if [ $DEBUG ] ; then echo "Repository for $TARGETORG/$TARGETPKG exists!" ; fi
|
if [ $DEBUG ] ; then echo "Repository for $TARGETORG/$TARGETPKG exists!" ; fi
|
||||||
if [ -z ${DELETEIT} ] ; then
|
if [ -z ${DELETEIT} ] ; then
|
||||||
@ -128,7 +128,7 @@ if [ "$RESPONSE" == "200" ]; then
|
|||||||
DELETEIT=true
|
DELETEIT=true
|
||||||
break ;;
|
break ;;
|
||||||
[Nn]* )
|
[Nn]* )
|
||||||
echo "************Abandoning Fork of $SOURCEORG/$SOURCEPKG on $SOURCEHOST ($RESPONSE)"
|
echo "************Abandoning Fork of $SOURCEORG/$SOURCEPKG on $GITEAHOST ($RESPONSE)"
|
||||||
exit 1 ;;
|
exit 1 ;;
|
||||||
* ) echo "Please answer yes or no.";;
|
* ) echo "Please answer yes or no.";;
|
||||||
esac
|
esac
|
||||||
@ -137,12 +137,12 @@ if [ "$RESPONSE" == "200" ]; then
|
|||||||
if [ $DELETEIT ] ; then
|
if [ $DELETEIT ] ; then
|
||||||
if [ $DEBUG ] ; then echo "Deleting $TARGETORG/$TARGETPKG" ; fi
|
if [ $DEBUG ] ; then echo "Deleting $TARGETORG/$TARGETPKG" ; fi
|
||||||
RESPONSE=$(curl "$checkSSL" "$SILENT" -X 'DELETE' \
|
RESPONSE=$(curl "$checkSSL" "$SILENT" -X 'DELETE' \
|
||||||
"$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \
|
"$GITEAHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H "Authorization: token $SOURCEACCESSTOKEN" )
|
-H "Authorization: token $SOURCEACCESSTOKEN" )
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
if [ $DEBUG ] ; then echo "Repository for $TARGETORG/$TARGETPKG does not exist on $SOURCEHOST" ; fi
|
if [ $DEBUG ] ; then echo "Repository for $TARGETORG/$TARGETPKG does not exist on $GITEAHOST" ; fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#Fork e-smith-<pkg> into users repositories as smeserver-<pkg>
|
#Fork e-smith-<pkg> into users repositories as smeserver-<pkg>
|
||||||
@ -156,28 +156,40 @@ if [[ "$SOURCEORG" == "smecontribs" ]]; then
|
|||||||
BASEORCONTRIB="contrib"
|
BASEORCONTRIB="contrib"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# grab WIKILINK from source package
|
|
||||||
#WIKILINK=$(curl "$SILENT" -X 'GET' \
|
|
||||||
# "$SOURCEHOST/api/v1/repos/$SOURCEORG/$SOURCEPKG" \
|
|
||||||
# -H 'accept: application/json' \
|
|
||||||
# -H 'Content-Type: application/json' \
|
|
||||||
# -H "Authorization: token $SOURCEACCESSTOKEN" | \
|
|
||||||
# jq -r ' .external_wiki.external_wiki_url')
|
|
||||||
#if [ $DEBUG ] ; then echo "WIKILINK=$WIKILINK" ; fi
|
|
||||||
|
|
||||||
# migrate the source package over to target with updated fields
|
# migrate the source package over to target with updated fields
|
||||||
if [ $DEBUG ] ; then echo "Migrating $SOURCEORG/$SOURCEPKG as $TARGETORG/$1 on $TARGETHOST" ; fi
|
if [ $DEBUG ] ; then echo "Migrating $SOURCEORG/$SOURCEPKG as $TARGETORG/$1 on $TARGETHOST" ; fi
|
||||||
RESPONSE=$(curl $SILENT -k -X 'POST' \
|
RESPONSE=$(curl $SILENT -k -X 'POST' \
|
||||||
"$SOURCEHOST/api/v1/repos/migrate" \
|
"$GITEAHOST/api/v1/repos/migrate" \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H "Authorization: token $SOURCEACCESSTOKEN" \
|
-H "Authorization: token $SOURCEACCESSTOKEN" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
"auth_token": "'"$SOURCEACCESSTOKEN"'",
|
"auth_token": "'"$SOURCEACCESSTOKEN"'",
|
||||||
"clone_addr": "'"$SOURCEHOST/$SOURCEORG/$SOURCEPKG.git"'",
|
"clone_addr": "'"$GITEAHOST/$SOURCEORG/$SOURCEPKG.git"'",
|
||||||
"description": "'"SMEServer Koozali developed git repo for $TARGETPKG $BASEORCONTRIB"'",
|
"description": "'"SMEServer Koozali developed git repo for $TARGETPKG $BASEORCONTRIB"'",
|
||||||
"repo_name": "'"$TARGETPKG"'",
|
"repo_name": "'"$TARGETPKG"'",
|
||||||
"repo_owner": "'"$TARGETORG"'",
|
"repo_owner": "'"$TARGETORG"'"
|
||||||
|
}'
|
||||||
|
)
|
||||||
|
|
||||||
|
# Migrate does NOT copy accross the issues and wiki external links
|
||||||
|
# grab WIKILINK from source package
|
||||||
|
WIKILINK=$(curl "$SILENT" -X 'GET' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$SOURCEORG/$SOURCEPKG" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-H "Authorization: token $SOURCEACCESSTOKEN" | \
|
||||||
|
jq -r ' .external_wiki.external_wiki_url')
|
||||||
|
if [ $DEBUG ] ; then echo "WIKILINK=$WIKILINK" ; fi
|
||||||
|
|
||||||
|
# Update the repo with the changed bugzilla url and original wiki url
|
||||||
|
if [ $DEBUG ] ; then echo "Updating Description, Bug and Wiki links" ; fi
|
||||||
|
RESPONSE=$(curl "$SILENT" "$checkSSL" -X 'PATCH' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $SOURCEACCESSTOKEN" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
"has_issues": true,
|
"has_issues": true,
|
||||||
"external_tracker": {
|
"external_tracker": {
|
||||||
"external_tracker_format": "https://bugs.koozali.org/show_bug.cgi?id={index}",
|
"external_tracker_format": "https://bugs.koozali.org/show_bug.cgi?id={index}",
|
||||||
@ -191,28 +203,6 @@ RESPONSE=$(curl $SILENT -k -X 'POST' \
|
|||||||
}'
|
}'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Update the repo with the changed description, bugzilla url and wiki url
|
|
||||||
#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 '{
|
|
||||||
# "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
|
# Create the local Git repository
|
||||||
GITFiles=$WORKDIR/GITFiles/$TARGETORG
|
GITFiles=$WORKDIR/GITFiles/$TARGETORG
|
||||||
mkdir -p $GITFiles
|
mkdir -p $GITFiles
|
||||||
@ -225,9 +215,9 @@ if [ -d "$TARGETPKG" ] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Clone the package
|
# Clone the package
|
||||||
if [ $DEBUG ] ; then echo "git clone $SOURCEHOST/$TARGETORG/$TARGETPKG.git" ; fi
|
if [ $DEBUG ] ; then echo "git clone $GITEAHOST/$TARGETORG/$TARGETPKG.git" ; fi
|
||||||
cd $GITFiles
|
cd $GITFiles
|
||||||
git clone "$SOURCEHOST/$TARGETORG/$TARGETPKG.git" $QUIET
|
git clone "$GITEAHOST/$TARGETORG/$TARGETPKG.git" $QUIET
|
||||||
cd $GITFiles/$TARGETPKG
|
cd $GITFiles/$TARGETPKG
|
||||||
|
|
||||||
#Update README.md
|
#Update README.md
|
||||||
|
Loading…
Reference in New Issue
Block a user