From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id OJzZH/hsX2GAAgEAgWs5BA (envelope-from ) for ; Thu, 07 Oct 2021 23:56:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id wOmUG/hsX2FjQQAAB5/wlQ (envelope-from ) for ; Thu, 07 Oct 2021 21:56:08 +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 2A18B6453 for ; Thu, 7 Oct 2021 23:56:08 +0200 (CEST) Received: from localhost ([::1]:45436 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYbN0-0006wI-Lj for larch@yhetil.org; Thu, 07 Oct 2021 17:56:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52496) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYbMw-0006vq-M8 for guix-patches@gnu.org; Thu, 07 Oct 2021 17:56:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:37046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mYbMw-0004aB-DO for guix-patches@gnu.org; Thu, 07 Oct 2021 17:56:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mYbMw-00072T-AD for guix-patches@gnu.org; Thu, 07 Oct 2021 17:56:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#42180] bug#51061: [PATCH v2 01/23] guix: Add extracting-download. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 07 Oct 2021 21:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42180 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Hartmut Goebel Cc: 42180@debbugs.gnu.org, 51061@debbugs.gnu.org Received: via spool by 42180-submit@debbugs.gnu.org id=B42180.163364371727000 (code B ref 42180); Thu, 07 Oct 2021 21:56:02 +0000 Received: (at 42180) by debbugs.gnu.org; 7 Oct 2021 21:55:17 +0000 Received: from localhost ([127.0.0.1]:48592 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYbMC-00071J-Rn for submit@debbugs.gnu.org; Thu, 07 Oct 2021 17:55:17 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50404) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mYbM5-00070n-Rj; Thu, 07 Oct 2021 17:55:10 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50000) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mYbLz-0003dx-R6; Thu, 07 Oct 2021 17:55:03 -0400 Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:59188 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mYbLz-000248-6i; Thu, 07 Oct 2021 17:55:03 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <626e4718c45c95a7278460f132bd38e08835e9f4.1633533541.git.h.goebel@crazy-compilers.com> Date: Thu, 07 Oct 2021 23:55:00 +0200 In-Reply-To: <626e4718c45c95a7278460f132bd38e08835e9f4.1633533541.git.h.goebel@crazy-compilers.com> (Hartmut Goebel's message of "Wed, 6 Oct 2021 17:20:19 +0200") Message-ID: <877deoa4az.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1633643768; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=GyhnZXc1NrB84uF/gb5FZnqhe0LudxGoc3FvOsoyWA4=; b=H7pzSGE2NZYB6je6+V3alp+AB5swgPtlYBNOvKCmvGSfl7V4ASn5SO0rFpg6h0DevaFOgj +YkbE0fWCbylAKdwBd1oo+uszZiMU4m/AGtkXgyc713OuoPjUcpYuzcefBKCL7yD33xoQL NuD+eDQ7Eoel4m2OUOk4sw97QCERk079Y3aHZV1OmM3n2R44xgaN8/UYDPMF6scrc3nxo/ wuLbo1yK05FyAS1D0Q+pSyt5QNBLe/CnnFMahr4uAYeHE5a1UJuF9Dgykfg11+hheRhuvF bQ/pPwZ8v6H/t+IHQtZ2AdHgnt403+mhut5Zxs9pKcX7aL/5PDVxCq2f10rsTQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633643768; a=rsa-sha256; cv=none; b=YXxtw4+EBhD3+kzmsXfIxspcmRFndIiZ04dk+wIJQGWLU36nnqPAzt+v/JDCGT4NhJcF78 w8TtFw1HnBe7oTTXsI9ss4SAH2P1aVUp91KQVve2hCw2n88Q/hFDgUjxH2bJzptPsZ1UOY B5aiUkpnuTzqn1lMxCD4P31Lb9lOAuSB6yQUfFLkiftat3llte6cq09+8R4/WsBlrq5TLD Z9gKBtrfzaV5fx9+jexq8TQ9YrFD7hkOsB63yj7BrqNI77ENNTVEzIrrjqZcS2yegKq2LS rFAkY62mD8gjOGxhXb0yuJdG8ydbK+XUGdh/oqs+Zcl46fqMvbRTGCsc46xouw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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-Migadu-Spam-Score: -2.22 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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-Migadu-Queue-Id: 2A18B6453 X-Spam-Score: -2.22 X-Migadu-Scanner: scn1.migadu.com X-TUID: 9kF3dLbXV1sF Hi Hartmut, Hartmut Goebel skribis: > * guix/extracting-download.scm: New file > * Makefile.am (MODULES): Add it. I see you already pushed this change, but AFAICS it hasn=E2=80=99t seen any= real review=E2=80=94not great. We don=E2=80=99t commit the whole project to sup= porting new APIs at this level without first having collectively looked into them. I=E2=80=99ll make some quick comments for now. You might consider revertin= g to leave people enough time to comment without pressure. First, could you explain the rationale and use cases? I can imagine reasons to do it this way, but also reasons to not do it this way. [...] > +++ b/guix/extracting-download.scm > @@ -0,0 +1,179 @@ > +;;; GNU Guix --- Functional package management for GNU > +;;; Copyright =C2=A9 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Court=C3= =A8s > +;;; Copyright =C2=A9 2017 Mathieu Lirzin > +;;; Copyright =C2=A9 2017 Christopher Baines > +;;; Copyright =C2=A9 2020 Jakub K=C4=85dzio=C5=82ka > +;;; Copyright =C2=A9 2020 Hartmut Goebel This many people? :-) > +(define* (http-fetch/extract url filename-to-extract hash-algo hash > + #:optional name > + #:key (system (%current-system)) (guile (default-gui= le))) Why =E2=80=98http-fetch=E2=80=99 when we have a generic =E2=80=98url-fetch= =E2=80=99? We=E2=80=99d rather like to see =E2=80=98url-fetch/extract=E2=80=99, and it= should be expressed in ~10 lines around (@ (guix download) url-fetch). > + "Return a fixed-output derivation that fetches an archive at URL, and > +extracts FILE_TO_EXTRACT from the archive. The FILE_TO_EXTRACT is expec= ted to > +have hash HASH of type HASH-ALGO (a symbol). By default, the file name = is the > +base name of URL; optionally, NAME can specify a different file name." > + (define file-name > + (match url > + ((head _ ...) > + (basename head)) > + (_ > + (basename url)))) > + > + (define guile-zlib > + (module-ref (resolve-interface '(gnu packages guile)) 'guile-zlib)) > + > + (define guile-json > + (module-ref (resolve-interface '(gnu packages guile)) 'guile-json-4)) > + > + (define gnutls > + (module-ref (resolve-interface '(gnu packages tls)) 'gnutls)) > + > + (define inputs > + `(("tar" ,(module-ref (resolve-interface '(gnu packages base)) > + 'tar)))) > + > + (define config.scm > + (scheme-file "config.scm" > + #~(begin > + (define-module (guix config) > + #:export (%system)) > + > + (define %system > + #$(%current-system))))) > + > + (define modules > + (cons `((guix config) =3D> ,config.scm) > + (delete '(guix config) > + (source-module-closure '((guix build download) > + (guix build utils) > + (guix utils) > + (web uri)))))) > + > + (define build > + (with-imported-modules modules > + (with-extensions (list guile-json gnutls ;for (guix swh) > + guile-zlib) This is really problematic: this code imports a ton of modules from the host side. (guix utils) is typically never imported on the build side because it pulls in everything. (web uri) must not be imported because it=E2=80=99s part of Guile (I think there=E2=80=99s a warning for this). A= ll the boilerplate above is because we=E2=80=99re importing the world. > +(define* (download-to-store/extract store url filename-to-extract > + #:optional (name (basename url)) > + #:key (log (current-error-port)) > + (verify-certificate? #t)) What about this one? What=E2=80=99s the intended use case? Last, we=E2=80=99ve put a lot of effort over the years in properly document= ing things, like: https://guix.gnu.org/manual/en/html_node/origin-Reference.html#index-url_= 002dfetch This should be held to the same standards. Thanks, Ludo=E2=80=99.