From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id gKvNAQ/DUV8xAgAA0tVLHw (envelope-from ) for ; Fri, 04 Sep 2020 04:31:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id eGxfOQ7DUV/vKAAA1q6Kng (envelope-from ) for ; Fri, 04 Sep 2020 04:31:10 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 886119401CF for ; Fri, 4 Sep 2020 04:31:10 +0000 (UTC) Received: from localhost ([::1]:54760 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kE3NV-0005V3-8V for larch@yhetil.org; Fri, 04 Sep 2020 00:31:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33564) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kE3NO-0005Od-Hy for guix-patches@gnu.org; Fri, 04 Sep 2020 00:31:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53565) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kE3NO-0001fv-8a for guix-patches@gnu.org; Fri, 04 Sep 2020 00:31:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kE3NO-0007Uh-3I for guix-patches@gnu.org; Fri, 04 Sep 2020 00:31:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43193] [PATCH] guix: Add --with-dependency-source option Resent-From: Jesse Gibbons Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 04 Sep 2020 04:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43193@debbugs.gnu.org X-Debbugs-Original-To: Guix Patches Received: via spool by submit@debbugs.gnu.org id=B.159919382128732 (code B ref -1); Fri, 04 Sep 2020 04:31:01 +0000 Received: (at submit) by debbugs.gnu.org; 4 Sep 2020 04:30:21 +0000 Received: from localhost ([127.0.0.1]:36872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kE3Mi-0007TM-Oq for submit@debbugs.gnu.org; Fri, 04 Sep 2020 00:30:21 -0400 Received: from lists.gnu.org ([209.51.188.17]:34186) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kE3Mi-0007TF-1L for submit@debbugs.gnu.org; Fri, 04 Sep 2020 00:30:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33344) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kE3Mh-0005Ew-Qp for guix-patches@gnu.org; Fri, 04 Sep 2020 00:30:19 -0400 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]:43288) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kE3Mf-0001Pj-Cy for guix-patches@gnu.org; Fri, 04 Sep 2020 00:30:19 -0400 Received: by mail-pl1-x62b.google.com with SMTP id y6so551244plk.10 for ; Thu, 03 Sep 2020 21:30:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-language; bh=4IUevJTUERpGOl8SI9KH70iFuI4TYIfmHkFHscj2MYY=; b=ZgIW9bzr1Ulg7RgDu8ekydh9V6YML+hltYK9HWgfr0bJtDLFJcNF1zw86ZHOH6HSmV 0JRNsJOlOc3PznDnq+CFptAk1lRUJiIuQyAcwF3FEipsaE3IGZNzZp1p0lampY1rjbjL 3m2F7kifI1Tsyo2iNxX8tI6vXsTybXsMq3QdilDdebdEFx8SnZXUIDcqL7R3MwUCqwOe cd6cOPf+m+u7xy294xR+cQ1mNMBETXyMqCxswwttUxD5hOXi4oRF4RpokHZVn47lAAta t2NKJ+SJai3lPKCw5nAVzqaaTGkB5fc9vhlxxOuskzveatbU1/2ZArfLwVRU7Ex9qzuY a10A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language; bh=4IUevJTUERpGOl8SI9KH70iFuI4TYIfmHkFHscj2MYY=; b=d2FR7U8jXp+xSDK0A5/plBhbHChjSoIOBtIE7IQv6ruEXecDOuv2K+c+L2JpKBAFtE jPtzRpwtBnW3AbwPH1/OeZcazhj6BMzOlFtK75bEa9qtaXSAGH45mhZrRzHxEAzBlWaE AKsZdV/7v0Pew5EVoxgq6JESEMUVr5dOEXMzWxPPUGy1fKDRfLQmfuN8xzV3wyxQnKup xuM/au3JDU4hlQHBucZXvWvk/51eqVGGW/HUNOiI5imWsRKsOIs4lBWodQZ3Wklvw5sY XtIfB8lT8klzyYYqLMtK08TP4h9S3dAclmbOxxaHV3axN/E0fxn9OWJWYxQb5B2pyMug nDnw== X-Gm-Message-State: AOAM530BUv7VsdJUER+nmGn6HOJDgtHMQOJrOx3W6dv/iPvSt01ZfsXC GJEBJccDaNVmYuF2Mv+3/EfkkRfGVhsMAw== X-Google-Smtp-Source: ABdhPJzpQ5xMTCpKWw0qoFPAInIAhng0CkrMZ4nvBWyLw+MZfjY1o4RJ7wdLwJ9S1viXg1bT3lyMSg== X-Received: by 2002:a17:90b:33ca:: with SMTP id lk10mr6043520pjb.233.1599193813231; Thu, 03 Sep 2020 21:30:13 -0700 (PDT) Received: from [192.168.1.25] ([38.141.58.134]) by smtp.gmail.com with ESMTPSA id h11sm4166919pgm.79.2020.09.03.21.30.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Sep 2020 21:30:12 -0700 (PDT) From: Jesse Gibbons Message-ID: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> Date: Thu, 3 Sep 2020 22:30:02 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.12.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------F77E79CE07BDCC6D5D304517" Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=jgibbons2357@gmail.com; helo=mail-pl1-x62b.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.2 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -2.1 (--) X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=fail (rsa verify failed) header.d=gmail.com header.s=20161025 header.b=ZgIW9bzr; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 0.09 X-TUID: gvPMIv5DgrQZ This is a multi-part message in MIME format. --------------F77E79CE07BDCC6D5D304517 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit     The attached patch adds support for the --with-dependency-source common build option. It can be used to specify the sources of dependencies of specified packages. With this step, we can close #42155. This is also a step in closing #43061. Note that I suggested making a new --with-dependency-source=package=source build option in response to #42155 and nobody responded with an objection. So I am sending this patch with the assumption that there are no objections to this new build option, and that if a member of the community wants to completely replace the behavior of --with-source with the behavior of the new option, that person can do the work required to not break --with-source=source. -Jesse --------------F77E79CE07BDCC6D5D304517 Content-Type: text/x-patch; charset=UTF-8; name="v1-0001-guix-Add-with-dependency-source-option.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="v1-0001-guix-Add-with-dependency-source-option.patch" >From 91a89277067fd454ad77edb3a09ed06382f3694c Mon Sep 17 00:00:00 2001 From: Jesse Gibbons Date: Thu, 3 Sep 2020 17:45:08 -0600 Subject: [PATCH v1 1/1] guix: Add --with-dependency-source option * guix/scripts/build.scm: (transform-package-inputs/source): new function (evaluate-source-replacement-specs): new function (%transformations): add with-dependency-source option (%transformation-options): add with-dependency-source-option (show-transformation-options-help): document --with-dependency-source --- guix/scripts/build.scm | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 6286a43c02..0713595a00 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -280,6 +280,24 @@ current 'gnutls' package, after which version 3.5.4 is grafted onto them." (rewrite obj) obj)))) +(define (transform-package-inputs/source replacement-specs) + "Return a procedure that, when passed a package, replaces its direct +dependencies according to REPLACEMENT-SPECS. REPLACEMENT-SPECS is a list of +strings like \"guile=/path/to/source\" or +\"guile=https://www.example.com/guile-source.tar.gz\" meaning that, any +dependency on a package called \"guile\" must be replaced with a dependency on a +\"guile\" built with the source at the specified location." + (lambda (store obj) + (let* ((replacements (evaluate-source-replacement-specs replacement-specs + (lambda (old url) + (package-with-source store old url)))) + (rewrite (package-input-rewriting/spec replacements)) + (rewrite* (lambda (obj) + (rewrite obj)))) + (if (package? obj) + (rewrite* obj) + obj)))) + (define %not-equal (char-set-complement (char-set #\=))) @@ -314,6 +332,21 @@ syntax, or if a package it refers to could not be found." (leave (G_ "invalid replacement specification: ~s~%") spec)))) specs)) +(define (evaluate-source-replacement-specs specs proc) + "Parse SPECS, a list of strings like \"guile=/path/to/source\", and return a +list of package pairs, where (PROC PACKAGE URL) returns the replacement package. +Raise an error if an element of SPECS uses invalid syntax, or if a package it +refers to could not be found." + (map (lambda (spec) + (match (string-tokenize spec %not-equal) + ((spec url) + (define (replace old) + (proc old url)) + (cons spec replace)) + (x + (leave (G_ "invalid replacement specification: ~s~%") spec)))) + specs)) + (define (transform-package-source-branch replacement-specs) "Return a procedure that, when passed a package, replaces its direct dependencies according to REPLACEMENT-SPECS. REPLACEMENT-SPECS is a list of @@ -399,6 +432,7 @@ a checkout of the Git repository at the given URL." ;; procedure; it is called with two arguments: the store, and a list of ;; things to build. `((with-source . ,transform-package-source) + (with-dependency-source . ,transform-package-inputs/source) (with-input . ,transform-package-inputs) (with-graft . ,transform-package-inputs/graft) (with-branch . ,transform-package-source-branch) @@ -414,6 +448,8 @@ a checkout of the Git repository at the given URL." rest))))) (list (option '("with-source") #t #f (parser 'with-source)) + (option '("with-dependency-source") #t #f + (parser 'with-dependency-source)) (option '("with-input") #t #f (parser 'with-input)) (option '("with-graft") #t #f @@ -429,6 +465,9 @@ a checkout of the Git repository at the given URL." (display (G_ " --with-source=SOURCE use SOURCE when building the corresponding package")) + (display (G_ " + --with-dependency-source=PACKAGE=SOURCE + use SOURCE when building the corresponding dependency package")) (display (G_ " --with-input=PACKAGE=REPLACEMENT replace dependency PACKAGE by REPLACEMENT")) -- 2.28.0 --------------F77E79CE07BDCC6D5D304517--