about summary refs log tree commit diff
diff options
context:
space:
mode:
authorClaude2026-06-26 00:00:00 +0000
committerFrederick Muriuki Muriithi2026-06-26 10:31:37 -0500
commit213b3e4abac4e4f636d49469996ef2f60cae3901 (patch)
tree3db9838392f1627d68912622bf464c4dae179407
parent2866d00d74286c24e82b2af758f05d951c399b42 (diff)
downloadgn-machines-213b3e4abac4e4f636d49469996ef2f60cae3901.tar.gz
Replace ad-hoc hline/show-head-commit with %show-commits
Every gexp that logged a repository HEAD commit defined its own local
hline and show-head-commit helpers.  Now that %show-commits exists as
a top-level program-file, replace all five remaining occurrences.

For the CD shepherd service gexps (genenetwork2-cd-gexp,
genenetwork3-cd-gexp, gn-auth-cd-gexp, gn-guile-gexp) the call moves
to just before the with-directory-excursion block that starts the
server.  No sudo is needed — the shepherd services already run as the
genenetwork user.

For genenetwork2-tests (the mechanical-rob Laminar job), all three git
clones are kept together and followed by a single %show-commits call
that logs all three repos at once.  Absolute paths are constructed at
runtime with (string-append (getcwd) "/repo-name") since the Laminar
user owns the fresh clones.

In all cases the local hline and show-head-commit definitions are
removed entirely.
-rw-r--r--genenetwork-development.scm71
1 files changed, 8 insertions, 63 deletions
diff --git a/genenetwork-development.scm b/genenetwork-development.scm
index bc7c8fd..d79a2ba 100644
--- a/genenetwork-development.scm
+++ b/genenetwork-development.scm
@@ -206,17 +206,6 @@ executed."
             (use-modules (guix build utils)
                          (srfi srfi-26))
 
