blob: f2b1d0264f76142c3e7553774fb040027e2306a6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
;; kenku --- crawl and reproduce github actions
;; Copyright © 2026 bdunahu <bdunahu@operationnull.com>
;;
;; This program 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.
;;
;; 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 General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
(define-module (src build-actions)
#:use-module (srfi srfi-1)
#:use-module (guix scripts environment)
#:use-module ((src utils) #:prefix util:)
#:use-module ((src config) #:prefix conf:)
#:use-module ((ice-9 rdelim))
#:use-module ((src crawl-lockfiles) #:prefix lock:)
#:export (build-actions))
(define (make-in-vicinity dir f)
(let ((dir (in-vicinity dir f)))
(util:mkdir-p dir)
dir))
(define (build-actions)
(let* ((build-action-sh (in-vicinity conf:scripts-dir "build-action.sh"))
(time (strftime "%Y-%m-%d_%H-%M-%S" (localtime (current-time))))
(dir (string-append conf:cache-dir "/build-" time))
(bf (make-in-vicinity dir "build-failures"))
(ma (make-in-vicinity dir "missing-artifact"))
(mr (make-in-vicinity dir "maybe-reproducible"))
(r (make-in-vicinity dir "reproducible"))
(packages '("bash"
"coreutils"
"diffoscope"
"dos2unix"
"findutils"
"gawk"
"git"
"grep"
"node"
"nss-certs"
"python"
"sed"
"xxd"
"diffutils"))
(opts '("--network" "--emulate-fhs" "--container"
"--preserve='^TERM$'")) ;diffoscope needs this
(cmd `("--" "bash" ,build-action-sh
"~a" "~a" "./~a" "~a" "~a" "~a" "~a")))
(call-with-input-file lock:npm-file
(lambda (port)
(let loop ()
(let ((line (read-line port)))
(unless (eof-object? line)
(let* ((list (string-split line char-set:whitespace))
(repo (car list))
(sha (cadr list))
(lock-dir (dirname (caddr list))))
(format #t "Starting build of ~a@~a~%" repo sha)
(system (format #f (string-join (append '("guix" "shell")
opts
packages
cmd)
" ")
repo sha lock-dir bf ma mr r)))
(loop))))))
(format #t "Done! Check ~a.~%" dir)))
|