mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-24 05:18:07 -05:00
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.
This commit is contained in:
parent
9e64302d68
commit
93c2a00739
2 changed files with 26 additions and 2 deletions
|
@ -36,6 +36,8 @@ (define-module (guix derivations)
|
|||
#: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 @@ (define derivation-hash ; `hashDerivationModulo' in derivations.cc
|
|||
;; 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 @@ (define* (derivation store name builder args
|
|||
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 @@ (define (env-vars-with-empty-outputs env-vars)
|
|||
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 @@ (define %build-inputs
|
|||
,@(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)))
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue