You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by cm...@apache.org on 2019/10/26 12:57:36 UTC

[incubator-mxnet] 03/05: Get the deploy side working - next will come the validate of the deployed jar

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

cmeier pushed a commit to branch clojure-release-script
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git

commit edcf660e647c527100ca4e66ac79c5f2819eee25
Author: gigasquid <cm...@gigasquidsoftware.com>
AuthorDate: Sat Oct 26 07:56:36 2019 -0400

    Get the deploy side working
    - next will come the validate of the deployed jar
---
 .../clojure-package/scripts/setup_deploy_env.sh    | 28 +++++++
 .../clojure-package/src/dev/package_release.clj    | 91 ++++++----------------
 2 files changed, 50 insertions(+), 69 deletions(-)

diff --git a/contrib/clojure-package/scripts/setup_deploy_env.sh b/contrib/clojure-package/scripts/setup_deploy_env.sh
new file mode 100755
index 0000000..ab3ae89
--- /dev/null
+++ b/contrib/clojure-package/scripts/setup_deploy_env.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# Run this from the main Clojure project directory with 2 arguments
+# old-version and new-version
+# Ex: scripts/update_version 1.6.0-SNAPSHOT 1.6.0-SNAPSHOT
+
+set -evx
+echo "Setting up env for deploy"
+export GPG_TTY=$(tty)
+echo "Done!"
+
diff --git a/contrib/clojure-package/src/dev/package_release.clj b/contrib/clojure-package/src/dev/package_release.clj
index cc3c946..541fe6d 100644
--- a/contrib/clojure-package/src/dev/package_release.clj
+++ b/contrib/clojure-package/src/dev/package_release.clj
@@ -58,7 +58,7 @@
 (defn run-commands
   "Run shell commands and report exit and out"
   ([commands text]
-   (commands text nil))
+   (run-commands commands text nil))
   ([commands text dir]
    (do
      (println "=====================  " text  "  =====================")
@@ -76,14 +76,6 @@
          (flush))
        (zero? exit)))))
 
-(defn reset-project-files
-  "Resets the projects files back to the original saved version"
-  []
-  (do
-    (sh "cp" "project.clj" "new-project-clj")
-    (sh "cp" "project.clj.bak" "project.clj")
-    (sh "cp" "examples/imclassification/project.clj.bak" "examples/imclassification/project.clj")))
-
 (defn run-tests-and-install
   "With the project file in place, use lein to
   dowload deps, run tests and then install the generated
@@ -145,80 +137,41 @@
                     "Running Image Classification Example"
                     "examples/imclassification"))))
 
+(defn print-deploy-instructions []
+  (do
+    (println "**************************")
+    (println "*****READY FOR DEPLOY*****")
+    (println "**************************")
+    (println "Please validate that logs are all correct and the jar looks good.")
+    (print "Then run the following command to push the jar to apache staging:")
+    (println "   lein deploy :staging    ")
+    (flush)))
 
 (defn run-build [args]
   (let [[build-type release-number apache-gpg-key] args
         release-args {:build-type (keyword build-type)
                       :release-number release-number
                       :apache-gpg-key apache-gpg-key}]
-    
+
     (if (s/valid? ::release-args release-args)
-      (try
-        (do
-          (test-installed-jar build-type release-number)
-          (System/exit 0)
-          )
-        #_(do
-            (make-new-project-file {:build-type :osx-cpu
-                                    :release-number "1.5.1"
-                                    :apache-gpg-key "cmeier@apache.org"} )
-            (run-tests-and-install)
-            (System/exit 0)
-            )
-        (finally (reset-project-files)))
+      (do
+        (make-new-project-file {:build-type :osx-cpu
+                                :release-number "1.5.1"
+                                :apache-gpg-key "cmeier@apache.org"} )
+        (run-tests-and-install)
+        (test-installed-jar build-type release-number)
+        (run-commands ["scripts/setup_deploy_env.sh"] "Setting up display for deploy")
+        (print-deploy-instructions)
+        (System/exit 0))
       (do
         (println "Error with Args" release-args)
         (s/explain ::release-args release-args))
       )))
 
 (defn -main [& args]
-  (run-build args)
-)
-
+  (run-build args))
 
 (comment
+ (run-commands ["./scripts/setup_deploy_env.sh"] "Setting up display for deploy")
 
-
-
-  (let [build-type "osx-cpu"
-        release-number "1.5.1"
-        project-data (read-string (slurp "./examples/imclassification/project.clj"))
-        project-header (into [] (take 3 project-data))
-        project-rest-map (->> project-data
-                              (drop 3)
-                              (apply hash-map))
-        new-dependencies (->> (:dependencies project-rest-map)
-                              (remove #(string/includes? % "org.apache.mxnet"))
-                              (into [[(symbol (str "org.apache.mxnet.contrib.clojure/clojure-mxnet-" build-type)) release-number]]))
-        new-project-rest-map     (-> project-rest-map
-                                     (assoc :dependencies new-dependencies))]
-    new-project-rest-map
-    (do
-      (as-> (into [] new-project-rest-map) p
-        (into project-header (mapcat identity p))
-        (apply list p)
-        #_(with-out-str (clojure.pprint/pprint p))
-        #_(str dev.generator/license p)
-        #_(spit "./examples/imclassification/new-project.clj" p))
-      #_(run-commands ["lein" "run"]
-                    "Running Image Classification Example"
-                    "examples/imclassification")))
-
-  (run-build ["osx-cpu" "1.5.1" "cmeier@apache.org"])
-  
-  (let [m2-path (str (System/getProperty "user.home")
-                 "/.m2/repository/org/apache/mxnet/contrib/clojure/clojure-mxnet")
-        files-to-be-cleared (:out (sh "ls" m2-path))]
-    files-to-be-cleared)
-
-  (sh "cd" "examples")
-  (sh "lein" "run" :dir "examples/imclassification")
-  (sh "pwd")
-
-  (sh "ls" "~")
-
-
-
-"[[org.apache.mxnet.contrib.clojure/clojure-mxnet-osx-cpu \"1.5.1\"]]"
-  
   )