diff options
author | Vivien Kraus <vivien@planete-kraus.eu> | 2020-01-01 00:00:00 +0100 |
---|---|---|
committer | Vivien Kraus <vivien@planete-kraus.eu> | 2021-06-19 15:36:55 +0200 |
commit | 443c2c3357e491da1b520d3979798092cf2e6fb2 (patch) | |
tree | b0349aa58c588f15ae809235df8670e8af4870a0 /ci.scm | |
parent | 0e29ddc3c41870e14da87770a429a94f80dd4110 (diff) |
Set up the project infrastructure
Diffstat (limited to 'ci.scm')
-rw-r--r-- | ci.scm | 75 |
1 files changed, 75 insertions, 0 deletions
@@ -0,0 +1,75 @@ +(use-modules (vkraus packages webid-oidc)) +(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)) + +(define ref + (getenv "CI_REF")) + +(let ((checked-out-index + (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")))) + (mkdir tmp-dirname) + (if ref + (begin + (invoke git "archive" ref "-o" (string-append tmp-dirname "/source.tar.gz")) + (with-directory-excursion + tmp-dirname + (invoke tar "xf" (string-append tmp-dirname "/source.tar.gz")) + (delete-file (string-append tmp-dirname "/source.tar.gz")))) + (invoke git + "checkout-index" + (format #f "--prefix=~a/" tmp-dirname) + "-a")) + (invoke bash + "-c" + (format #f "~a describe ~a --tags --always > ~a/.tarball-version" + git (or ref "") tmp-dirname)) + (let ((interned + (run-with-store + (open-connection) + (interned-file tmp-dirname "ci-checkout" #:recursive? #t)))) + (delete-file-recursively tmp-dirname) + interned)))) + (let ((dist-without-maintainer (dist-package webid-oidc-snapshot checked-out-index)) + (version + (car + (string-split + (call-with-input-file (string-append checked-out-index "/.tarball-version") + get-string-all) + #\newline)))) + (let ((tar-name (string-append "webid-oidc-" version ".tar.gz"))) + (computed-file + tar-name + #~(let ((source + #$(file-append + (package + (inherit dist-without-maintainer) + (native-inputs + (cons* `("indent" ,indent) + `("texlive" ,texlive) + (package-native-inputs dist-without-maintainer)))) + "/" tar-name)) + (destination #$output)) + (format (current-error-port) "Symlinking ~a -> ~a...\n" source destination) + (symlink source destination)))))) |