;; disfluid, implementation of the Solid specification ;; Copyright (C) 2020, 2021 Vivien Kraus ;; This program is free software: you can redistribute it and/or modify ;; it under the terms of the GNU Affero General Public License as ;; published by the Free Software Foundation, either version 3 of the ;; License, or (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU Affero General Public License for more details. ;; You should have received a copy of the GNU Affero General Public License ;; along with this program. If not, see . (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 show -s --format=%cI > ~a/release-date" 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)) (release-date (call-with-input-file (string-append tmp-dirname "/release-date") 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/disfluid.scm" #o644) (let ((port (open-file "vkraus/packages/disfluid.scm" "a"))) (write `(define-public disfluid (disfluid-release ,version ,release-date ,commit ,hash)) port) (display "\n" port) (write `(define-public disfluid-html (disfluid-htmlize disfluid)) port) (display "\n" port) (write `(define-public disfluid:website (make-website disfluid)) 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"))