From unknown Sun Aug 17 01:50:04 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#45773] [PATCH core-updates 0/1] Allow patch-and-repack to work with plain files. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 10 Jan 2021 20:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 45773 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45773@debbugs.gnu.org Cc: Maxim Cournoyer X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161030898320198 (code B ref -1); Sun, 10 Jan 2021 20:04:02 +0000 Received: (at submit) by debbugs.gnu.org; 10 Jan 2021 20:03:03 +0000 Received: from localhost ([127.0.0.1]:55003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kygvW-0005Fi-Qi for submit@debbugs.gnu.org; Sun, 10 Jan 2021 15:03:03 -0500 Received: from lists.gnu.org ([209.51.188.17]:38222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kygvW-0005FQ-08 for submit@debbugs.gnu.org; Sun, 10 Jan 2021 15:03:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kygvV-00073n-Pv for guix-patches@gnu.org; Sun, 10 Jan 2021 15:03:01 -0500 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:40266) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kygvU-0003QV-38 for guix-patches@gnu.org; Sun, 10 Jan 2021 15:03:01 -0500 Received: by mail-io1-xd2c.google.com with SMTP id r9so15595096ioo.7 for ; Sun, 10 Jan 2021 12:02:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0w5hhl22QWx5oERXuGDjTyVxzo66BN9ItgfmYsisqEA=; b=dh3Qm7U/WOrFuEWo4x8HZ3qpM8fICMI+xcTJLeV6X05JGCz3xyDaKkLIGAypqvZNkp wrNZkuqq3z4ovwImhCSjAP+J23mugHF9GFOrDC9U+CMM4B8/KqUHyJzzHzKvJhZDv3Ih JLgHgWGIUDFrpj+XdVwpvHbR1w/IsW6Y3ajvPezRE/S6sl0Aey9zOaFhkdmR1btaHpxB GNvGLKGm47a1dy+WRfUjzdDhgZlIH9N9f/C5+LbRNDKnj6qLT5MYdt7ZEHKyL4tRdoJS tq63vhgFxcTTVexOt1jFyKjLZvQqXD974P87zQTbXZYS7v9CNZwUeV45gagC7L1Evf3+ /cRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0w5hhl22QWx5oERXuGDjTyVxzo66BN9ItgfmYsisqEA=; b=FGfHJBwU7OaN1se/j4Qxe7XdEgGwFPs1mnY43xwMPKxGUgoNh2N03VEnQ1CgdC8LRL lxcm/pRQWANCFkTyVnTQWWO/7lKIu10GqTC5yZltQ84ZnGzfbx4RkNa/H+IH+fTqcWor urxx318A6NgSnvTr/gCJbiblV9DzAcxBuHeEOc8iZw7h5NzBuwrP2eMjm99OvYxog5z7 C6x72GZ6tpV21Y0ooMFrl0EmxGRiODYlY5aF6yUZIVuaBWxGZTEpyrqSj+7lW0qBmCbh g8b3ciLKMiHPYU/nQvtaleqCuJN6D0vvRqIJLcNnA5BdPeSJNSiSqllWe+HprUqwTJOn zBcg== X-Gm-Message-State: AOAM5308x836vtCOMCCx2gWl7vjPihWwClGOCxGiDFId5XDUvVDUJ+9q bzJZFQpCw7J/fB7sd9t54rBCH+ToolaysQ== X-Google-Smtp-Source: ABdhPJyXJfcYkVQPODR7fOuElj68g6mtTBLHEN3iL6I3ow3OGGAcAMYEwE22ZMB3rLJjOgm1QyHaYQ== X-Received: by 2002:a5d:8d8b:: with SMTP id b11mr12646252ioj.68.1610308978982; Sun, 10 Jan 2021 12:02:58 -0800 (PST) Received: from localhost.localdomain (dsl-205-233-124-188.b2b2c.ca. [205.233.124.188]) by smtp.gmail.com with ESMTPSA id m8sm9582813ioh.16.2021.01.10.12.02.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jan 2021 12:02:58 -0800 (PST) From: Maxim Cournoyer Date: Sun, 10 Jan 2021 15:02:31 -0500 Message-Id: <20210110200231.24214-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::d2c; envelope-from=maxim.cournoyer@gmail.com; helo=mail-io1-xd2c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) While attempting to reproduce the now closed issue , I stumbled upon another annoyance, which is that the patch-and-repack procedure used as part of an origin derivation didn't support single files, so the following failed, for example: <#part type="text/plain" filename="/home/maxim/src/guix-core-updates/repro.scm" disposition=inline description="Script exhibiting problem"> <#/part> The following patch fixes that, allowing to use plain files with any of the already supported compressors, or non-tarball archived that would include a single directory (the same convention as used for our tarballs). Maxim Cournoyer (1): guix: packages: Allow patch-and-repack to work with plain files. guix/packages.scm | 96 +++++++++++++++++++++++++++++++--------------- tests/packages.scm | 87 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 149 insertions(+), 34 deletions(-) -- 2.29.2 From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 10 17:00:09 2021 Received: (at control) by debbugs.gnu.org; 10 Jan 2021 22:00:09 +0000 Received: from localhost ([127.0.0.1]:55067 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyikr-00057E-I5 for submit@debbugs.gnu.org; Sun, 10 Jan 2021 17:00:09 -0500 Received: from mail-il1-f169.google.com ([209.85.166.169]:35923) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyikp-000552-JT for control@debbugs.gnu.org; Sun, 10 Jan 2021 17:00:08 -0500 Received: by mail-il1-f169.google.com with SMTP id x15so618763ilk.3 for ; Sun, 10 Jan 2021 14:00:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:to:from:subject; bh=6k9B2g2tmU9SpiWIcoswIQb8dz6ZryZBBc8k7OwG9yc=; b=ZyGmNAsfRFpS2tfz5Blk0i6fs3G/H2t4Ebxa6i1ldjq8IAwMmZy9L45bOtRV4AiVC+ 0Gyvh3OryXYTwO7oXPigMQWkpvIEun2A/GjTWV0EQ/tT7xbAUpXGE9zKIciZiOEFEmLH Oy1kKLrAEr+sJHhYWDCyca/3vvyGTYB2ZS4mBJRmIq/Rwop+jkRsFW0gg+qdsWzrCAFp k812FBvHucgNY/eBl83uRw/Z5HHKcqANzeaXV9mkN9vpOVXGkUY+Q1SwFpTfDGiFdXxL Mc+2jmTQFt3gkH4NlpZckQoZ3pkjXYirbbroDXEsUobQcBRGkBnEwf38776ztE5hy7V5 9cMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:to:from:subject; bh=6k9B2g2tmU9SpiWIcoswIQb8dz6ZryZBBc8k7OwG9yc=; b=HoHB0zAVrBxoD52U3rt/vy8EQmMzTM+gxN/vtwe4InlMkgZCNKEyr8sYjZRbFGGEwr /mTZxX4ERCtfDntI6oIetq7j1lbiLvTnJLQJoTCtL8eDUo4wFxKt23Q+BvefcobQ7rzO HkVopmwPIUuDtseMnc8MyH8EtdsuwdTSoC+MD4ans4efZc+3SEJUn0xep4wpwYH1K9q7 cXTxL7W0Sdmv2HIQnWmV/NLsHlCThiL+6awKRA92grdqti0T+A/GdrlCXzg9GqdmE5Kb yQUQSlVo3qb1EVwHN+oDJGQIahvhU/uj6RYtbvJ6lmTN7RLpI7hYb6nbL1pI/2Qf9W/O ztUw== X-Gm-Message-State: AOAM532dtFKvAvZOLybK4RJD24QcICQlciqwysfkY4KbKQKZNEKRvL35 IaWWFcuqvkXb+f8IoACj3pqA71/8ZvNKOg== X-Google-Smtp-Source: ABdhPJx95HjAnNlOZwNdZEIEoxJNsq+qU68iHEjk9e5rwo6ylqvYFHYKZQU11W371gT9K8olDZ7ZHA== X-Received: by 2002:a05:6e02:50e:: with SMTP id d14mr9685891ils.248.1610316001646; Sun, 10 Jan 2021 14:00:01 -0800 (PST) Received: from hurd (dsl-205-233-124-188.b2b2c.ca. [205.233.124.188]) by smtp.gmail.com with ESMTPSA id t14sm10099354iof.23.2021.01.10.14.00.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jan 2021 14:00:01 -0800 (PST) Date: Sun, 10 Jan 2021 17:00:00 -0500 Message-Id: <87sg784fmn.fsf@gmail.com> To: control@debbugs.gnu.org From: Maxim Cournoyer Subject: control message for bug #45774 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) forcemerge 45774 45773 quit From unknown Sun Aug 17 01:50:04 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#45773] [PATCH core-updates 0/1] Allow patch-and-repack to work with plain files. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 10 Jan 2021 22:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45773 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 45773@debbugs.gnu.org Received: via spool by 45773-submit@debbugs.gnu.org id=B45773.161031648021953 (code B ref 45773); Sun, 10 Jan 2021 22:08:01 +0000 Received: (at 45773) by debbugs.gnu.org; 10 Jan 2021 22:08:00 +0000 Received: from localhost ([127.0.0.1]:55079 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyisS-0005hz-0T for submit@debbugs.gnu.org; Sun, 10 Jan 2021 17:08:00 -0500 Received: from mail-il1-f169.google.com ([209.85.166.169]:45113) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kyisI-0005gn-0a for 45773@debbugs.gnu.org; Sun, 10 Jan 2021 17:07:58 -0500 Received: by mail-il1-f169.google.com with SMTP id y13so8453088ilm.12 for <45773@debbugs.gnu.org>; Sun, 10 Jan 2021 14:07:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:references:date:in-reply-to:message-id:user-agent :mime-version; bh=GeHxFP91v8IKyXIOUT86+eJZA9SRLVG81XMKucNTQ3s=; b=P7ZncPQuqanAn5HKyCNDqQGUyU9CEmghfmyQsRc90ttHGexMqrOMc3ZqFBxHvph1M1 64KLmlZfok4yNwiebNDWIT9vKeK03rfGaskCeRRnCQyG06fsi2vk20FaTIVO9HJMuGuk 9UndPM3z0ojok1HQ1P5ZDkwX47ppN5eXsbBUksXAO65D4n66JlwnM2HQw/fMAvZidtge tet5CA7AfwxmukQzRC6wyrp4A7AV3byPe9HYFN2zYyL699lKqIWv1fccZ1YmXfIR/Vaf IlUD9vYZsw4u4jQ7NFWl/j6pwb/VFuqnCBvZ0tela2HSRyt/U2hNTGtVAwuyS1SQ0XW4 5NFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=GeHxFP91v8IKyXIOUT86+eJZA9SRLVG81XMKucNTQ3s=; b=GjnhVE6zFdhEy7LQQdqeRDGGb3MdEZgTP56qm6R20bD699y9x0KI36kUGs1ItoaM4E CeTtAxHVeNscRH4jch7zCuNdB7EiQnxxvOBUHB5+C9XXcHRSAysDngsMDJOeZpiLT+Kj HQXBHdgidw0eviE5ev8JPoAvwVlAzYSoSbTPqIM1yAGEwNRfqtJhuBCRSS92lnF/Vdoz gEFTy8yz6A5ItwOS4cJbLyXoTf1cTGL71kO897/FOJfyocaXJnzJ0AwgViLzUgTVUCwQ AWzPfOS7uXhzfEAfe4wIZRAsG7lnR3l2yoj4yjTWaBWJ/FKlGduqskvII/oBO6cSdVgg IMwA== X-Gm-Message-State: AOAM5313RxzYEIZQPuqSrTXtdnbym7vAUgsuaFV+SYVFn4vduiz/h0wr dRts85l2gBbSgXotxU2ZLwOSLYlMpXrXgg== X-Google-Smtp-Source: ABdhPJx5fR8ZYH3LCF/1EjuS+5PbD1TohmXFMmTDR7Zu6lx+0OB98//ILb7QFaf1BeomLWxGO8pqMA== X-Received: by 2002:a05:6e02:1908:: with SMTP id w8mr13206897ilu.229.1610316464547; Sun, 10 Jan 2021 14:07:44 -0800 (PST) Received: from hurd (dsl-205-233-124-188.b2b2c.ca. [205.233.124.188]) by smtp.gmail.com with ESMTPSA id f2sm10085895iop.6.2021.01.10.14.07.43 for <45773@debbugs.gnu.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jan 2021 14:07:43 -0800 (PST) From: Maxim Cournoyer References: <20210110200231.24214-1-maxim.cournoyer@gmail.com> Date: Sun, 10 Jan 2021 17:07:43 -0500 In-Reply-To: <20210110200231.24214-1-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Sun, 10 Jan 2021 15:02:31 -0500") Message-ID: <87o8hw4f9s.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Hello, Maxim Cournoyer writes: > While attempting to reproduce the now closed issue > , I stumbled upon another annoyance, which > is that the patch-and-repack procedure used as part of an origin derivation > didn't support single files, so the following failed, for example: > > <#part type="text/plain" filename="/home/maxim/src/guix-core-updates/repro.scm" disposition=inline description="Script exhibiting problem"> > <#/part> That didn't work out well :-). Here's the attachment that I meant to send along the cover letter. --=-=-= Content-Type: text/plain Content-Disposition: inline; filename=repro.scm ;;; Run script with: ./pre-inst-env guile -e main -s repro.scm (use-modules (gnu packages base) (gnu packages bootstrap) (guix build utils) (guix derivations) (guix download) (guix packages) (guix store)) (define %test-file-uri "https://raw.githubusercontent.com/realgud/realgud/master/realgud/common/bp-image-data.el") (define (main _) (let ((source (origin (method url-fetch) (uri %test-file-uri) (modules '((guix build utils))) (patch-inputs `(("tar" ,%bootstrap-coreutils&co) ("xz" ,%bootstrap-coreutils&co) ("locales" ,glibc-utf8-locales))) (snippet '(begin (with-fluids ((%default-port-encoding "ISO-8859-1") (%default-port-conversion-strategy 'error)) (substitute* "bp-image-data.el" (("something") "something else"))))) (sha256 (base32 "1qpn2zhh2qw579bhgjyxvf670r4kibaxls589hkm2yhwfvsjvs68"))))) (with-store store (build-derivations store (list (run-with-store store (origin->derivation source))))))) --=-=-= Content-Type: text/plain Thanks, Maxim --=-=-=-- From unknown Sun Aug 17 01:50:04 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#45773] [PATCH core-updates 0/1] Allow patch-and-repack to work with plain files. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 14 Jan 2021 17:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45773 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: 45774@debbugs.gnu.org, 45773@debbugs.gnu.org Received: via spool by 45773-submit@debbugs.gnu.org id=B45773.161064649430631 (code B ref 45773); Thu, 14 Jan 2021 17:49:02 +0000 Received: (at 45773) by debbugs.gnu.org; 14 Jan 2021 17:48:14 +0000 Received: from localhost ([127.0.0.1]:39123 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l06jG-0007xy-47 for submit@debbugs.gnu.org; Thu, 14 Jan 2021 12:48:14 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42986) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l06jE-0007xi-Ir; Thu, 14 Jan 2021 12:48:12 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]:55144) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l06j9-0006a2-AT; Thu, 14 Jan 2021 12:48:07 -0500 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=49450 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1l06j8-0004Kw-Ip; Thu, 14 Jan 2021 12:48:07 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20210110200535.24377-1-maxim.cournoyer@gmail.com> <20210113174021.23960-1-maxim.cournoyer@gmail.com> Date: Thu, 14 Jan 2021 18:48:04 +0100 In-Reply-To: <20210113174021.23960-1-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Wed, 13 Jan 2021 12:40:21 -0500") Message-ID: <877dof4dgr.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Hi! Maxim Cournoyer skribis: > Before this change, only plain directories, tar or zip archives were supp= orted > as the source of a package for the GNU build system; anything else would = cause > the unpack phase to fail. Origins relying on snippets would suffer from = the > same problem. > > This change adds the support to use files of the following extensions: .g= z, > .Z, .bz2, .lz, and .xz, even when they are not tarballs. Files of unknown > extensions are treated as uncompressed files and supported as well. > > * guix/packages.scm (patch-and-repack): Only add the compressor utility t= o the > PATH when the file is compressed. Bind more inputs in the mlet, and use = them > for decompressing single files. Adjust decompression and compression rou= tines. > [decompression-type]: Return #f when no known compression extension is us= ed. > [tarball?]: New nested procedure. > * guix/build/utils.scm (compressor, tarball?): New procedures. Move > %xz-parallel-args to the new 'compression helpers' section. > * tests/packages.scm: Add tests. Add missing copyright year for Jan. > * guix/build/gnu-build-system.scm (first-subdirectory): Return #f when no > sub-directory was found. > (unpack): Support more file types, including uncompressed plain files. > --- > guix/build/gnu-build-system.scm | 24 ++++++-- > guix/build/utils.scm | 47 ++++++++++----- > guix/packages.scm | 100 +++++++++++++++++--------------- > guix/tests.scm | 40 ++++++++++++- > tests/builders.scm | 40 ++++++++++++- > tests/packages.scm | 69 +++++++++++++++++++++- > 6 files changed, 247 insertions(+), 73 deletions(-) How frequent is it for an origin to be a regular file other than an archive? The underlying question for me is: will this generalization and increased complexity pay off? WDYT? There are aspects of the patch that I find welcome regardless, such as the improved handling of compression helpers. Thanks, Ludo=E2=80=99. From unknown Sun Aug 17 01:50:04 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#45773] [PATCH core-updates 0/1] Allow patch-and-repack to work with plain files. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 14 Jan 2021 18:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 45773 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 45774@debbugs.gnu.org, 45773@debbugs.gnu.org Received: via spool by 45773-submit@debbugs.gnu.org id=B45773.16106498343354 (code B ref 45773); Thu, 14 Jan 2021 18:44:02 +0000 Received: (at 45773) by debbugs.gnu.org; 14 Jan 2021 18:43:54 +0000 Received: from localhost ([127.0.0.1]:39199 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l07b7-0000s1-M8 for submit@debbugs.gnu.org; Thu, 14 Jan 2021 13:43:53 -0500 Received: from mail-qv1-f41.google.com ([209.85.219.41]:44801) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l07b6-0000rk-I0; Thu, 14 Jan 2021 13:43:52 -0500 Received: by mail-qv1-f41.google.com with SMTP id d11so2776289qvo.11; Thu, 14 Jan 2021 10:43:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=i679i1YM9Pc1tsnNCnVzfHyLBuHp7YFj3ZdxMElAqmg=; b=bon9fCKv7pSfe+x1pcKPeLxi9jaHSKfGmn9hOKhM4J70m1ZkC0+BD6Xapdh48VfxAF CVTr58nVpdiwj9q6RCMFnBI3PNnD5i7/cwlVws7FWwE8KuPddpRBP1j7PHIAjutpFuaB Njx2LFZsCJgY0y4jjOe2z+sk8ha0L6KJbSxAJw4UWa2+dJ+8ZfUASVvgRmeLzndqCVMU rEhDzSmS75jcEmWhqXx3x20l5KVc08GG02ZHHxonihy1387fLHx3tXGIziRmQb++h/tA es+HkYik544yc6SgenUGMpcjCvdwZ9Vr6c1FKiICahb1iMRJeZEE894cwKlVmMe5TtZg PzJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=i679i1YM9Pc1tsnNCnVzfHyLBuHp7YFj3ZdxMElAqmg=; b=cgMH1rG84iZqojXUJBPc6MPzwgJK1D61GdfnvtzJIul5m515Cst5GRjNNcnmtTlAU0 LHsQ0JSBATXa8n3KEpMDUa/8KQCHO2ojU+o+mRagZsRcj359iryLFA8ZvES5ubgDdBwK GVALeZl9I9GjgyU/2TikyU0onS0VeEsVHXQZ/5p9ohMHr16g1zMrNyX0k7ZagEY7mWi0 dt2rFHPUbkjfPdFVUaqqmkVI1bLrp2ci2zIabW16a2xY3JE7vUkhcv1AQ8OK+ZHGSARF e7VSfytDe7tcXewW7sQqfjgFlmVxYcCTAhr1WC65VKKBlUHvUEYLEPcKe8/3jTTPbKsL gNQw== X-Gm-Message-State: AOAM533cI1HNPW/5cJX/TaDzd+kRjxzkrxL3fTbR1LWSJLXmk5fV55oK mlRvwCNvokKW6dX7G/lDgo47tQL0mKpaAw== X-Google-Smtp-Source: ABdhPJxdUj83w0epSv7j9Ag45A2ITlVqsP55iDxSLuVtxwQsh8Kk4w+0FjmzMdWO87j2vCJ3k2Kn1g== X-Received: by 2002:a0c:a789:: with SMTP id v9mr8309957qva.41.1610649826924; Thu, 14 Jan 2021 10:43:46 -0800 (PST) Received: from hurd (dsl-157-252.b2b2c.ca. [66.158.157.252]) by smtp.gmail.com with ESMTPSA id z9sm3360485qts.66.2021.01.14.10.43.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Jan 2021 10:43:44 -0800 (PST) From: Maxim Cournoyer References: <20210110200535.24377-1-maxim.cournoyer@gmail.com> <20210113174021.23960-1-maxim.cournoyer@gmail.com> <877dof4dgr.fsf_-_@gnu.org> Date: Thu, 14 Jan 2021 13:43:43 -0500 In-Reply-To: <877dof4dgr.fsf_-_@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Thu, 14 Jan 2021 18:48:04 +0100") Message-ID: <87k0sfl5pc.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludovic, Ludovic Court=C3=A8s writes: > Hi! > > Maxim Cournoyer skribis: > >> Before this change, only plain directories, tar or zip archives were sup= ported >> as the source of a package for the GNU build system; anything else would= cause >> the unpack phase to fail. Origins relying on snippets would suffer from= the >> same problem. >> >> This change adds the support to use files of the following extensions: .= gz, >> .Z, .bz2, .lz, and .xz, even when they are not tarballs. Files of unkno= wn >> extensions are treated as uncompressed files and supported as well. >> >> * guix/packages.scm (patch-and-repack): Only add the compressor utility = to the >> PATH when the file is compressed. Bind more inputs in the mlet, and use= them >> for decompressing single files. Adjust decompression and compression ro= utines. >> [decompression-type]: Return #f when no known compression extension is u= sed. >> [tarball?]: New nested procedure. >> * guix/build/utils.scm (compressor, tarball?): New procedures. Move >> %xz-parallel-args to the new 'compression helpers' section. >> * tests/packages.scm: Add tests. Add missing copyright year for Jan. >> * guix/build/gnu-build-system.scm (first-subdirectory): Return #f when no >> sub-directory was found. >> (unpack): Support more file types, including uncompressed plain files. >> --- >> guix/build/gnu-build-system.scm | 24 ++++++-- >> guix/build/utils.scm | 47 ++++++++++----- >> guix/packages.scm | 100 +++++++++++++++++--------------- >> guix/tests.scm | 40 ++++++++++++- >> tests/builders.scm | 40 ++++++++++++- >> tests/packages.scm | 69 +++++++++++++++++++++- >> 6 files changed, 247 insertions(+), 73 deletions(-) > > How frequent is it for an origin to be a regular file other than an > archive? The underlying question for me is: will this generalization > and increased complexity pay off? WDYT? I think consistency is the main driver here. The url-fetch method supports single file sources; it makes sense that the other components handling sources support it as well. It's hard to judge of the popularity of such a feature when it's never been available; but some use cases come to mind such as single Emacs package file. I've made use of such feature for the new texlive-updmap.cfg definition in . > There are aspects of the patch that I find welcome regardless, such as > the improved handling of compression helpers. Great! Thanks for looking at it. Maxim From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 25 09:20:20 2021 Received: (at control) by debbugs.gnu.org; 25 Jan 2021 14:20:20 +0000 Received: from localhost ([127.0.0.1]:38314 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l42j6-000347-0r for submit@debbugs.gnu.org; Mon, 25 Jan 2021 09:20:20 -0500 Received: from mail-qt1-f171.google.com ([209.85.160.171]:34160) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l42j4-00033s-00 for control@debbugs.gnu.org; Mon, 25 Jan 2021 09:20:18 -0500 Received: by mail-qt1-f171.google.com with SMTP id c1so9749145qtc.1 for ; Mon, 25 Jan 2021 06:20:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:message-id:to:from:subject; bh=gCFvmYJDzj2a+bw8ruHcvq/HWZbcD8xbFxFcvg/Jlrs=; b=YUijOT+J8gaQTUITUjj6UF912hnAXlSU5GSoUVdSPtuIgbFB4Gl977s/j933yX9OUx UM52wxwk7mCu7JndM1f1rdJ98uW1qLcdTT8aGKR//O6TdJWgcniiVlk0KJGaoPkUMn2Y Xb3fe/FLHMUSFQBccSkjGJodguFGVXQyOtds+7735V4c6IMpmS854/bEbEKFZmqBWQgP FNLL68eKSDd4YBUuJQVVD68W2Ek6lrEWEBpF0F+PRovppQIDBFo/Nadgui8mzboaDtCD 1tAwEq32e1CWyG15lCfmI5+Lt7VBlC3icMXIiITjlW+eoKALTT9YkMBEM5Bkr1AiXoGT iPOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:to:from:subject; bh=gCFvmYJDzj2a+bw8ruHcvq/HWZbcD8xbFxFcvg/Jlrs=; b=StOVxHg3moyXi8BWYq/6CYpE8cI0dLxgpz4mjf5PT4Xoo8indseDPVqSjQHy7a2PLh F89NpPFgS0Pj+1/QrhsTVpLBITKjVklzU4NcZieXEFa3qT+lBGf3/KidTpCZzfi3dIJD zE51/Dnfv5fo6aZZMxmb+ZVAwG37ET+nBWcOptF8mVxZqZBIGRor9NgyvOal0QSED8bP oOJWpvAsjHw2/i07RT5uquUGAsPcGUK8KBNSepUS0A4FZ23bfoyhgqwt7nopfeZRHHnJ wc7g2/LNvoKQNq+ip6hO8mF84lIHk1esBL+MS6ZElTYwg+SeuC3Vlmt34//q/hhrmqZa cGPQ== X-Gm-Message-State: AOAM532gglYf+gXSqbm7VB8XESGpVC75hsBpk2dB8AHZNd9b7PyqBgeD mDsPgCEpujhWGuZ8+A0VSl0q/52ssNY= X-Google-Smtp-Source: ABdhPJwF78J+GetwexlgAbOzXk20EoD2vbnEjyWKEMVIsu2DzoDONo3PaAz/c00HP7kSef0r+/Zlwg== X-Received: by 2002:ac8:4313:: with SMTP id z19mr619360qtm.225.1611584412328; Mon, 25 Jan 2021 06:20:12 -0800 (PST) Received: from hurd (dsl-10-132-34.b2b2c.ca. [72.10.132.34]) by smtp.gmail.com with ESMTPSA id n139sm7487670qke.89.2021.01.25.06.20.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Jan 2021 06:20:10 -0800 (PST) Date: Mon, 25 Jan 2021 09:20:09 -0500 Message-Id: <87ft2p3xpi.fsf@gmail.com> To: control@debbugs.gnu.org From: Maxim Cournoyer Subject: control message for bug #45959 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) forcemerge 45959 45773 quit From unknown Sun Aug 17 01:50:04 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Maxim Cournoyer Subject: bug#45773: closed (Re: bug#45773: [PATCH core-updates 0/1] Allow patch-and-repack to work with plain files.) Message-ID: References: <87wnvzyqu5.fsf_-_@gmail.com> <20210110200231.24214-1-maxim.cournoyer@gmail.com> X-Gnu-PR-Message: they-closed 45773 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 45773@debbugs.gnu.org Date: Wed, 27 Jan 2021 03:58:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1611719883-25584-1" This is a multi-part message in MIME format... ------------=_1611719883-25584-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #45773: [PATCH core-updates 0/1] Allow patch-and-repack to work with plain = files. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 45773@debbugs.gnu.org. --=20 45773: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D45773 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1611719883-25584-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 45773-done) by debbugs.gnu.org; 27 Jan 2021 03:57:32 +0000 Received: from localhost ([127.0.0.1]:43254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4bxT-0006dQ-R2 for submit@debbugs.gnu.org; Tue, 26 Jan 2021 22:57:32 -0500 Received: from mail-qk1-f178.google.com ([209.85.222.178]:46641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4bxS-0006d8-3u; Tue, 26 Jan 2021 22:57:30 -0500 Received: by mail-qk1-f178.google.com with SMTP id a7so569266qkb.13; Tue, 26 Jan 2021 19:57:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=9zRkkNeuLpkXYdFUAaY8o6Tp2v1Ai3QiaQn+qxzV3Dg=; b=ZoSdJqGWA9UIao9OywvK9R4S6ULo/z0spH5P++3Gufmd21Wy19dHJ2wNN7Ypc3k2Nd OD2M79bA1pI0s139X5WQGjm7GrpoVu+gj8iegNKSe8AEKSynC5SnuA1Ek+uLVWtHW/xJ R9E820yAUJaU1J5yuCP2MkxR3mq09v6Zw7FicsepgJUIUgeBIbLVYtr/KiNey4K8wnDp uUMtv00sWGOxnbk2qTd2U4aYFoFApXOK2pPVCUS61bjHbV7kUMedn8Udk7l+L3/fUp+S zZ0HUQ23zu+JKWXLBBnYSbulqp3FUTR1eNeCoVdr7ooZehKX+7hng+VpILS8WrKzB/ih tTPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=9zRkkNeuLpkXYdFUAaY8o6Tp2v1Ai3QiaQn+qxzV3Dg=; b=tH4NeYm2V/dOMQmAyc3qq7nfkOJVdNJa6Uox9MfB7BoMpZHmH3jAXpwms7B3UZfdOs h1mQ0bedihRZ1aGNue6TuquaktHclRGx6hwWH16snVb1x5UgwazD8gN2LPSxydEhfHCs 3qftWoWk2lQy9gwYPB/Bpji1G0h3G+/N0yJQWPnka7e9amme5qBneLts644ggZ4YA7cI WGHhs8g6ScKBvodYQhNo6fWR+p+sqKK2NpcIqMTSPxB5lVKRdm8ndU6GTG4ESH4pbRz1 qL7pJpzMnw3b5InrIjYq2FRnmFdUOIrEpoUKVUBZAnTKuwRgbVaOsX+gTRzD6wUq0Uo6 Qa/Q== X-Gm-Message-State: AOAM532SUPQCS4UtZsop5ls0VACqRcjjv7oAHjMXetGfLSoZHwn7s2Tw F/YqAU7YUB2sgssmPE0NNQuSe5Zw7ws= X-Google-Smtp-Source: ABdhPJz9bM2PDS1wwOaov/2NfN9ez3t4v2bjkSeEwtH3VDOJZLtFqilUsIpEHZjr5ezLD54USzxexg== X-Received: by 2002:a05:620a:2105:: with SMTP id l5mr9025465qkl.126.1611719844267; Tue, 26 Jan 2021 19:57:24 -0800 (PST) Received: from hurd (dsl-10-132-34.b2b2c.ca. [72.10.132.34]) by smtp.gmail.com with ESMTPSA id n94sm549163qtd.28.2021.01.26.19.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jan 2021 19:57:23 -0800 (PST) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#45773: [PATCH core-updates 0/1] Allow patch-and-repack to work with plain files. References: <20210110200535.24377-1-maxim.cournoyer@gmail.com> <20210113174021.23960-1-maxim.cournoyer@gmail.com> <877dof4dgr.fsf_-_@gnu.org> <87k0sfl5pc.fsf@gmail.com> Date: Tue, 26 Jan 2021 22:57:22 -0500 In-Reply-To: <87k0sfl5pc.fsf@gmail.com> (Maxim Cournoyer's message of "Thu, 14 Jan 2021 13:43:43 -0500") Message-ID: <87wnvzyqu5.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 45773-done Cc: 45774-done@debbugs.gnu.org, 45773-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludo, Maxim Cournoyer writes: > Hi Ludovic, > > Ludovic Court=C3=A8s writes: > >> Hi! >> >> Maxim Cournoyer skribis: >> >>> Before this change, only plain directories, tar or zip archives were su= pported >>> as the source of a package for the GNU build system; anything else woul= d cause >>> the unpack phase to fail. Origins relying on snippets would suffer fro= m the >>> same problem. >>> >>> This change adds the support to use files of the following extensions: = .gz, >>> .Z, .bz2, .lz, and .xz, even when they are not tarballs. Files of unkn= own >>> extensions are treated as uncompressed files and supported as well. >>> >>> * guix/packages.scm (patch-and-repack): Only add the compressor utility= to the >>> PATH when the file is compressed. Bind more inputs in the mlet, and us= e them >>> for decompressing single files. Adjust decompression and compression r= outines. >>> [decompression-type]: Return #f when no known compression extension is = used. >>> [tarball?]: New nested procedure. >>> * guix/build/utils.scm (compressor, tarball?): New procedures. Move >>> %xz-parallel-args to the new 'compression helpers' section. >>> * tests/packages.scm: Add tests. Add missing copyright year for Jan. >>> * guix/build/gnu-build-system.scm (first-subdirectory): Return #f when = no >>> sub-directory was found. >>> (unpack): Support more file types, including uncompressed plain files. >>> --- >>> guix/build/gnu-build-system.scm | 24 ++++++-- >>> guix/build/utils.scm | 47 ++++++++++----- >>> guix/packages.scm | 100 +++++++++++++++++--------------- >>> guix/tests.scm | 40 ++++++++++++- >>> tests/builders.scm | 40 ++++++++++++- >>> tests/packages.scm | 69 +++++++++++++++++++++- >>> 6 files changed, 247 insertions(+), 73 deletions(-) >> >> How frequent is it for an origin to be a regular file other than an >> archive? The underlying question for me is: will this generalization >> and increased complexity pay off? WDYT? > > I think consistency is the main driver here. The url-fetch method > supports single file sources; it makes sense that the other components > handling sources support it as well. It's hard to judge of the > popularity of such a feature when it's never been available; but some > use cases come to mind such as single Emacs package file. I've made use > of such feature for the new texlive-updmap.cfg definition in > . I've been building a sizable part of core-updates on top of this change now for nearly two weeks, and in this time it's already come handy twice. I've made sure the tests ran fine and pushed to core-updates as commit cfcead2e515c0dae02127e5a76496463898be6b6. Let me know if anything breaks :-). Maxim ------------=_1611719883-25584-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 10 Jan 2021 20:03:03 +0000 Received: from localhost ([127.0.0.1]:55003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kygvW-0005Fi-Qi for submit@debbugs.gnu.org; Sun, 10 Jan 2021 15:03:03 -0500 Received: from lists.gnu.org ([209.51.188.17]:38222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kygvW-0005FQ-08 for submit@debbugs.gnu.org; Sun, 10 Jan 2021 15:03:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38960) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kygvV-00073n-Pv for guix-patches@gnu.org; Sun, 10 Jan 2021 15:03:01 -0500 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]:40266) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kygvU-0003QV-38 for guix-patches@gnu.org; Sun, 10 Jan 2021 15:03:01 -0500 Received: by mail-io1-xd2c.google.com with SMTP id r9so15595096ioo.7 for ; Sun, 10 Jan 2021 12:02:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0w5hhl22QWx5oERXuGDjTyVxzo66BN9ItgfmYsisqEA=; b=dh3Qm7U/WOrFuEWo4x8HZ3qpM8fICMI+xcTJLeV6X05JGCz3xyDaKkLIGAypqvZNkp wrNZkuqq3z4ovwImhCSjAP+J23mugHF9GFOrDC9U+CMM4B8/KqUHyJzzHzKvJhZDv3Ih JLgHgWGIUDFrpj+XdVwpvHbR1w/IsW6Y3ajvPezRE/S6sl0Aey9zOaFhkdmR1btaHpxB GNvGLKGm47a1dy+WRfUjzdDhgZlIH9N9f/C5+LbRNDKnj6qLT5MYdt7ZEHKyL4tRdoJS tq63vhgFxcTTVexOt1jFyKjLZvQqXD974P87zQTbXZYS7v9CNZwUeV45gagC7L1Evf3+ /cRg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0w5hhl22QWx5oERXuGDjTyVxzo66BN9ItgfmYsisqEA=; b=FGfHJBwU7OaN1se/j4Qxe7XdEgGwFPs1mnY43xwMPKxGUgoNh2N03VEnQ1CgdC8LRL lxcm/pRQWANCFkTyVnTQWWO/7lKIu10GqTC5yZltQ84ZnGzfbx4RkNa/H+IH+fTqcWor urxx318A6NgSnvTr/gCJbiblV9DzAcxBuHeEOc8iZw7h5NzBuwrP2eMjm99OvYxog5z7 C6x72GZ6tpV21Y0ooMFrl0EmxGRiODYlY5aF6yUZIVuaBWxGZTEpyrqSj+7lW0qBmCbh g8b3ciLKMiHPYU/nQvtaleqCuJN6D0vvRqIJLcNnA5BdPeSJNSiSqllWe+HprUqwTJOn zBcg== X-Gm-Message-State: AOAM5308x836vtCOMCCx2gWl7vjPihWwClGOCxGiDFId5XDUvVDUJ+9q bzJZFQpCw7J/fB7sd9t54rBCH+ToolaysQ== X-Google-Smtp-Source: ABdhPJyXJfcYkVQPODR7fOuElj68g6mtTBLHEN3iL6I3ow3OGGAcAMYEwE22ZMB3rLJjOgm1QyHaYQ== X-Received: by 2002:a5d:8d8b:: with SMTP id b11mr12646252ioj.68.1610308978982; Sun, 10 Jan 2021 12:02:58 -0800 (PST) Received: from localhost.localdomain (dsl-205-233-124-188.b2b2c.ca. [205.233.124.188]) by smtp.gmail.com with ESMTPSA id m8sm9582813ioh.16.2021.01.10.12.02.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jan 2021 12:02:58 -0800 (PST) From: Maxim Cournoyer To: guix-patches@gnu.org Subject: [PATCH core-updates 0/1] Allow patch-and-repack to work with plain files. Date: Sun, 10 Jan 2021 15:02:31 -0500 Message-Id: <20210110200231.24214-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::d2c; envelope-from=maxim.cournoyer@gmail.com; helo=mail-io1-xd2c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) While attempting to reproduce the now closed issue , I stumbled upon another annoyance, which is that the patch-and-repack procedure used as part of an origin derivation didn't support single files, so the following failed, for example: <#part type="text/plain" filename="/home/maxim/src/guix-core-updates/repro.scm" disposition=inline description="Script exhibiting problem"> <#/part> The following patch fixes that, allowing to use plain files with any of the already supported compressors, or non-tarball archived that would include a single directory (the same convention as used for our tarballs). Maxim Cournoyer (1): guix: packages: Allow patch-and-repack to work with plain files. guix/packages.scm | 96 +++++++++++++++++++++++++++++++--------------- tests/packages.scm | 87 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 149 insertions(+), 34 deletions(-) -- 2.29.2 ------------=_1611719883-25584-1-- From unknown Sun Aug 17 01:50:04 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Maxim Cournoyer Subject: bug#45774: closed (Re: bug#45773: [PATCH core-updates 0/1] Allow patch-and-repack to work with plain files.) Message-ID: References: <87wnvzyqu5.fsf_-_@gmail.com> <20210110200535.24377-1-maxim.cournoyer@gmail.com> X-Gnu-PR-Message: they-closed 45774 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 45774@debbugs.gnu.org Date: Wed, 27 Jan 2021 03:58:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1611719883-25584-3" This is a multi-part message in MIME format... ------------=_1611719883-25584-3 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #45773: [PATCH core-updates 1/1] guix: packages: Allow patch-and-repack to = work with plain files. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 45774@debbugs.gnu.org. --=20 45773: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D45773 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1611719883-25584-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 45773-done) by debbugs.gnu.org; 27 Jan 2021 03:57:32 +0000 Received: from localhost ([127.0.0.1]:43254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4bxT-0006dQ-R2 for submit@debbugs.gnu.org; Tue, 26 Jan 2021 22:57:32 -0500 Received: from mail-qk1-f178.google.com ([209.85.222.178]:46641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4bxS-0006d8-3u; Tue, 26 Jan 2021 22:57:30 -0500 Received: by mail-qk1-f178.google.com with SMTP id a7so569266qkb.13; Tue, 26 Jan 2021 19:57:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=9zRkkNeuLpkXYdFUAaY8o6Tp2v1Ai3QiaQn+qxzV3Dg=; b=ZoSdJqGWA9UIao9OywvK9R4S6ULo/z0spH5P++3Gufmd21Wy19dHJ2wNN7Ypc3k2Nd OD2M79bA1pI0s139X5WQGjm7GrpoVu+gj8iegNKSe8AEKSynC5SnuA1Ek+uLVWtHW/xJ R9E820yAUJaU1J5yuCP2MkxR3mq09v6Zw7FicsepgJUIUgeBIbLVYtr/KiNey4K8wnDp uUMtv00sWGOxnbk2qTd2U4aYFoFApXOK2pPVCUS61bjHbV7kUMedn8Udk7l+L3/fUp+S zZ0HUQ23zu+JKWXLBBnYSbulqp3FUTR1eNeCoVdr7ooZehKX+7hng+VpILS8WrKzB/ih tTPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=9zRkkNeuLpkXYdFUAaY8o6Tp2v1Ai3QiaQn+qxzV3Dg=; b=tH4NeYm2V/dOMQmAyc3qq7nfkOJVdNJa6Uox9MfB7BoMpZHmH3jAXpwms7B3UZfdOs h1mQ0bedihRZ1aGNue6TuquaktHclRGx6hwWH16snVb1x5UgwazD8gN2LPSxydEhfHCs 3qftWoWk2lQy9gwYPB/Bpji1G0h3G+/N0yJQWPnka7e9amme5qBneLts644ggZ4YA7cI WGHhs8g6ScKBvodYQhNo6fWR+p+sqKK2NpcIqMTSPxB5lVKRdm8ndU6GTG4ESH4pbRz1 qL7pJpzMnw3b5InrIjYq2FRnmFdUOIrEpoUKVUBZAnTKuwRgbVaOsX+gTRzD6wUq0Uo6 Qa/Q== X-Gm-Message-State: AOAM532SUPQCS4UtZsop5ls0VACqRcjjv7oAHjMXetGfLSoZHwn7s2Tw F/YqAU7YUB2sgssmPE0NNQuSe5Zw7ws= X-Google-Smtp-Source: ABdhPJz9bM2PDS1wwOaov/2NfN9ez3t4v2bjkSeEwtH3VDOJZLtFqilUsIpEHZjr5ezLD54USzxexg== X-Received: by 2002:a05:620a:2105:: with SMTP id l5mr9025465qkl.126.1611719844267; Tue, 26 Jan 2021 19:57:24 -0800 (PST) Received: from hurd (dsl-10-132-34.b2b2c.ca. [72.10.132.34]) by smtp.gmail.com with ESMTPSA id n94sm549163qtd.28.2021.01.26.19.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jan 2021 19:57:23 -0800 (PST) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#45773: [PATCH core-updates 0/1] Allow patch-and-repack to work with plain files. References: <20210110200535.24377-1-maxim.cournoyer@gmail.com> <20210113174021.23960-1-maxim.cournoyer@gmail.com> <877dof4dgr.fsf_-_@gnu.org> <87k0sfl5pc.fsf@gmail.com> Date: Tue, 26 Jan 2021 22:57:22 -0500 In-Reply-To: <87k0sfl5pc.fsf@gmail.com> (Maxim Cournoyer's message of "Thu, 14 Jan 2021 13:43:43 -0500") Message-ID: <87wnvzyqu5.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 45773-done Cc: 45774-done@debbugs.gnu.org, 45773-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludo, Maxim Cournoyer writes: > Hi Ludovic, > > Ludovic Court=C3=A8s writes: > >> Hi! >> >> Maxim Cournoyer skribis: >> >>> Before this change, only plain directories, tar or zip archives were su= pported >>> as the source of a package for the GNU build system; anything else woul= d cause >>> the unpack phase to fail. Origins relying on snippets would suffer fro= m the >>> same problem. >>> >>> This change adds the support to use files of the following extensions: = .gz, >>> .Z, .bz2, .lz, and .xz, even when they are not tarballs. Files of unkn= own >>> extensions are treated as uncompressed files and supported as well. >>> >>> * guix/packages.scm (patch-and-repack): Only add the compressor utility= to the >>> PATH when the file is compressed. Bind more inputs in the mlet, and us= e them >>> for decompressing single files. Adjust decompression and compression r= outines. >>> [decompression-type]: Return #f when no known compression extension is = used. >>> [tarball?]: New nested procedure. >>> * guix/build/utils.scm (compressor, tarball?): New procedures. Move >>> %xz-parallel-args to the new 'compression helpers' section. >>> * tests/packages.scm: Add tests. Add missing copyright year for Jan. >>> * guix/build/gnu-build-system.scm (first-subdirectory): Return #f when = no >>> sub-directory was found. >>> (unpack): Support more file types, including uncompressed plain files. >>> --- >>> guix/build/gnu-build-system.scm | 24 ++++++-- >>> guix/build/utils.scm | 47 ++++++++++----- >>> guix/packages.scm | 100 +++++++++++++++++--------------- >>> guix/tests.scm | 40 ++++++++++++- >>> tests/builders.scm | 40 ++++++++++++- >>> tests/packages.scm | 69 +++++++++++++++++++++- >>> 6 files changed, 247 insertions(+), 73 deletions(-) >> >> How frequent is it for an origin to be a regular file other than an >> archive? The underlying question for me is: will this generalization >> and increased complexity pay off? WDYT? > > I think consistency is the main driver here. The url-fetch method > supports single file sources; it makes sense that the other components > handling sources support it as well. It's hard to judge of the > popularity of such a feature when it's never been available; but some > use cases come to mind such as single Emacs package file. I've made use > of such feature for the new texlive-updmap.cfg definition in > . I've been building a sizable part of core-updates on top of this change now for nearly two weeks, and in this time it's already come handy twice. I've made sure the tests ran fine and pushed to core-updates as commit cfcead2e515c0dae02127e5a76496463898be6b6. Let me know if anything breaks :-). Maxim ------------=_1611719883-25584-3 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 10 Jan 2021 20:05:56 +0000 Received: from localhost ([127.0.0.1]:55008 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kygyJ-0005K5-9L for submit@debbugs.gnu.org; Sun, 10 Jan 2021 15:05:55 -0500 Received: from lists.gnu.org ([209.51.188.17]:39152) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kygyH-0005Jx-Iw for submit@debbugs.gnu.org; Sun, 10 Jan 2021 15:05:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:39302) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kygyH-0007dn-ET for guix-patches@gnu.org; Sun, 10 Jan 2021 15:05:53 -0500 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]:43262) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kygyF-0004HY-6H for guix-patches@gnu.org; Sun, 10 Jan 2021 15:05:53 -0500 Received: by mail-io1-xd30.google.com with SMTP id o6so15590782iob.10; Sun, 10 Jan 2021 12:05:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=R6+qyBU2MlyCz6OQiOW6ONTwLEzahy4VP0r/oAUu5nQ=; b=YpMkyZUaSoWPz3xPvVVWe2vcdOM6uml0Co6l7dju+0O67SI9nXFjdUweoScGQa6obv pqYcak9DCrQcw2RkhyZzr7wK+LncgIB0Ve+xT65lX9F50WQgsn7eanpw1HUuxo1spzyB CNM7qu3CCzSOUzkfcczGuEz4p6knh4kPzWgRtyle+V/smLu/8UV1+CZsvGcJnD8a2CPZ Vvtcx2lKtfocypmE0Q1HoRuUXNuteaLmEcEIKjQLgk9BtBHOWmPUwByu/9+jipRbgbuP OPg7pRldRa9xaiY/IAVFNS9i1IQYKfAjXtjQTwMyAnRD5sWyGzDBw3Tvwx7JxSjih+tE wEAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=R6+qyBU2MlyCz6OQiOW6ONTwLEzahy4VP0r/oAUu5nQ=; b=iTsfnx3fD8tqtTpncgwUQ0NXzg/Nj2vzlvjfQT5NFNKmO71OetvEWiycRbRvT8QWi4 PpuPT29+23WO2WJxcPpAvCBiTcUF4PQ5/HFDydxyCwXAZgkvF71NtrXlWAgKm2AXj0m0 tnvTkchGPmraPQH/w64ivbt7r+tmmySd/jYrMiC4i9nEWRTdu0DUfqJQT1hAYupuHbIN Jiv4Nv717eaAVWVZHuM9AXXV+5EcSDryD/CeF8fBDU1W5hpsBZ57246m1hzyr31ZrvZZ 4WAHmPfDW5F+mRPeAcpyMdHdXwRVd6KznBSINqS38jTrc0I/BdKv4VWCXZFRGSIcncsi XAsg== X-Gm-Message-State: AOAM533/gDlnPlhF3MSzTEGLxZno1eNq5EkwHPyQ7yK1P2+94yUwBH+W vbfmq3O+PWkxG//huWGq2qjT2WA8rNOUQQ== X-Google-Smtp-Source: ABdhPJwoqIVHqO0KVyCKjzEk5ftMq6HkycPdjFpFyXl+WzfepacmRWDHWzt+yBDEpcTSZAw+GcGL/g== X-Received: by 2002:a05:6638:19c:: with SMTP id a28mr11629868jaq.76.1610309149372; Sun, 10 Jan 2021 12:05:49 -0800 (PST) Received: from localhost.localdomain (dsl-205-233-124-188.b2b2c.ca. [205.233.124.188]) by smtp.gmail.com with ESMTPSA id n77sm9516249iod.48.2021.01.10.12.05.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Jan 2021 12:05:48 -0800 (PST) From: Maxim Cournoyer To: 45773@gnu.org, guix-patches@gnu.org Subject: [PATCH core-updates 1/1] guix: packages: Allow patch-and-repack to work with plain files. Date: Sun, 10 Jan 2021 15:05:35 -0500 Message-Id: <20210110200535.24377-1-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Type: text/plain; charset=yes Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::d30; envelope-from=maxim.cournoyer@gmail.com; helo=mail-io1-xd30.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) This change allows the use of the snippet field on a single file origin. Previously, the patch-and-repack procedure would fail on plain files, as it would end up invoking tar when attempting to extract non-tarballs. * guix/packages.scm (patch-and-repack): Only add the compressor utility to the PATH when the file is compressed. Bind more inputs in the mlet, and use them for decompressing single files. Adjust decompression and compression routines. [decompression-type]: Return #f when no known compression extension is used. [tarball?]: New nested procedure. * tests/packages.scm: Add tests. Add missing copyright year for Jan. --- guix/packages.scm | 96 +++++++++++++++++++++++++++++++--------------- tests/packages.scm | 87 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 149 insertions(+), 34 deletions(-) diff --git a/guix/packages.scm b/guix/packages.scm index 93407c143c..f6336e7345 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -5,7 +5,7 @@ ;;; Copyright © 2016 Alex Kost ;;; Copyright © 2017, 2019, 2020 Efraim Flashner ;;; Copyright © 2019 Marius Bakke -;;; Copyright © 2020 Maxim Cournoyer +;;; Copyright © 2020, 2021 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -615,7 +615,8 @@ specifies modules in scope when evaluating SNIPPET." ((string-suffix? "bz2" source-file-name) "bzip2") ((string-suffix? "lz" source-file-name) "lzip") ((string-suffix? "zip" source-file-name) "unzip") - (else "xz"))) + ((string-suffix? "xz" source-file-name) "xz") + (else #f))) ;no compression used (define original-file-name ;; Remove the store prefix plus the slash, hash, and hyphen. @@ -653,19 +654,29 @@ specifies modules in scope when evaluating SNIPPET." (lower-object patch system)))) (mlet %store-monad ((tar -> (lookup-input "tar")) + (gzip -> (lookup-input "gzip")) + (bzip2 -> (lookup-input "bzip2")) + (lzip -> (lookup-input "lzip")) (xz -> (lookup-input "xz")) (patch -> (lookup-input "patch")) (locales -> (lookup-input "locales")) - (decomp -> (lookup-input decompression-type)) + (decomp -> (and=> decompression-type lookup-input)) (patches (sequence %store-monad (map instantiate-patch patches)))) (define build (with-imported-modules '((guix build utils)) #~(begin (use-modules (ice-9 ftw) + (ice-9 match) + (ice-9 regex) (srfi srfi-1) + (srfi srfi-26) (guix build utils)) + (define (tarball? file-name) + ;; Return true if FILE-NAME has a tar extension. + (string-match "\\.tar(\\..*)?$" file-name)) + ;; The --sort option was added to GNU tar in version 1.28, released ;; 2014-07-28. During bootstrap we must cope with older versions. (define tar-supports-sort? @@ -702,12 +713,15 @@ specifies modules in scope when evaluating SNIPPET." (package-version locales))))) (setlocale LC_ALL "en_US.utf8")) - (setenv "PATH" (string-append #+xz "/bin" ":" - #+decomp "/bin")) + (setenv "PATH" + (string-append #+xz "/bin" + (if #+decomp + (string-append ":" #+decomp "/bin") + ""))) (setenv "XZ_DEFAULTS" (string-join (%xz-parallel-args))) - ;; SOURCE may be either a directory or a tarball. + ;; SOURCE may be either a directory, a tarball or a simple file. (if (file-is-directory? #+source) (let* ((store (%store-directory)) (len (+ 1 (string-length store))) @@ -716,31 +730,51 @@ specifies modules in scope when evaluating SNIPPET." (directory (string-drop base (+ 1 dash)))) (mkdir directory) (copy-recursively #+source directory)) - #+(if (string=? decompression-type "unzip") - #~(invoke "unzip" #+source) - #~(invoke (string-append #+tar "/bin/tar") - "xvf" #+source))) - - (let ((directory (first-file "."))) - (format (current-error-port) - "source is under '~a'~%" directory) - (chdir directory) - - (for-each apply-patch '#+patches) - - #+(if snippet - #~(let ((module (make-fresh-user-module))) - (module-use-interfaces! - module - (map resolve-interface '#+modules)) - ((@ (system base compile) compile) - '#+snippet - #:to 'value - #:opts %auto-compilation-options - #:env module)) - #~#t) - - (chdir "..") + ;; File is *not* a directory. + (cond + ((tarball? #+source) + (invoke (string-append #+tar "/bin/tar") + "xvf" #+source)) + ((and=> #+decompression-type (cut string= "unzip" <>)) + ("unzip" (invoke "unzip" #+source))) + (else + ;; A simple file, either compressed or not. + (match #+decompression-type + ;; Note: Referring to the store unzip here (#+unzip) + ;; introduces a cycle. + ("unzip" (invoke "unzip" #+source)) + (else + ;; bzip2, gzip, lzip and xz share a common CLI. + (let ((name (strip-store-file-name #+source)) + (command (and=> #+decomp + (cut string-append <> "/bin/" + #+decompression-type)))) + (copy-file #+source name) + (when command + (invoke command "--decompress" name)))))))) + + + (let* ((file (first-file ".")) + (directory (if (file-is-directory? file) + file + "."))) + (format (current-error-port) "source is at '~a'~%" file) + + (with-directory-excursion directory + + (for-each apply-patch '#+patches) + + #+(if snippet + #~(let ((module (make-fresh-user-module))) + (module-use-interfaces! + module + (map resolve-interface '#+modules)) + ((@ (system base compile) compile) + '#+snippet + #:to 'value + #:opts %auto-compilation-options + #:env module)) + #~#t)) (unless tar-supports-sort? (call-with-output-file ".file_list" diff --git a/tests/packages.scm b/tests/packages.scm index a867f2fd6d..5c84dbf4b8 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès -;;; Copyright © Jan (janneke) Nieuwenhuizen +;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2021 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -17,12 +18,12 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . -(define-module (test-packages) +(define-module (tests packages) #:use-module (guix tests) #:use-module (guix store) #:use-module (guix monads) #:use-module (guix grafts) - #:use-module ((guix gexp) #:select (local-file local-file-file)) + #:use-module (guix gexp) #:use-module (guix utils) #:use-module ((guix diagnostics) ;; Rename the 'location' binding to allow proper syntax @@ -32,6 +33,7 @@ (else name)))) #:use-module ((gcrypt hash) #:prefix gcrypt:) #:use-module (guix derivations) + #:use-module (guix download) #:use-module (guix packages) #:use-module (guix grafts) #:use-module (guix search-paths) @@ -576,6 +578,11 @@ (build-derivations %store (list drv)) (call-with-input-file output get-string-all))) + +;;; +;;; Source derivation with snippets. +;;; + (unless (network-reachable?) (test-skip 1)) (test-equal "package-source-derivation, snippet" "OK" @@ -631,6 +638,80 @@ (and (build-derivations %store (list (pk 'snippet-drv drv))) (call-with-input-file out get-string-all)))) +;; Note: lzip is not part of bootstrap-coreutils&co, so is not included to +;; avoid having to rebuild the world. +(define compressors '(("gzip" . "gz") + ("xz" . "xz") + ("bzip2" . "bz2") + (#f . #f))) + +(for-each + (match-lambda + ((comp . ext) + (unless (network-reachable?) (test-skip 1)) + (test-equal (string-append "origin->derivation, single file with snippet " + "(compression: " (if comp comp "None") ")") + "2 + 2 = 4" + (let* ((name "maths") + (compressed-name (if comp + (string-append name "." ext) + name)) + (command #~(if #+comp + (string-append #+%bootstrap-coreutils&co + "/bin/" #+comp) + #f)) + (f (with-imported-modules '((guix build utils)) + (computed-file compressed-name + #~(begin + (use-modules (guix build utils) + (rnrs io simple)) + (with-output-to-file #+name + (lambda _ + (format #t "2 + 2 = 5"))) + (when #+command + (invoke #+command #+name)) + (copy-file #+compressed-name #$output))))) + (file-drv (run-with-store %store (lower-object f))) + (file (derivation->output-path file-drv)) + (file-drv-outputs (derivation-outputs file-drv)) + (_ (build-derivations %store (list file-drv))) + (file-hash (derivation-output-hash + (assoc-ref file-drv-outputs "out"))) + ;; Create an origin using the above computed file and its hash. + (source (origin + (method url-fetch) + (uri (string-append "file://" file)) + (file-name compressed-name) + (patch-inputs `(("tar" ,%bootstrap-coreutils&co) + ("xz" ,%bootstrap-coreutils&co) + ("bzip2" ,%bootstrap-coreutils&co) + ("gzip" ,%bootstrap-coreutils&co))) + (patch-guile %bootstrap-guile) + (modules '((guix build utils))) + (snippet `(substitute* ,name + (("5") "4"))) + (hash (content-hash file-hash)))) + ;; Build origin. + (drv (run-with-store %store (origin->derivation source))) + (out (derivation->output-path drv))) + ;; Decompress the resulting tar.xz and return its content. + (and (build-derivations %store (list drv)) + (let* ((bin #~(string-append #+%bootstrap-coreutils&co + "/bin")) + (f (computed-file + name + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (setenv "PATH" #+bin) + (invoke "tar" "xvf" #+out) + (copy-file #+name #$output))))) + (drv (run-with-store %store (lower-object f))) + (_ (build-derivations %store (list drv)))) + (call-with-input-file (derivation->output-path drv) + get-string-all))))))) + compressors) + (test-assert "return value" (let ((drv (package-derivation %store (dummy-package "p")))) (and (derivation? drv) -- 2.29.2 ------------=_1611719883-25584-3-- From unknown Sun Aug 17 01:50:04 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Maxim Cournoyer Subject: bug#45959: closed (Re: bug#45773: [PATCH core-updates 0/1] Allow patch-and-repack to work with plain files.) Message-ID: References: <87wnvzyqu5.fsf_-_@gmail.com> <20210118165122.25813-2-maxim.cournoyer@gmail.com> X-Gnu-PR-Message: they-closed 45959 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 45959@debbugs.gnu.org Date: Wed, 27 Jan 2021 03:58:03 +0000 Content-Type: multipart/mixed; boundary="----------=_1611719883-25584-5" This is a multi-part message in MIME format... ------------=_1611719883-25584-5 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #45773: [PATCH core-updates v3 2/2] build-systems/gnu: Allow unpacking/repa= cking more kind of files. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 45959@debbugs.gnu.org. --=20 45773: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D45773 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1611719883-25584-5 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 45773-done) by debbugs.gnu.org; 27 Jan 2021 03:57:32 +0000 Received: from localhost ([127.0.0.1]:43254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4bxT-0006dQ-R2 for submit@debbugs.gnu.org; Tue, 26 Jan 2021 22:57:32 -0500 Received: from mail-qk1-f178.google.com ([209.85.222.178]:46641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l4bxS-0006d8-3u; Tue, 26 Jan 2021 22:57:30 -0500 Received: by mail-qk1-f178.google.com with SMTP id a7so569266qkb.13; Tue, 26 Jan 2021 19:57:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-transfer-encoding; bh=9zRkkNeuLpkXYdFUAaY8o6Tp2v1Ai3QiaQn+qxzV3Dg=; b=ZoSdJqGWA9UIao9OywvK9R4S6ULo/z0spH5P++3Gufmd21Wy19dHJ2wNN7Ypc3k2Nd OD2M79bA1pI0s139X5WQGjm7GrpoVu+gj8iegNKSe8AEKSynC5SnuA1Ek+uLVWtHW/xJ R9E820yAUJaU1J5yuCP2MkxR3mq09v6Zw7FicsepgJUIUgeBIbLVYtr/KiNey4K8wnDp uUMtv00sWGOxnbk2qTd2U4aYFoFApXOK2pPVCUS61bjHbV7kUMedn8Udk7l+L3/fUp+S zZ0HUQ23zu+JKWXLBBnYSbulqp3FUTR1eNeCoVdr7ooZehKX+7hng+VpILS8WrKzB/ih tTPA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=9zRkkNeuLpkXYdFUAaY8o6Tp2v1Ai3QiaQn+qxzV3Dg=; b=tH4NeYm2V/dOMQmAyc3qq7nfkOJVdNJa6Uox9MfB7BoMpZHmH3jAXpwms7B3UZfdOs h1mQ0bedihRZ1aGNue6TuquaktHclRGx6hwWH16snVb1x5UgwazD8gN2LPSxydEhfHCs 3qftWoWk2lQy9gwYPB/Bpji1G0h3G+/N0yJQWPnka7e9amme5qBneLts644ggZ4YA7cI WGHhs8g6ScKBvodYQhNo6fWR+p+sqKK2NpcIqMTSPxB5lVKRdm8ndU6GTG4ESH4pbRz1 qL7pJpzMnw3b5InrIjYq2FRnmFdUOIrEpoUKVUBZAnTKuwRgbVaOsX+gTRzD6wUq0Uo6 Qa/Q== X-Gm-Message-State: AOAM532SUPQCS4UtZsop5ls0VACqRcjjv7oAHjMXetGfLSoZHwn7s2Tw F/YqAU7YUB2sgssmPE0NNQuSe5Zw7ws= X-Google-Smtp-Source: ABdhPJz9bM2PDS1wwOaov/2NfN9ez3t4v2bjkSeEwtH3VDOJZLtFqilUsIpEHZjr5ezLD54USzxexg== X-Received: by 2002:a05:620a:2105:: with SMTP id l5mr9025465qkl.126.1611719844267; Tue, 26 Jan 2021 19:57:24 -0800 (PST) Received: from hurd (dsl-10-132-34.b2b2c.ca. [72.10.132.34]) by smtp.gmail.com with ESMTPSA id n94sm549163qtd.28.2021.01.26.19.57.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jan 2021 19:57:23 -0800 (PST) From: Maxim Cournoyer To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: bug#45773: [PATCH core-updates 0/1] Allow patch-and-repack to work with plain files. References: <20210110200535.24377-1-maxim.cournoyer@gmail.com> <20210113174021.23960-1-maxim.cournoyer@gmail.com> <877dof4dgr.fsf_-_@gnu.org> <87k0sfl5pc.fsf@gmail.com> Date: Tue, 26 Jan 2021 22:57:22 -0500 In-Reply-To: <87k0sfl5pc.fsf@gmail.com> (Maxim Cournoyer's message of "Thu, 14 Jan 2021 13:43:43 -0500") Message-ID: <87wnvzyqu5.fsf_-_@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 45773-done Cc: 45774-done@debbugs.gnu.org, 45773-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Hi Ludo, Maxim Cournoyer writes: > Hi Ludovic, > > Ludovic Court=C3=A8s writes: > >> Hi! >> >> Maxim Cournoyer skribis: >> >>> Before this change, only plain directories, tar or zip archives were su= pported >>> as the source of a package for the GNU build system; anything else woul= d cause >>> the unpack phase to fail. Origins relying on snippets would suffer fro= m the >>> same problem. >>> >>> This change adds the support to use files of the following extensions: = .gz, >>> .Z, .bz2, .lz, and .xz, even when they are not tarballs. Files of unkn= own >>> extensions are treated as uncompressed files and supported as well. >>> >>> * guix/packages.scm (patch-and-repack): Only add the compressor utility= to the >>> PATH when the file is compressed. Bind more inputs in the mlet, and us= e them >>> for decompressing single files. Adjust decompression and compression r= outines. >>> [decompression-type]: Return #f when no known compression extension is = used. >>> [tarball?]: New nested procedure. >>> * guix/build/utils.scm (compressor, tarball?): New procedures. Move >>> %xz-parallel-args to the new 'compression helpers' section. >>> * tests/packages.scm: Add tests. Add missing copyright year for Jan. >>> * guix/build/gnu-build-system.scm (first-subdirectory): Return #f when = no >>> sub-directory was found. >>> (unpack): Support more file types, including uncompressed plain files. >>> --- >>> guix/build/gnu-build-system.scm | 24 ++++++-- >>> guix/build/utils.scm | 47 ++++++++++----- >>> guix/packages.scm | 100 +++++++++++++++++--------------- >>> guix/tests.scm | 40 ++++++++++++- >>> tests/builders.scm | 40 ++++++++++++- >>> tests/packages.scm | 69 +++++++++++++++++++++- >>> 6 files changed, 247 insertions(+), 73 deletions(-) >> >> How frequent is it for an origin to be a regular file other than an >> archive? The underlying question for me is: will this generalization >> and increased complexity pay off? WDYT? > > I think consistency is the main driver here. The url-fetch method > supports single file sources; it makes sense that the other components > handling sources support it as well. It's hard to judge of the > popularity of such a feature when it's never been available; but some > use cases come to mind such as single Emacs package file. I've made use > of such feature for the new texlive-updmap.cfg definition in > . I've been building a sizable part of core-updates on top of this change now for nearly two weeks, and in this time it's already come handy twice. I've made sure the tests ran fine and pushed to core-updates as commit cfcead2e515c0dae02127e5a76496463898be6b6. Let me know if anything breaks :-). Maxim ------------=_1611719883-25584-5 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 18 Jan 2021 16:52:23 +0000 Received: from localhost ([127.0.0.1]:48161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l1XlL-0000mi-KV for submit@debbugs.gnu.org; Mon, 18 Jan 2021 11:52:23 -0500 Received: from lists.gnu.org ([209.51.188.17]:39460) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1l1Xl5-0000lf-7P for submit@debbugs.gnu.org; Mon, 18 Jan 2021 11:52:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:42038) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1Xl4-0002ea-RF for guix-patches@gnu.org; Mon, 18 Jan 2021 11:52:02 -0500 Received: from mail-qk1-x733.google.com ([2607:f8b0:4864:20::733]:37954) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1Xl1-0005gc-K0; Mon, 18 Jan 2021 11:52:02 -0500 Received: by mail-qk1-x733.google.com with SMTP id w79so19205507qkb.5; Mon, 18 Jan 2021 08:51:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=93I9hcIBZAt02KLcqyLBdmz5tQhsR8FszOh0O4hOiyQ=; b=WDdX8RRtz/eK/xRIAyPzvjJzT30QHm98zTuYjUX6HgIQSUfY2a8QOR+uePMBg6QuC2 cpFz22CLVMYsTgII4uaGsyEySv43R7iXH/mejRU+XADCRVea3V3sBUxoMUi+SDVva7Wo hGaz292cbM1en7QkpPGz/Y1WgH5uh3mt38+R1K8DYCyuFncUpFxk4lDutck8dWp1bZ+9 OywB/BUxu0mvmxNH7LCvyesIK30LKIvx0kQQHeLM9uH2T9FdYTO3H5/PYNvPWpt201Q4 ng3iycIj7eVDzZQs80NAt0m1Hg/GF9wt11P5Lcqv2usw0fnRMr40W26N0aqikr3lBjLr yQyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=93I9hcIBZAt02KLcqyLBdmz5tQhsR8FszOh0O4hOiyQ=; b=nrk7bBU9e484hsxiueD/P2yHQsUIS3BimNYKmU9uPUv7LGQQUFfg+G6+eJj+CYzqzI /y0vOJjbPQSzAJA03GXv3YJfbQ8HN8BbLPl3FSBV5CROpIHbrPKbyatfw4bpRSEs68g3 wM7/GgVIN8yrlOH+UL5cOIxE7pFFEip4rv98XzyD0jzPOnC3drpL26lMYiPLghWjaFn8 SBZXVdZPptG95CHS7ipPoFdYLGncFRrB95Ti4Z05gP4HUc1kLqEjg/FUaHC2m99eAdCH TDQi3IRa/Z8r+umhLkFzcDUCWWIv+46+nGut0owj8mCgA1Uf5qNvSGWGiufoxqS416JM 8bWg== X-Gm-Message-State: AOAM531xrbM7JCGZdIg/6vK6ADMwbY8by9NKs0EveFwQtYIFxpTGbFBa G1xAs18Lvbh7Li7eOMNQu4Uj93M7vZM= X-Google-Smtp-Source: ABdhPJw/ydeNhDSWz1dGaEA/U62gQoq7BcIzXeX3EwA2AJhvXQU8QfMe5FGZmBGtgsjAuw/vMxulLQ== X-Received: by 2002:a05:620a:947:: with SMTP id w7mr432151qkw.389.1610988716327; Mon, 18 Jan 2021 08:51:56 -0800 (PST) Received: from localhost.localdomain (dsl-149-228.b2b2c.ca. [66.158.149.228]) by smtp.gmail.com with ESMTPSA id m64sm10992602qkb.90.2021.01.18.08.51.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Jan 2021 08:51:55 -0800 (PST) From: Maxim Cournoyer To: guix-patches@gnu.org, 45774@debbugs.gnu.org Subject: [PATCH core-updates v3 2/2] build-systems/gnu: Allow unpacking/repacking more kind of files. Date: Mon, 18 Jan 2021 11:51:21 -0500 Message-Id: <20210118165122.25813-2-maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210118165122.25813-1-maxim.cournoyer@gmail.com> References: <20210118165122.25813-1-maxim.cournoyer@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=yes Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::733; envelope-from=maxim.cournoyer@gmail.com; helo=mail-qk1-x733.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_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: 1.0 (+) X-Debbugs-Envelope-To: submit Cc: ludo@gnu.org, Maxim Cournoyer X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) Before this change, only plain directories, tar or zip archives were supported as the source of a package for the GNU build system; anything else would cause the unpack phase to fail. Origins relying on snippets would suffer from the same problem. This change adds the support to use files of the following extensions: .gz, .Z, .bz2, .lz, and .xz, even when they are not tarballs. Files of unknown extensions are treated as uncompressed files and supported as well. * guix/packages.scm (patch-and-repack): Only add the compressor utility to the PATH when the file is compressed. Bind more inputs in the mlet, and use them for decompressing single files. Adjust the decompression and compression routines. [decompression-type]: Remove nested variable. * guix/build/utils.scm (compressor, tarball?): New procedures. Move %xz-parallel-args to the new 'compression helpers' section. * tests/packages.scm: Add tests. Add missing copyright year for Jan. * guix/build/gnu-build-system.scm (first-subdirectory): Return #f when no sub-directory was found. (unpack): Support more file types, including uncompressed plain files. --- guix/build/gnu-build-system.scm | 24 +++++-- guix/build/utils.scm | 47 +++++++++---- guix/packages.scm | 117 ++++++++++++++++++-------------- guix/tests.scm | 43 +++++++++++- tests/builders.scm | 35 +++++++++- tests/packages.scm | 72 +++++++++++++++++++- 6 files changed, 259 insertions(+), 79 deletions(-) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index f8e8a46854..66edd2de2d 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès ;;; Copyright © 2018 Mark H Weaver ;;; Copyright © 2020 Brendan Tildesley +;;; Copyright © 2021 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -60,13 +61,15 @@ See https://reproducible-builds.org/specs/source-date-epoch/." (setenv "SOURCE_DATE_EPOCH" "1")) (define (first-subdirectory directory) - "Return the file name of the first sub-directory of DIRECTORY." + "Return the file name of the first sub-directory of DIRECTORY or false, when +there are none." (match (scandir directory (lambda (file) (and (not (member file '("." ".."))) (file-is-directory? (string-append directory "/" file))))) - ((first . _) first))) + ((first . _) first) + (_ #f))) (define* (set-paths #:key target inputs native-inputs (search-paths '()) (native-search-paths '()) @@ -155,10 +158,19 @@ working directory." (copy-recursively source "." #:keep-mtime? #t)) (begin - (if (string-suffix? ".zip" source) - (invoke "unzip" source) - (invoke "tar" "xvf" source)) - (chdir (first-subdirectory "."))))) + (cond + ((string-suffix? ".zip" source) + (invoke "unzip" source)) + ((tarball? source) + (invoke "tar" "xvf" source)) + (else + (let ((name (strip-store-file-name source)) + (command (compressor source))) + (copy-file source name) + (when command + (invoke command "--decompress" name))))) + ;; Attempt to change into child directory. + (and=> (first-subdirectory ".") chdir)))) (define* (bootstrap #:key bootstrap-scripts #:allow-other-keys) diff --git a/guix/build/utils.scm b/guix/build/utils.scm index 2cbdb31505..01904785bd 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -6,7 +6,7 @@ ;;; Copyright © 2018 Arun Isaac ;;; Copyright © 2018, 2019 Ricardo Wurmus ;;; Copyright © 2020 Efraim Flashner -;;; Copyright © 2020 Maxim Cournoyer +;;; Copyright © 2020, 2021 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -51,6 +51,10 @@ package-name->name+version parallel-job-count + compressor + tarball? + %xz-parallel-args + directory-exists? executable-file? symbolic-link? @@ -113,9 +117,7 @@ make-desktop-entry-file - locale-category->string - - %xz-parallel-args)) + locale-category->string)) ;;; @@ -137,6 +139,32 @@ (module-replace! (current-module) '(setvbuf))) (else #f)) + +;;; +;;; Compression helpers. +;;; + +(define (compressor file-name) + "Return the name of the compressor package/binary used to compress or +decompress FILE-NAME, based on its file extension, else false." + (cond ((string-suffix? "gz" file-name) "gzip") + ((string-suffix? "Z" file-name) "gzip") + ((string-suffix? "bz2" file-name) "bzip2") + ((string-suffix? "lz" file-name) "lzip") + ((string-suffix? "zip" file-name) "unzip") + ((string-suffix? "xz" file-name) "xz") + (else #f))) ;no compression used/unknown file extension + +(define (tarball? file-name) + "True when FILE-NAME has a tar file extension." + (string-match "\\.(tar(\\..*)?|tgz|tbz)$" file-name)) + +(define (%xz-parallel-args) + "The xz arguments required to enable bit-reproducible, multi-threaded +compression." + (list "--memlimit=50%" + (format #f "--threads=~a" (max 2 (parallel-job-count))))) + ;;; ;;; Directories. @@ -1536,17 +1564,6 @@ returned." LC_NAME LC_NUMERIC LC_PAPER LC_TELEPHONE LC_TIME))) - -;;; -;;; Others. -;;; - -(define (%xz-parallel-args) - "The xz arguments required to enable bit-reproducible, multi-threaded -compression." - (list "--memlimit=50%" - (format #f "--threads=~a" (max 2 (parallel-job-count))))) - ;;; Local Variables: ;;; eval: (put 'call-with-output-file/atomic 'scheme-indent-function 1) ;;; eval: (put 'call-with-ascii-input-file 'scheme-indent-function 1) diff --git a/guix/packages.scm b/guix/packages.scm index cd2cded9ee..73f605f3a9 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -5,7 +5,7 @@ ;;; Copyright © 2016 Alex Kost ;;; Copyright © 2017, 2019, 2020 Efraim Flashner ;;; Copyright © 2019 Marius Bakke -;;; Copyright © 2020 Maxim Cournoyer +;;; Copyright © 2020, 2021 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -23,6 +23,7 @@ ;;; along with GNU Guix. If not, see . (define-module (guix packages) + #:use-module ((guix build utils) #:select (compressor tarball?)) #:use-module (guix utils) #:use-module (guix records) #:use-module (guix store) @@ -609,14 +610,6 @@ specifies modules in scope when evaluating SNIPPET." ((package) package) (#f #f))))) - (define decompression-type - (cond ((string-suffix? "gz" source-file-name) "gzip") - ((string-suffix? "Z" source-file-name) "gzip") - ((string-suffix? "bz2" source-file-name) "bzip2") - ((string-suffix? "lz" source-file-name) "lzip") - ((string-suffix? "zip" source-file-name) "unzip") - (else "xz"))) - (define original-file-name ;; Remove the store prefix plus the slash, hash, and hyphen. (let* ((sans (string-drop source-file-name @@ -651,17 +644,24 @@ specifies modules in scope when evaluating SNIPPET." (lower-object patch system)))) (mlet %store-monad ((tar -> (lookup-input "tar")) + (gzip -> (lookup-input "gzip")) + (bzip2 -> (lookup-input "bzip2")) + (lzip -> (lookup-input "lzip")) (xz -> (lookup-input "xz")) (patch -> (lookup-input "patch")) (locales -> (lookup-input "locales")) - (decomp -> (lookup-input decompression-type)) + (comp -> (and=> (compressor source-file-name) + lookup-input)) (patches (sequence %store-monad (map instantiate-patch patches)))) (define build (with-imported-modules '((guix build utils)) #~(begin (use-modules (ice-9 ftw) + (ice-9 match) + (ice-9 regex) (srfi srfi-1) + (srfi srfi-26) (guix build utils)) ;; The --sort option was added to GNU tar in version 1.28, released @@ -723,54 +723,67 @@ specifies modules in scope when evaluating SNIPPET." (package-version locales))))) (setlocale LC_ALL "en_US.utf8")) - (setenv "PATH" (string-append #+xz "/bin" ":" - #+decomp "/bin")) + (setenv "PATH" + (string-append #+xz "/bin" + (if #+comp + (string-append ":" #+comp "/bin") + ""))) (setenv "XZ_DEFAULTS" (string-join (%xz-parallel-args))) - ;; SOURCE may be either a directory or a tarball. - (if (file-is-directory? #+source) - (let* ((store (%store-directory)) - (len (+ 1 (string-length store))) - (base (string-drop #+source len)) - (dash (string-index base #\-)) - (directory (string-drop base (+ 1 dash)))) - (mkdir directory) - (copy-recursively #+source directory)) - #+(if (string=? decompression-type "unzip") - #~(invoke "unzip" #+source) - #~(invoke (string-append #+tar "/bin/tar") - "xvf" #+source))) - - (let ((directory (first-file "."))) - (format (current-error-port) - "source is under '~a'~%" directory) - (chdir directory) - - (for-each apply-patch '#+patches) - - #+(if snippet - #~(let ((module (make-fresh-user-module))) - (module-use-interfaces! - module - (map resolve-interface '#+modules)) - ((@ (system base compile) compile) - '#+snippet - #:to 'value - #:opts %auto-compilation-options - #:env module)) - #~#t) - - (chdir "..") + ;; SOURCE may be either a directory, a tarball or a simple file. + (let ((name (strip-store-file-name #+source)) + (command (and=> #+comp (cut string-append <> "/bin/" + (compressor #+source))))) + (if (file-is-directory? #+source) + (copy-recursively #+source name) + (cond + ((tarball? #+source) + (invoke (string-append #+tar "/bin/tar") "xvf" #+source)) + ((and=> (compressor #+source) (cut string= "unzip" <>)) + ;; Note: Referring to the store unzip here (#+unzip) + ;; would introduce a cycle. + ("unzip" (invoke "unzip" #+source))) + (else + (copy-file #+source name) + (when command + (invoke command "--decompress" name)))))) + + (let* ((file (first-file ".")) + (directory (if (file-is-directory? file) + file + "."))) + (format (current-error-port) "source is at '~a'~%" file) + + (with-directory-excursion directory + + (for-each apply-patch '#+patches) + + #+(if snippet + #~(let ((module (make-fresh-user-module))) + (module-use-interfaces! + module + (map resolve-interface '#+modules)) + ((@ (system base compile) compile) + '#+snippet + #:to 'value + #:opts %auto-compilation-options + #:env module)) + #~#t)) ;; If SOURCE is a directory (such as a checkout), return a ;; directory. Otherwise create a tarball. - (if (file-is-directory? #+source) - (copy-recursively directory #$output - #:log (%make-void-port "w")) - (repack directory #$output)))))) - - (let ((name (if (checkout? original-file-name) + (cond + ((file-is-directory? #+source) + (copy-recursively directory #$output + #:log (%make-void-port "w"))) + ((not #+comp) + (copy-file file #$output)) + (else + (repack directory #$output))))))) + + (let ((name (if (or (checkout? original-file-name) + (not (compressor original-file-name))) original-file-name (tarxz-name original-file-name)))) (gexp->derivation name build diff --git a/guix/tests.scm b/guix/tests.scm index fc3d521163..da75835099 100644 --- a/guix/tests.scm +++ b/guix/tests.scm @@ -20,12 +20,13 @@ #:use-module ((guix config) #:select (%storedir %localstatedir)) #:use-module (guix store) #:use-module (guix derivations) + #:use-module (guix gexp) #:use-module (guix packages) #:use-module (guix base32) #:use-module (guix serialization) #:use-module (guix monads) #:use-module ((guix utils) #:select (substitute-keyword-arguments)) - #:use-module ((guix build utils) #:select (mkdir-p)) + #:use-module ((guix build utils) #:select (mkdir-p compressor)) #:use-module ((gcrypt hash) #:hide (sha256)) #:use-module (guix build-system gnu) #:use-module (gnu packages base) @@ -60,7 +61,9 @@ dummy-package dummy-origin - gnu-make-for-tests)) + gnu-make-for-tests + + test-file)) ;;; Commentary: ;;; @@ -435,6 +438,42 @@ default values, and with EXTRA-FIELDS set as specified." (native-inputs '()) ;no need for 'pkg-config' (inputs %bootstrap-inputs-for-tests)))) + +;;; +;;; Test utility procedures. + +(define (test-file store name content) + "Create a simple file in STORE with CONTENT (a string), compressed according +to its file name extension. Return both its file name and its hash." + (let* ((ext (string-index-right name #\.)) + (name-sans-ext (if ext + (string-take name (string-index-right name #\.)) + name)) + (comp (compressor name)) + (command #~(if #+comp + (string-append #+%bootstrap-coreutils&co + "/bin/" #+comp) + #f)) + (f (with-imported-modules '((guix build utils)) + (computed-file name + #~(begin + (use-modules (guix build utils) + (rnrs io simple)) + (with-output-to-file #+name-sans-ext + (lambda _ + (format #t #+content))) + (when #+command + (invoke #+command #+name-sans-ext)) + (copy-file #+name #$output))))) + (file-drv (run-with-store store (lower-object f))) + (file (derivation->output-path file-drv)) + (file-drv-outputs (derivation-outputs file-drv)) + (_ (build-derivations store (list file-drv))) + (file-hash (derivation-output-hash + (assoc-ref file-drv-outputs "out")))) + (values file file-hash))) + +;;; ;; Local Variables: ;; eval: (put 'call-with-derivation-narinfo 'scheme-indent-function 1) ;; eval: (put 'call-with-derivation-substitute 'scheme-indent-function 2) diff --git a/tests/builders.scm b/tests/builders.scm index fdcf38ded3..624547500a 100644 --- a/tests/builders.scm +++ b/tests/builders.scm @@ -17,10 +17,12 @@ ;;; along with GNU Guix. If not, see . -(define-module (test-builders) +(define-module (tests builders) #:use-module (guix download) #:use-module (guix build-system) #:use-module (guix build-system gnu) + #:use-module (guix build gnu-build-system) + #:use-module (guix build utils) #:use-module (guix store) #:use-module (guix utils) #:use-module (guix base32) @@ -32,7 +34,9 @@ package-derivation package-native-search-paths)) #:use-module (gnu packages bootstrap) #:use-module (ice-9 match) + #:use-module (ice-9 textual-ports) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) #:use-module (srfi srfi-64)) ;; Test the higher-level builders. @@ -78,4 +82,33 @@ (test-assert "gnu-build-system" (build-system? gnu-build-system)) +(define unpack (assoc-ref %standard-phases 'unpack)) + +(define compressors '(("gzip" . "gz") + ("xz" . "xz") + ("bzip2" . "bz2") + (#f . #f))) + +(for-each + (match-lambda + ((comp . ext) + + (unless (network-reachable?) (test-skip 1)) ;for bootstrap binaries + (test-equal (string-append "gnu-build-system unpack phase, " + "single file (compression: " + (if comp comp "None") ")") + "expected text" + (let*-values + (((name) "test") + ((compressed-name) (if ext + (string-append name "." ext) + name)) + ((file hash) (test-file %store compressed-name "expected text"))) + (call-with-temporary-directory + (lambda (dir) + (with-directory-excursion dir + (unpack #:source file) + (call-with-input-file name get-string-all)))))))) + compressors) + (test-end "builders") diff --git a/tests/packages.scm b/tests/packages.scm index a867f2fd6d..b3ccd98e48 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès -;;; Copyright © Jan (janneke) Nieuwenhuizen +;;; Copyright © 2018 Jan (janneke) Nieuwenhuizen +;;; Copyright © 2021 Maxim Cournoyer ;;; ;;; This file is part of GNU Guix. ;;; @@ -17,13 +18,14 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . -(define-module (test-packages) +(define-module (tests packages) #:use-module (guix tests) #:use-module (guix store) #:use-module (guix monads) #:use-module (guix grafts) - #:use-module ((guix gexp) #:select (local-file local-file-file)) + #:use-module (guix gexp) #:use-module (guix utils) + #:use-module ((guix build utils) #:select (tarball?)) #:use-module ((guix diagnostics) ;; Rename the 'location' binding to allow proper syntax ;; matching when setting the 'location' field of a package. @@ -32,6 +34,7 @@ (else name)))) #:use-module ((gcrypt hash) #:prefix gcrypt:) #:use-module (guix derivations) + #:use-module (guix download) #:use-module (guix packages) #:use-module (guix grafts) #:use-module (guix search-paths) @@ -50,6 +53,7 @@ #:use-module (gnu packages version-control) #:use-module (gnu packages xml) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) #:use-module (srfi srfi-35) @@ -576,6 +580,11 @@ (build-derivations %store (list drv)) (call-with-input-file output get-string-all))) + +;;; +;;; Source derivation with snippets. +;;; + (unless (network-reachable?) (test-skip 1)) (test-equal "package-source-derivation, snippet" "OK" @@ -631,6 +640,63 @@ (and (build-derivations %store (list (pk 'snippet-drv drv))) (call-with-input-file out get-string-all)))) +;; Note: lzip is not part of bootstrap-coreutils&co, so is not included to +;; avoid having to rebuild the world. +(define compressors '(("gzip" . "gz") + ("xz" . "xz") + ("bzip2" . "bz2") + (#f . #f))) + +(for-each + (match-lambda + ((comp . ext) + (unless (network-reachable?) (test-skip 1)) + (test-equal (string-append "origin->derivation, single file with snippet " + "(compression: " (if comp comp "None") ")") + "2 + 2 = 4" + (let*-values + (((name) "maths") + ((compressed-name) (if comp + (string-append name "." ext) + name)) + ((file hash) (test-file %store compressed-name "2 + 2 = 5")) + ;; Create an origin using the above computed file and its hash. + ((source) (origin + (method url-fetch) + (uri (string-append "file://" file)) + (file-name compressed-name) + (patch-inputs `(("tar" ,%bootstrap-coreutils&co) + ("xz" ,%bootstrap-coreutils&co) + ("bzip2" ,%bootstrap-coreutils&co) + ("gzip" ,%bootstrap-coreutils&co))) + (patch-guile %bootstrap-guile) + (modules '((guix build utils))) + (snippet `(substitute* ,name + (("5") "4"))) + (hash (content-hash hash)))) + ;; Build origin. + ((drv) (run-with-store %store (origin->derivation source))) + ((out) (derivation->output-path drv))) + ;; Decompress the resulting tar.xz and return its content. + (and (build-derivations %store (list drv)) + (if (tarball? out) + (let* ((bin #~(string-append #+%bootstrap-coreutils&co + "/bin")) + (f (computed-file + name + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + (setenv "PATH" #+bin) + (invoke "tar" "xvf" #+out) + (copy-file #+name #$output))))) + (drv (run-with-store %store (lower-object f))) + (_ (build-derivations %store (list drv)))) + (call-with-input-file (derivation->output-path drv) + get-string-all)) + (call-with-input-file out get-string-all))))))) + compressors) + (test-assert "return value" (let ((drv (package-derivation %store (dummy-package "p")))) (and (derivation? drv) -- 2.29.2 ------------=_1611719883-25584-5--