diff options
author | Christopher Baines <mail@cbaines.net> | 2022-05-26 00:24:55 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-05-26 00:24:55 +0100 |
commit | fb8353559fc45653c4eaa132e85456b2fbe94342 (patch) | |
tree | 898d3b4a9fd860ff9d033803dbc9d0431074017e | |
parent | 786a5fa0416bdebaf185d228a03791b92277d9e5 (diff) | |
download | data-service-fb8353559fc45653c4eaa132e85456b2fbe94342.tar data-service-fb8353559fc45653c4eaa132e85456b2fbe94342.tar.gz |
Take advantage of the new (guix platform) module
This means there's less reliance on the hardcoded lists of systems and targets
and mappings between them.
-rw-r--r-- | guix-data-service/jobs/load-new-guix-revision.scm | 92 |
1 files changed, 70 insertions, 22 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index a14d1f6..d11ab3b 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -353,9 +353,30 @@ WHERE job_id = $1") lock time-spent)) result))))) +(define (inferior-guix-systems inf) + (cond + ((inferior-eval + '(defined? 'systems + (resolve-module '(guix platform))) + inf) + + (remove + (lambda (system) + ;; There aren't currently bootstrap binaries for s390x-linux, so this + ;; just leads to lots of errors + (string=? system "s390x-linux")) + (inferior-eval + '((@ (guix platform) systems)) + inf))) + + (else + (inferior-eval + '(@ (guix packages) %supported-systems) + inf)))) + (define (all-inferior-system-tests inf store) - (define inferior-%supported-systems - (inferior-eval '(@ (guix packages) %supported-systems) inf)) + (define inf-systems + (inferior-guix-systems inf)) (define extract `(lambda (store) @@ -387,7 +408,7 @@ WHERE job_id = $1") system key args) #f))) - (list ,@inferior-%supported-systems)) + (list ,@inf-systems)) (match (system-test-location system-test) (($ <location> file line column) (list file @@ -591,24 +612,37 @@ WHERE job_id = $1") checkers)))) (define (all-inferior-package-derivations store inf packages) - (define inferior-%supported-systems - (inferior-eval '(@ (guix packages) %supported-systems) inf)) + (define inf-systems + (inferior-guix-systems inf)) + + (define inf-targets + (cond + ((inferior-eval + '(defined? 'targets + (resolve-module '(guix platform))) + inf) + (inferior-eval + '((@ (guix platform) targets)) + inf)) + + (else + '("arm-linux-gnueabihf" + "aarch64-linux-gnu" + "mips64el-linux-gnu" + "powerpc-linux-gnu" + "powerpc64le-linux-gnu" + "riscv64-linux-gnu" + "i586-pc-gnu" + "i686-w64-mingw32" + "x86_64-w64-mingw32")))) (define cross-derivations - `(("x86_64-linux" . ("arm-linux-gnueabihf" - "aarch64-linux-gnu" - "mips64el-linux-gnu" - "powerpc-linux-gnu" - "powerpc64le-linux-gnu" - "riscv64-linux-gnu" - "i586-pc-gnu" - "i686-w64-mingw32" - "x86_64-w64-mingw32")))) + `(("x86_64-linux" . ,inf-targets))) (define supported-system-pairs (map (lambda (system) (cons system #f)) - inferior-%supported-systems)) + inf-systems)) (define supported-system-cross-build-pairs (append-map @@ -622,13 +656,22 @@ WHERE job_id = $1") (define (proc packages system-target-pairs) `(lambda (store) (define target-system-alist - '(("arm-linux-gnueabihf" . "armhf-linux") - ("aarch64-linux-gnu" . "aarch64-linux") - ("mips64el-linux-gnu" . "mips64el-linux") - ("powerpc-linux-gnu" . "powerpc-linux") - ("powerpc64le-linux-gnu" . "powerpc64le-linux") - ("riscv64-linux-gnu" . "riscv64-linux") - ("i586-pc-gnu" . "i586-gnu"))) + (if (defined? 'platforms (resolve-module '(guix platform))) + (filter-map + (lambda (platform) + (and + (platform-target platform) + (cons (platform-target platform) + (platform-system platform)))) + (platforms)) + + '(("arm-linux-gnueabihf" . "armhf-linux") + ("aarch64-linux-gnu" . "aarch64-linux") + ("mips64el-linux-gnu" . "mips64el-linux") + ("powerpc-linux-gnu" . "powerpc-linux") + ("powerpc64le-linux-gnu" . "powerpc64le-linux") + ("riscv64-linux-gnu" . "riscv64-linux") + ("i586-pc-gnu" . "i586-gnu")))) (define package-transitive-supported-systems-supports-multiple-arguments? #t) (define (get-supported-systems package system) @@ -749,6 +792,11 @@ WHERE job_id = $1") '())))))) (list ,@(map inferior-package-id packages))))) + (inferior-eval + '(when (defined? 'systems (resolve-module '(guix platform))) + (use-modules (guix platform))) + inf) + (append-map (lambda (system-target-pair) (format (current-error-port) |