-            (define (hline)
-              "Print a horizontal line 50 '=' characters long."
-              (display (make-string 50 #\=))
-              (newline)
-              (force-output))
-
-            (define (show-head-commit)
-              (hline)
-              (invoke "git" "log" "--max-count" "1")
-              (hline))
-
             (define (call-with-temporary-directory proc)
               (let ((tmp-dir (mkdtemp "/tmp/gn.XXXXXX")))
                 (dynamic-wind
@@ -225,14 +214,12 @@ executed."
                   (cut delete-file-recursively tmp-dir))))
 
             (invoke "git" "clone" "--depth" "1" #$gn3-repository)
-            (with-directory-excursion "genenetwork3"
-              (show-head-commit))
             (invoke "git" "clone" "--depth" "1" #$gn-libs-repository)
-            (with-directory-excursion "gn-libs"
-              (show-head-commit))
             (invoke "git" "clone" "--depth" "1" #$gn2-repository)
-            (with-directory-excursion "genenetwork2"
-              (show-head-commit))
+            (invoke #$%show-commits
+                    (string-append (getcwd) "/genenetwork3")
+                    (string-append (getcwd) "/gn-libs")
+                    (string-append (getcwd) "/genenetwork2"))
             ;; Use a profile with all dependencies except
             ;; genenetwork3.
             (setenv "GN2_PROFILE"
@@ -541,16 +528,6 @@ server described by CONFIG, a <genenetwork-configuration> object."
             (use-modules (guix build utils)
                          (ice-9 match))
 
-            (define (hline)
-              "Print a horizontal line 50 '=' characters long."
-              (display (make-string 50 #\=))
-              (newline)
-              (force-output))
-
-            (define (show-head-commit)
-              (hline)
-              (invoke "git" "log" "--max-count" "1")
-              (hline))
 	    (setenv "GIT_PAGER" #$(file-append coreutils-minimal "/bin/cat"))
 	    (setenv "TERM" "xterm-256color")
             ;; Clone the latest genenetwork2
@@ -612,9 +589,9 @@ server described by CONFIG, a <genenetwork-configuration> object."
                                   "AUTH_SERVER_SSL_PUBLIC_KEY=\"" gn2-secrets "/gn-auth-ssl-public-key.pem\"\n"))
 
               ;; Start genenetwork2.
+              (invoke #$%show-commits gn2-checkout)
               (with-directory-excursion
 	          gn2-checkout
-	        (show-head-commit)
 	        (invoke #$(file-append gunicorn "/bin/gunicorn")
 		        "--bind" (string-append "0.0.0.0:" (number->string #$gn2-port))
 		        "--workers" "20"
@@ -637,17 +614,6 @@ server described by CONFIG, a <genenetwork-configuration> object."
               (use-modules (guix build utils)
                            (ice-9 match))
 
-              (define (hline)
-                "Print a horizontal line 50 '=' characters long."
-                (display (make-string 50 #\=))
-                (newline)
-                (force-output))
-
-              (define (show-head-commit)
-                (hline)
-                (invoke "git" "log" "--max-count" "1")
-                (hline))
-
 	      (setenv "GIT_PAGER" #$(file-append coreutils-minimal "/bin/cat"))
 	      (setenv "GN3_PROFILE" #$(profile
                                        (content (package->development-manifest genenetwork3))
@@ -683,9 +649,9 @@ server described by CONFIG, a <genenetwork-configuration> object."
 		    (delete-file-recursively "gn-libs"))
 	          (invoke "git" "clone" "--depth" "1" #$gn-libs-repository))
 	        (setenv "PYTHONPATH" (string-append gn-libs-checkout ":$PYTHONPATH"))
+	        (invoke #$%show-commits gn3-checkout)
 	        (with-directory-excursion
 	            gn3-checkout
-	          (show-head-commit)
 	          ;; Run genenetwork3.
 	          (invoke #$(file-append gunicorn "/bin/gunicorn")
 		          "-b" #$(string-append "localhost:" (number->string gn3-port))
@@ -709,17 +675,6 @@ server described by CONFIG, a <genenetwork-configuration> object."
               (use-modules (guix build utils)
                            (ice-9 match))
 
-              (define (hline)
-                "Print a horizontal line 50 '=' characters long."
-                (display (make-string 50 #\=))
-                (newline)
-                (force-output))
-
-              (define (show-head-commit)
-                (hline)
-                (invoke "git" "log" "--max-count" "1")
-                (hline))
-
 	      (setenv "GIT_PAGER" #$(file-append coreutils-minimal "/bin/cat"))
 
               (let ((gn-auth-checkout (string-append #$repositories-checkout-directory "/gn-auth"))
@@ -757,8 +712,8 @@ server described by CONFIG, a <genenetwork-configuration> object."
                 (setenv "HOME" "/tmp")
                 (setenv "AUTHLIB_INSECURE_TRANSPORT" "true")
                 ;; Run gn-auth.
+                (invoke #$%show-commits gn-auth-checkout)
                 (with-directory-excursion gn-auth-checkout
-                  (show-head-commit)
                   (invoke #$(file-append gunicorn "/bin/gunicorn")
                           "-b" #$(string-append "localhost:" (number->string gn-auth-port))
                           "--workers" "8"
@@ -772,16 +727,6 @@ server described by CONFIG, a <genenetwork-configuration> object."
      #~(begin
          (use-modules (guix build utils))
 
-         (define (hline)
-           "Print a horizontal line 50 '=' characters long."
-           (display (make-string 50 #\=))
-           (newline)
-           (force-output))
-
-         (define (show-head-commit)
-           (hline)
-           (invoke "git" "log" "--max-count" "1")
-           (hline))
          ;; KLUDGE: Here we set all the certificates properly.  In gn-guile,
          ;; we make request to external services.  Here's an example:
          ;; curl http://localhost:8091/gene/aliases/Shh
@@ -819,10 +764,10 @@ server described by CONFIG, a <genenetwork-configuration> object."
 	    (when (file-exists? "gn-guile")
               (delete-file-recursively "gn-guile"))
 	    (invoke "git" "clone" "--depth" "1" "https://git.genenetwork.org/gn-guile" "gn-guile")
+            (invoke #$%show-commits gn-guile-checkout)
             (with-directory-excursion
 		"gn-guile"
 	      (setenv "HOME" gn-guile-checkout) ;; why?
-	      (show-head-commit)
 	      (invoke #$(file-append gn-guile "/bin/gn-guile")
 		      "--port"
 		      (number->string #$gn-guile-port)