From e1ea49675eb84704896623899612e489740ace98 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Mon, 17 Nov 2025 02:16:25 +0000 Subject: guix: Add G-expressions to build release tarball. --- .guix/ravanan-release.scm | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 .guix/ravanan-release.scm diff --git a/.guix/ravanan-release.scm b/.guix/ravanan-release.scm new file mode 100644 index 0000000..98fe157 --- /dev/null +++ b/.guix/ravanan-release.scm @@ -0,0 +1,71 @@ +;;; ravanan --- High-reproducibility CWL runner powered by Guix +;;; Copyright © 2025 Arun Isaac +;;; +;;; This file is part of ravanan. +;;; +;;; ravanan is free software: you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; ravanan 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 +;;; General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with ravanan. If not, see . + +(define-module (ravanan-release) + #:use-module ((gnu packages base) #:select (gnu-make)) + #:use-module ((gnu packages compression) #:select (lzip)) + #:use-module ((gnu packages version-control) #:select (git-minimal)) + #:use-module (guix gexp) + #:use-module (ice-9 match) + #:use-module (ice-9 popen) + #:use-module (srfi srfi-26) + #:use-module (rnrs io ports)) + +(define (call-with-input-pipe command proc) + "Call @var{proc} with input pipe to @var{command}. @var{command} is a list of +program arguments." + (match command + ((prog args ...) + (let ((port #f)) + (dynamic-wind + (lambda () + (set! port (apply open-pipe* OPEN_READ prog args))) + (cut proc port) + (cut close-pipe port)))))) + +(define version + (call-with-input-pipe (list "git" "tag" "--sort=-taggerdate" "--list" "v*") + (lambda (port) + (let ((line (get-line port))) + (if (eof-object? line) + ;; If there are no tags, assume first version. + "0.1.0" + (substring line (string-length "v"))))))) + +(define ravanan-git-repo + (local-file "../.git" + "ravanan-git-repo" + #:recursive? #t)) + +(define ravanan-release-gexp + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + + (set-path-environment-variable + "PATH" '("bin") '(#$git-minimal #$gnu-make #$lzip)) + (invoke "git" "clone" (string-append "file://" #$ravanan-git-repo) (getcwd)) + (invoke "make" "dist" #$(string-append "version=" version)) + (copy-file #$(string-append "ravanan-" version ".tar.lz") + #$output)))) + +(define ravanan-release + (computed-file (string-append "ravanan-" version ".tar.lz") + ravanan-release-gexp)) + +ravanan-release -- cgit 1.4.1