[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
09/11: derivations: Deprecate the previous calling convention.
From: |
guix-commits |
Subject: |
09/11: derivations: Deprecate the previous calling convention. |
Date: |
Mon, 15 Jul 2019 04:18:17 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 93c2a0073945e8c3967cdb0e250d3341f7dcac71
Author: Ludovic Courtès <address@hidden>
Date: Wed Jul 10 18:18:19 2019 +0200
derivations: Deprecate the previous calling convention.
We will eventually require #:inputs to be a list of <derivation-input>;
store items will have to be passed as #:sources, already interned.
* guix/derivations.scm (warn-about-derivation-deprecation): New procedure.
(derivation): Add #:%deprecation-warning? parameter.
[warn-deprecation]: New macro.
[input->derivation-input, input->source]: Use it.
(build-expression->derivation): Pass #:%deprecation-warning?.
* po/guix/POTFILES.in: Add guix/derivations.scm.
---
guix/derivations.scm | 27 +++++++++++++++++++++++++--
po/guix/POTFILES.in | 1 +
2 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/guix/derivations.scm b/guix/derivations.scm
index a184785..23d058e 100644
--- a/guix/derivations.scm
+++ b/guix/derivations.scm
@@ -36,6 +36,8 @@
#:use-module (guix memoization)
#:use-module (guix combinators)
#:use-module (guix deprecation)
+ #:use-module (guix diagnostics)
+ #:use-module (guix i18n)
#:use-module (guix monads)
#:use-module (gcrypt hash)
#:use-module (guix base32)
@@ -705,6 +707,13 @@ name of each input with that input's hash."
;; character.
(sha256 (derivation->bytevector (derivation/masked-inputs drv)))))))
+
+(define (warn-about-derivation-deprecation name)
+ ;; TRANSLATORS: 'derivation' must not be translated; it refers to the
+ ;; 'derivation' procedure.
+ (warning (G_ "in '~a': deprecated 'derivation' calling convention used~%")
+ name))
+
(define* (derivation store name builder args
#:key
(system (%current-system)) (env-vars '())
@@ -715,7 +724,8 @@ name of each input with that input's hash."
allowed-references disallowed-references
leaked-env-vars local-build?
(substitutable? #t)
- (properties '()))
+ (properties '())
+ (%deprecation-warning? #t))
"Build a derivation with the given arguments, and return the resulting
<derivation> object. When HASH and HASH-ALGO are given, a
fixed-output derivation is created---i.e., one whose result is known in
@@ -832,19 +842,28 @@ derivation. It is kept as-is, uninterpreted, in the
derivation."
e
outputs)))
+ (define-syntax-rule (warn-deprecation name)
+ (when %deprecation-warning?
+ (warn-about-derivation-deprecation name)))
+
(define input->derivation-input
(match-lambda
((? derivation-input? input)
input)
(((? derivation? drv))
+ (warn-deprecation name)
(make-derivation-input drv '("out")))
(((? derivation? drv) sub-drvs ...)
+ (warn-deprecation name)
(make-derivation-input drv sub-drvs))
- (_ #f)))
+ (_
+ (warn-deprecation name)
+ #f)))
(define input->source
(match-lambda
(((? string? input) . _)
+ (warn-deprecation name)
(if (direct-store-path? input)
input
(add-to-store store (basename input)
@@ -1320,6 +1339,10 @@ and PROPERTIES."
,@(if mod-dir `("-L" ,mod-dir) '())
,builder)
+ ;; 'build-expression->derivation' is somewhat deprecated so
+ ;; don't bother warning here.
+ #:%deprecation-warning? #f
+
#:system system
#:inputs `((,(or guile-for-build (%guile-for-build)))
diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in
index f5fc495..ad06ebc 100644
--- a/po/guix/POTFILES.in
+++ b/po/guix/POTFILES.in
@@ -80,6 +80,7 @@ guix/channels.scm
guix/profiles.scm
guix/git.scm
guix/deprecation.scm
+guix/derivations.scm
gnu/build/bootloader.scm
nix/nix-daemon/guix-daemon.cc
- branch master updated (2f3c0fb -> 9af75a2), guix-commits, 2019/07/15
- 02/11: syscalls: Use 'define-as-needed' for 'AT_' constants introduced in Guile 2.2.5., guix-commits, 2019/07/15
- 01/11: compile: Report the name of the file that cannot be compiled., guix-commits, 2019/07/15
- 06/11: download: Use the new 'derivation' calling convention., guix-commits, 2019/07/15
- 03/11: derivations: 'derivation' primitive accepts <derivation> and #:sources., guix-commits, 2019/07/15
- 05/11: gnu: guile-bootstrap: Use the new 'derivation' calling convention., guix-commits, 2019/07/15
- 07/11: derivations: 'map-derivation' uses the new 'derivation' calling convention., guix-commits, 2019/07/15
- 10/11: gexp: 'lowered-gexp-guile' now returns a <derivation-input>., guix-commits, 2019/07/15
- 04/11: gexp: <lowered-gexp> separates sources from derivation inputs., guix-commits, 2019/07/15
- 09/11: derivations: Deprecate the previous calling convention.,
guix-commits <=
- 11/11: channels: Avoid use of 'derivation-input-path'., guix-commits, 2019/07/15
- 08/11: derivations: Update tests to use new calling convention., guix-commits, 2019/07/15