From patchwork Wed Jul 10 17:11:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 14567 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id A06AE171E2; Wed, 10 Jul 2019 18:13:24 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 5AA6E171DD for ; Wed, 10 Jul 2019 18:13:24 +0100 (BST) Received: from localhost ([::1]:35550 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlG9k-0008E9-1y for patchwork@mira.cbaines.net; Wed, 10 Jul 2019 13:13:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45444) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hlG9U-0007nI-Ne for guix-patches@gnu.org; Wed, 10 Jul 2019 13:13:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hlG9S-0003G6-Mp for guix-patches@gnu.org; Wed, 10 Jul 2019 13:13:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:55963) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hlG9R-0003Cm-4y for guix-patches@gnu.org; Wed, 10 Jul 2019 13:13:06 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hlG9Q-0001Dl-Uo for guix-patches@gnu.org; Wed, 10 Jul 2019 13:13:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#36578] [PATCH 7/9] derivations: Deprecate the previous calling convention. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 10 Jul 2019 17:13:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36578 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 36578@debbugs.gnu.org Received: via spool by 36578-submit@debbugs.gnu.org id=B36578.15627787334580 (code B ref 36578); Wed, 10 Jul 2019 17:13:04 +0000 Received: (at 36578) by debbugs.gnu.org; 10 Jul 2019 17:12:13 +0000 Received: from localhost ([127.0.0.1]:36541 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlG8b-0001Bo-2R for submit@debbugs.gnu.org; Wed, 10 Jul 2019 13:12:13 -0400 Received: from eggs.gnu.org ([209.51.188.92]:60838) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hlG8V-0001Ad-JC for 36578@debbugs.gnu.org; Wed, 10 Jul 2019 13:12:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47975) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hlG8Q-000255-G0; Wed, 10 Jul 2019 13:12:02 -0400 Received: from [81.18.188.212] (port=57592 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hlG8P-0005OT-Sv; Wed, 10 Jul 2019 13:12:02 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Wed, 10 Jul 2019 19:11:26 +0200 Message-Id: <20190710171128.21568-7-ludo@gnu.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190710171128.21568-1-ludo@gnu.org> References: <20190710171128.21568-1-ludo@gnu.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches We will eventually require #:inputs to be a list of ; 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 a18478502d..23d058e832 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 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 f5fc4956b4..ad06ebce95 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