summaryrefslogtreecommitdiff
path: root/update-channel.scm
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2020-01-01 00:00:00 +0100
committerVivien Kraus <vivien@planete-kraus.eu>2021-06-19 15:36:55 +0200
commit443c2c3357e491da1b520d3979798092cf2e6fb2 (patch)
treeb0349aa58c588f15ae809235df8670e8af4870a0 /update-channel.scm
parent0e29ddc3c41870e14da87770a429a94f80dd4110 (diff)
Set up the project infrastructure
Diffstat (limited to 'update-channel.scm')
-rw-r--r--update-channel.scm83
1 files changed, 83 insertions, 0 deletions
diff --git a/update-channel.scm b/update-channel.scm
new file mode 100644
index 0000000..bc19332
--- /dev/null
+++ b/update-channel.scm
@@ -0,0 +1,83 @@
+(use-modules (gnu packages bash))
+(use-modules (gnu packages base))
+(use-modules (gnu packages tex))
+(use-modules (gnu packages code))
+(use-modules (gnu packages version-control))
+(use-modules (guix build-system gnu))
+(use-modules (guix packages))
+(use-modules (guix gexp))
+(use-modules (guix modules))
+(use-modules (guix build utils))
+(use-modules (guix store))
+(use-modules (ice-9 textual-ports))
+(use-modules (ice-9 rdelim))
+
+(unsetenv "GIT_DIR")
+
+(let ((tmp-dirname (tmpnam))
+ (git
+ (run-with-store
+ (open-connection)
+ (package-file git "bin/git")))
+ (bash
+ (run-with-store
+ (open-connection)
+ (package-file bash "bin/bash")))
+ (tar
+ (run-with-store
+ (open-connection)
+ (package-file tar "bin/tar"))))
+ (format (current-error-port) "Found the required programs:
+- git: ~a
+- bash: ~a
+- tar: ~a
+"
+ git bash tar)
+ (format (current-error-port) "Using temporary directory ~a\n" tmp-dirname)
+ (mkdir tmp-dirname)
+ (mkdir (string-append tmp-dirname "/source"))
+ (invoke git "archive" "master" "-o" (string-append tmp-dirname "/source/source.tar.gz"))
+ (with-directory-excursion
+ (string-append tmp-dirname "/source")
+ (invoke tar "xf" (string-append tmp-dirname "/source/source.tar.gz"))
+ (delete-file (string-append tmp-dirname "/source/source.tar.gz")))
+ (with-directory-excursion
+ tmp-dirname
+ (invoke bash "-c" (format #f "guix hash -r source > hash")))
+ (invoke bash "-c" (format #f "~a describe --tags --always > ~a/version" git tmp-dirname))
+ (invoke bash "-c" (format #f "~a rev-parse master > ~a/commit" git tmp-dirname))
+ (let ((hash (call-with-input-file (string-append tmp-dirname "/hash") read-line))
+ (version (call-with-input-file (string-append tmp-dirname "/version") read-line))
+ (commit (call-with-input-file (string-append tmp-dirname "/commit") read-line))
+ (interned-modules
+ (run-with-store
+ (open-connection)
+ (interned-file (string-append tmp-dirname "/source/guix") "ci-checkout" #:recursive? #t)))
+ (base-repository (getcwd)))
+ (delete-file-recursively tmp-dirname)
+ (invoke git "clone" (format #f "~a/../webid-oidc-channel" base-repository) tmp-dirname)
+ (with-directory-excursion
+ tmp-dirname
+ (invoke git "rm" "-f" "-r" "--ignore-unmatch" ".")
+ (copy-recursively interned-modules "." #:follow-symlinks? #t)
+ (chmod "vkraus/packages/webid-oidc.scm" #o644)
+ (let ((port (open-file "vkraus/packages/webid-oidc.scm" "a")))
+ (write `(define-public webid-oidc
+ (webid-oidc-release ,version ,commit ,hash))
+ port)
+ (display "\n" port)
+ (write `(define-public webid-oidc-html
+ (webid-oidc-htmlize webid-oidc))
+ port)
+ (display "\n" port)
+ (write `(define-public webid-oidc:website
+ (make-website webid-oidc))
+ port)
+ (display "\n" port)
+ (close-port port))
+ (invoke git "add" "-A")
+ (invoke bash "-c" (format #f "~a diff-index --quiet HEAD || ~a commit -m 'Update package'"
+ git git))
+ (invoke git "push" "origin" "master"))))
+
+#~(system* #$(file-append hello "/bin/hello"))