From 91be09de61c277d0f1b26cefcefcd0a7fae2e00d Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Tue, 24 Dec 2019 15:04:57 +0100 Subject: profiles: Fix profile-derivation cross-compilation. * guix/store.scm (current-target-system): New exported monadic procedure. * guix/profiles.scm (profile-derivation): Set target at bind time using the above procedure. --- guix/store.scm | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'guix/store.scm') diff --git a/guix/store.scm b/guix/store.scm index cf25d347fc..f99fa581a8 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2018 Jan Nieuwenhuizen +;;; Copyright © 2019 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -159,6 +160,7 @@ %guile-for-build current-system set-current-system + current-target-system text-file interned-file interned-file-tree @@ -1816,6 +1818,11 @@ the store." (lambda (state) (values (%current-system system) state))) +(define-inlinable (current-target-system) + ;; Consult the %CURRENT-TARGET-SYSTEM fluid at bind time. + (lambda (state) + (values (%current-target-system) state))) + (define %guile-for-build ;; The derivation of the Guile to be used within the build environment, ;; when using 'gexp->derivation' and co. -- cgit v1.2.3 From 68dbd5c9de78ad803cc33973db40d22e29c532ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 30 Jan 2020 01:17:54 +0100 Subject: gexp: Move 'file-mapping->tree' to (guix store). * guix/gexp.scm (%not-slash): Remove. (file-mapping->tree): Move to... * guix/store.scm (file-mapping->tree): ... here. --- guix/store.scm | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'guix/store.scm') diff --git a/guix/store.scm b/guix/store.scm index f99fa581a8..77ee23fdd8 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -103,6 +103,7 @@ add-text-to-store add-to-store add-file-tree-to-store + file-mapping->tree binary-file build-things build @@ -1220,6 +1221,45 @@ an arbitrary directory layout in the store without creating a derivation." (hash-set! cache tree result) result))))) +(define (file-mapping->tree mapping) + "Convert MAPPING, an alist like: + + ((\"guix/build/utils.scm\" . \"…/utils.scm\")) + +to a tree suitable for 'add-file-tree-to-store' and 'interned-file-tree'." + (let ((mapping (map (match-lambda + ((destination . source) + (cons (string-tokenize destination %not-slash) + source))) + mapping))) + (fold (lambda (pair result) + (match pair + ((destination . source) + (let loop ((destination destination) + (result result)) + (match destination + ((file) + (let* ((mode (stat:mode (stat source))) + (type (if (zero? (logand mode #o100)) + 'regular + 'executable))) + (alist-cons file + `(,type (file ,source)) + result))) + ((file rest ...) + (let ((directory (assoc-ref result file))) + (alist-cons file + `(directory + ,@(loop rest + (match directory + (('directory . entries) entries) + (#f '())))) + (if directory + (alist-delete file result) + result))))))))) + '() + mapping))) + (define build-things (let ((build (operation (build-things (string-list things) (integer mode)) -- cgit v1.2.3 From fdae0fa50acfee57854f6978c3b300bc46aedc68 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Fri, 6 Mar 2020 10:06:02 +0100 Subject: store: Add set-current-target procedure. * guix/store.scm (set-current-target): New exported procedure. --- guix/store.scm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'guix/store.scm') diff --git a/guix/store.scm b/guix/store.scm index 77ee23fdd8..c616484577 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -1,7 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2018 Jan Nieuwenhuizen -;;; Copyright © 2019 Mathieu Othacehe +;;; Copyright © 2019, 2020 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -162,6 +162,7 @@ current-system set-current-system current-target-system + set-current-target text-file interned-file interned-file-tree @@ -1863,6 +1864,11 @@ the store." (lambda (state) (values (%current-target-system) state))) +(define-inlinable (set-current-target target) + ;; Set the %CURRENT-TARGET-SYSTEM fluid at bind time. + (lambda (state) + (values (%current-target-system target) state))) + (define %guile-for-build ;; The derivation of the Guile to be used within the build environment, ;; when using 'gexp->derivation' and co. -- cgit v1.2.3