From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id rnHfCRXCW1+BYgAA0tVLHw (envelope-from ) for ; Fri, 11 Sep 2020 18:29:41 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id ADOhAxXCW19TNwAAbx9fmQ (envelope-from ) for ; Fri, 11 Sep 2020 18:29:41 +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 AF68D9408DD for ; Fri, 11 Sep 2020 18:29:40 +0000 (UTC) Received: from localhost ([::1]:42320 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kGnnn-0000Gm-N8 for larch@yhetil.org; Fri, 11 Sep 2020 14:29:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58160) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kGnnD-0008C0-6Y for guix-patches@gnu.org; Fri, 11 Sep 2020 14:29:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33917) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kGnnC-0000c8-TG for guix-patches@gnu.org; Fri, 11 Sep 2020 14:29:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kGnnC-0005rI-R2 for guix-patches@gnu.org; Fri, 11 Sep 2020 14:29: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, 11 Sep 2020 18:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43193 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 43193@debbugs.gnu.org Received: via spool by 43193-submit@debbugs.gnu.org id=B43193.159984893522492 (code B ref 43193); Fri, 11 Sep 2020 18:29:02 +0000 Received: (at 43193) by debbugs.gnu.org; 11 Sep 2020 18:28:55 +0000 Received: from localhost ([127.0.0.1]:45461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGnn5-0005qi-Do for submit@debbugs.gnu.org; Fri, 11 Sep 2020 14:28:55 -0400 Received: from mail-pj1-f66.google.com ([209.85.216.66]:33561) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kGnn3-0005qU-MD for 43193@debbugs.gnu.org; Fri, 11 Sep 2020 14:28:54 -0400 Received: by mail-pj1-f66.google.com with SMTP id md22so2949156pjb.0 for <43193@debbugs.gnu.org>; Fri, 11 Sep 2020 11:28:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=qWr8bIE3UeF57/nVuPkLv2XoGFzIVf9sWyVihsXwdeE=; b=ZMeCeoVaRtdQxT7w4JTrZ8i6/B+Se5zNuoNHPvkKEvo6Jyq5PnSqKna1ProPGBDgwm 6KpxvWhi/7H2s0iO1Cq+ayv2ODeSkiE4Pm74o8HPT/22USZvP/ez3kDSJyZ7jlAOeFW9 aFZm7jQ5lG64WaD51RcqPJBl25DblgJIsMKNe7PBQeQN/wCiANapugLFagpk8OptbaxJ gi9Nle/9woM3xCUM04RmKraQrelysEMaGytwcqrIwxbOBGHY3MMlsSvOUwnrfpr3gVye HmGG3veMe5X+hKwj49BU4w0A+UW18SR0/kApIs4rj0s2yL04bqf5V2xsYyMOlcRhmBlA Kfdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=qWr8bIE3UeF57/nVuPkLv2XoGFzIVf9sWyVihsXwdeE=; b=TiYygkVfITHO+RLoeSjYbuVKm411FynGCIwg/EAzjOpxYpXL2n19tahq9f+BUTOqWZ AKZKdet2kajIzSFZENoRwavbulViZhqY7g1LK7WiDzTIKV0bc1KZgkRXfatd3FYnBBBw jCiJw0RXS8HpWeO9RF7joXWnfX0g6X+xPe84CU9wGizPMFnQKf1F3URhIfx9qNhFYmoL otKP80n3Ap2V4WnR3deXuaDGKJLbG3ajizYnsVOGnZBznxSkqKLAiUHdhaWP6eCqJGal +1BXM0dRZ6gKfJAG+q0sJQk/PNJqRjoIA6/by9D+FMeYkIWaDSFi/g4liQ/GQf694SN8 PB6A== X-Gm-Message-State: AOAM533Kj3x1puuTcXYxBm/Jlv4kbBcl5999eFMZfzKjpfHQykGSRL5h kCX4OoqYSqXJ8we88cdxqLmcAACAYXHA3w== X-Google-Smtp-Source: ABdhPJwj75f3qlFVrMV1RYlARfsCjW5+dxPgPTY1S3UdzgeLZDo07nxlpABb2rcb6XU8U6gKc5fQZg== X-Received: by 2002:a17:90a:65ca:: with SMTP id i10mr3419028pjs.137.1599848927290; Fri, 11 Sep 2020 11:28:47 -0700 (PDT) Received: from [192.168.1.25] ([38.141.58.134]) by smtp.gmail.com with ESMTPSA id r144sm3151881pfc.63.2020.09.11.11.28.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 11 Sep 2020 11:28:46 -0700 (PDT) References: <9c3a00ba-19bf-a8e9-8803-d150e91f1b6e@gmail.com> <87y2lige5l.fsf@gnu.org> <7f52c72f-c280-b585-d1ad-ca012f804910@gmail.com> <87wo10s4j6.fsf@gnu.org> From: Jesse Gibbons Message-ID: <4c890f8c-539c-1c9c-f558-7ba01cffa480@gmail.com> Date: Fri, 11 Sep 2020 12:28:31 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Icedove/68.12.0 MIME-Version: 1.0 In-Reply-To: <87wo10s4j6.fsf@gnu.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Score: -2.2 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.2 (---) 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=ZMeCeoVa; 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: Htp6ZmkUn5dm On 9/11/20 9:43 AM, Ludovic Courtès wrote: > Hi, > > Jesse Gibbons skribis: > >>> Could you: >>> >>> 1. adjust doc/guix.texi accordingly? That is, if we rename this new >>> option to ‘--with-source’, simply add a note stating that it’s >>> recursive. >> I included this in the attached patch. >>> 2. add a test to tests/guix-build.sh? There are already --with-source >>> tests in other files. You can mimic them, essentially to make sure >>> the option has an effect. >>> 3. optionally add an entry as a separate commit to >>> etc/news.scm. I can do that for you if you want. >>> >> Do you still think the tests should be updated and this change should >> be announced in the news file? I'm willing to do these. > Yes, please. There’s should be a test that checks that --with-source > works for non-leaf packages. A new entry would also be nice. I will work on that then. > >> From 2786da1e7011c59f08fc150dfa284f35bc0ed093 Mon Sep 17 00:00:00 2001 >> From: Jesse Gibbons >> Date: Thu, 3 Sep 2020 17:45:08 -0600 >> Subject: [PATCH 1/1] guix: Make --with-source option recursive >> >> * guix/scripts/build.scm: (transform-package-inputs/source): new >> function >> (evaluate-source-replacement-specs): new function >> (%transformations): change with-source to use >> evaluate-source-replacement-specs >> >> *doc/guix.texi (Package Transformation Options): Document it. > Nitpick: There are spacing and capitalization issues. Please see ‘git > log’ for examples. I'll fix this. >> +++ b/doc/guix.texi >> @@ -9129,7 +9129,8 @@ without having to type in the definitions of package variants >> @itemx --with-source=@var{package}=@var{source} >> @itemx --with-source=@var{package}@@@var{version}=@var{source} >> Use @var{source} as the source of @var{package}, and @var{version} as >> -its version number. >> +its version number. This replacement is applied recursively on all >> +dependencies only if PACKAGE is specified. > s/PACKAGE/@var{package}/ > > However, the semantics are a bit “weird”. I would just do the recursive > replacement thing unconditionally. WDYT? > >> +(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." >> + (match (string-tokenize (car replacement-specs) %not-equal) >> + ((spec url) > s/url/file/ since it’s a file name. > >> + (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)))) >> + ((url) >> + (transform-package-source replacement-specs)))) > So maybe drop the second clause for non-recursive replacement, and drop > ‘transform-package-source’ as well. I included a fallback to transform-package-source because the following happens: $ ./pre-inst-env guix build --with-source=$(guix build --source hello) hello guix build: error: invalid source replacement specification: "/gnu/store/hbdalsf5lpf01x4dcknwx6xbn6n5km6k-hello-2.10.tar.gz" This does not fail when I fall back to the non-recursive logic. I can drop transform-package-source, but I will need to do some more hacking to figure out how the package name and version are parsed from the file name as described in the manual, and move it to the logic in transform-package-inputs/source. I'm not going to have as much free time starting next week, so I might not be able to do that for a while, but I will try to get it done ASAP. > > Thanks! > > Ludo’.