You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2019/03/20 15:00:28 UTC

[sling-tooling-scm] 19/35: SLING-3987 - move from Subversion to Git

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-tooling-scm.git

commit 5a74f9593f3e889f9934f27f01709bb078439309
Author: Robert Munteanu <ro...@apache.org>
AuthorDate: Sun Oct 8 20:24:29 2017 +0000

    SLING-3987 - move from Subversion to Git
    
    Scripts now use the final Github destinations and interact
    with the GitBox provisioning scripts.
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1811503 13f79535-47bb-0310-9956-ffa450edef68
---
 scripts/create-gitbox-repo.sh | 21 +++++++++++++++++++++
 scripts/migrate-to-git.sh     | 19 +++++++++----------
 2 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/scripts/create-gitbox-repo.sh b/scripts/create-gitbox-repo.sh
new file mode 100755
index 0000000..4cdc253
--- /dev/null
+++ b/scripts/create-gitbox-repo.sh
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+
+# validation
+if [ $# -ne 2 ]; then
+    echo "Usage: $0 repo-name repo-description"
+    exit 1
+fi
+
+repo_name=$1
+repo_desc=$2
+
+# will fail if wrong credentials are passed
+status=$(curl --netrc -s -o /dev/null -I -w "%{http_code}" https://gitbox.apache.org/setup/newrepo.cgi?action=pmcs)
+if [ $status != "200" ]; then
+    echo "Got status ${status} for validation curl call, aborting."
+    echo "Please check ~/.netrc for a login entry for gitbox.apache.org"
+    exit 2
+fi
+
+echo "curl --netrc --data=\"action=create&pmc=sling&name=${repo_name}&description=${repo_desc}&notify=commits@sling.apache.org&ghnotify=dev@sling.apache.org&ispodling=false\" https://gitbox.apache.org/setup/newrepo.cgi"
+
diff --git a/scripts/migrate-to-git.sh b/scripts/migrate-to-git.sh
index 129456d..ac7c5f6 100755
--- a/scripts/migrate-to-git.sh
+++ b/scripts/migrate-to-git.sh
@@ -55,7 +55,7 @@ fi
 case "$1" in 
     "-r") echo "Provisioning remote repositories" ;;
     "-c") echo "Converting local repositories";;
-    "-p") echo "Pushing local repositories to remove";;
+    "-p") echo "Pushing local repositories to remote";;
     *)
         usage
         exit -1
@@ -72,6 +72,11 @@ while read -r module; do
     if [ -e ${module_orig}/pom.xml ]; then
 
         artifactId=$(xmllint --xpath "/*[local-name()='project']/*[local-name()='artifactId']/text()" ${module_orig}/pom.xml)
+        short_desc=$(xmllint --xpath "/*[local-name()='project']/*[local-name()='name']/text()" ${module_orig}/pom.xml)
+        if [ -z "${short_desc}" ]; then
+            echo "No name for ${module_orig}, aborting"
+            exit 3
+        fi
 
         # some overrides where it does not make sense to switch the artifact id
         case $artifactId in
@@ -130,8 +135,7 @@ while read -r module; do
         fi
 
     elif [ $1 == "-r" ]; then
-        # TODO - switch to ASF for the final run
-        status=$(curl -s -o /dev/null -I  -w "%{http_code}" https://github.com/not-sling/${repo_name})
+        status=$(curl -s -o /dev/null -I  -w "%{http_code}" https://github.com/apache/${repo_name})
 
         if [ $status = "404" ]; then
             echo "Repository not found, will create";
@@ -143,21 +147,16 @@ while read -r module; do
             exit 1
         fi
 
-        if [ -z "$GITHUB_AUTH" ]; then
-            echo "Please export GITHUB_AUTH='your-github-username your-github-token'"
-            exit 2
-        fi
-
         echo "Creating GIT repository ..."
      
         # TODO - create the repository using the ASF self-service tool
-        ./tooling/scm/scripts/create-gh-repo.sh ${GITHUB_AUTH} ${repo_name}
+        ./tooling/scm/scripts/create-gitbox-repo.sh ${repo_name} "${short_desc}"
 
     else # -p
         pushd ${git_repo_location}/${repo_name}
         # TODO - use the ASF remotes for the final run
         if [ $(git remote show | grep origin | wc -l) -eq 0 ]; then
-            git remote add origin https://github.com/not-sling/${repo_name}.git
+            git remote add origin https://github.com/apache/${repo_name}.git
             git push -u origin master
         else
             echo "Remote origin already exists, skipping"