From patchwork Fri Jun 21 17:22:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon Tournier X-Patchwork-Id: 65521 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 8D6B027BBEA; Fri, 21 Jun 2024 19:13:46 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI, SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 77A3527BBE2 for ; Fri, 21 Jun 2024 19:13:45 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sKilL-00040C-Kh; Fri, 21 Jun 2024 14:13:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKil4-0003ww-VC for guix-patches@gnu.org; Fri, 21 Jun 2024 14:13:11 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKil3-0006Z0-VR; Fri, 21 Jun 2024 14:13:10 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sKikv-0003M6-VC; Fri, 21 Jun 2024 14:13:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#71697] [PATCH] guix: lint: Honor 'no-archival?' package property. Resent-From: Simon Tournier Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, pelzflorian@pelzflorian.de, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, matt@excalamus.com, maxim.cournoyer@gmail.com, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 21 Jun 2024 18:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 71697@debbugs.gnu.org Cc: Simon Tournier , Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Matthew Trzcinski , Maxim Cournoyer , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Florian Pelz , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Matthew Trzcinski , Maxim Cournoyer , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.171899357412836 (code B ref -1); Fri, 21 Jun 2024 18:13:01 +0000 Received: (at submit) by debbugs.gnu.org; 21 Jun 2024 18:12:54 +0000 Received: from localhost ([127.0.0.1]:43245 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKikn-0003Kn-Fg for submit@debbugs.gnu.org; Fri, 21 Jun 2024 14:12:54 -0400 Received: from lists.gnu.org ([209.51.188.17]:57290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sKikl-0003KE-9d for submit@debbugs.gnu.org; Fri, 21 Jun 2024 14:12:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sKhyE-0002B8-GM for guix-patches@gnu.org; Fri, 21 Jun 2024 13:22:42 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sKhyC-0006F1-8u for guix-patches@gnu.org; Fri, 21 Jun 2024 13:22:42 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-42181803bf2so3320715e9.1 for ; Fri, 21 Jun 2024 10:22:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718990557; x=1719595357; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=g/j/h95CqXP1iqbwYTBHZcJUqHM4KZmz2U0trIZfz1E=; b=Y/ruKoFxCyeSFMIlaAkL5mF5SjXiEo0kEfeV65mPfeylIZNx3WkqngIpqp84Wj7Eit jBIXA+wqPmV1GNF5HCQE1piHnvkwMyNGacBOUBFCBsltkYtD1FThF2vp4bI2CwxsV2p/ IuvlTohrHZMlce2nCyjYEbhBsscxNxH1jtGukDTcngLWQglMKklqzhwJbdJzw8nuHYg6 A1XQLiu1ufpmTUIYz7F6Ii9evL9cG1M/dvkB2rnRed0bak1E4iOJFxk3vNm1rFXIzf2X LTZLEtKoXxbktCo3AsbdhRcVMaAs+iQUNxI2MH3gk9DkEKNWL2epkqRvQutrAGLnZzhv TQUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718990557; x=1719595357; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=g/j/h95CqXP1iqbwYTBHZcJUqHM4KZmz2U0trIZfz1E=; b=c1eejR3ey16dfW4B8gu7EyzGzbuUcrtMqugNOyynyi6huZX6zQEfgPqwK+KL2oOTzg SVwqt+sdCSab5vgqW1vSkmjO/lkM6GuHpzzAlzLvmaDnwXLZszeUOXgkIkLEo6ej2fJl HRdRAFvR7R69rjwL9vzH4340KyyiSLzohcVQsxLZU6UAE17bnMbqduQHY3MV2kH/3VK1 mJyqAEZQHxd3Wv3dplOf8ycZdFGrKIWjldFmBLWmgpeEPnJynZ68f8SSpsMXg7o2hobI oK95rMZIErT2J+EaPOj+BEmiOhgWb/hheljepL41m1LnjHSZgXV6W6hg4T1y2iiWUiga D3gg== X-Gm-Message-State: AOJu0Yy3TkMKXiT4/4+h1IcMo74H8AWMcTOZPbJUgTqw/XDwoZevXeZ4 S+A3rZYeb+tUor/pcUWcUej++S9QEUfevvaZupzXS08JiMDmyop47QnrxQ== X-Google-Smtp-Source: AGHT+IGG37+NEWWVsARNnfRmZOy/y7qdUWlvl32yclS9FwRJR7VObW7V8+09GyWS6sI3QilyLIpo0A== X-Received: by 2002:a5d:5847:0:b0:362:3358:48cf with SMTP id ffacd0b85a97d-363171e2873mr6955747f8f.2.1718990556515; Fri, 21 Jun 2024 10:22:36 -0700 (PDT) Received: from lili.. ([89.207.175.12]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4247d21225fsm72658335e9.42.2024.06.21.10.22.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jun 2024 10:22:36 -0700 (PDT) From: Simon Tournier Date: Fri, 21 Jun 2024 19:22:24 +0200 Message-ID: <8cb162bcde91d3b39453de576caadb9a6f8f8733.1718990517.git.zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=zimon.toutoune@gmail.com; helo=mail-wm1-x32e.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-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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/lint.scm (check-archival): Skip the checker if the package is marked. * doc/guix.texi: Document it. Change-Id: I2e21b60ee4f02255f298740a2e9ebb1717e490ff --- doc/guix.texi | 15 ++++- guix/lint.scm | 154 ++++++++++++++++++++++++++------------------------ 2 files changed, 93 insertions(+), 76 deletions(-) base-commit: bc8a41f4a8d9f1f0525d7bc97c67ed3c8aea3111 diff --git a/doc/guix.texi b/doc/guix.texi index 769ca1399f..5c1cb89686 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -71,7 +71,7 @@ Copyright @copyright{} 2019 Alex Griffin@* Copyright @copyright{} 2019, 2020, 2021, 2022 Guillaume Le Vaillant@* Copyright @copyright{} 2020 Liliana Marie Prikler@* -Copyright @copyright{} 2019, 2020, 2021, 2022, 2023 Simon Tournier@* +Copyright @copyright{} 2019, 2020, 2021, 2022, 2023, 2024 Simon Tournier@* Copyright @copyright{} 2020 Wiktor Żelazny@* Copyright @copyright{} 2020 Damien Cassou@* Copyright @copyright{} 2020 Jakub Kądziołka@* @@ -15380,6 +15380,19 @@ Invoking guix lint prints a message and the @code{archival} checker stops doing anything until that limit has been reset. +Sometimes it is not desired to send a request for archiving each time +@command{guix lint} is run. The package might be marked to skip the +@code{archival} checker by honoring the @code{no-archival?} property in +package definition: + +@lisp +(define-public python-scikit-learn + (package + (name "python-scikit-learn") + ;; @dots{} + (properties '((no-archival? . #t))))) +@end lisp + @item cve @cindex security vulnerabilities @cindex CVE, Common Vulnerabilities and Exposures diff --git a/guix/lint.scm b/guix/lint.scm index 68d532968d..4c33ec6598 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -1717,84 +1717,88 @@ (define (check-archival package) (lookup-directory-by-nar-hash (content-hash-value hash) (content-hash-algorithm hash))) - (parameterize ((%allow-request? skip-when-limit-reached)) - (catch #t - (lambda () - (match (package-source package) - (#f ;no source - '()) - ((and (? origin? origin) - (= origin-uri (? git-reference? reference))) - (define url - (git-reference-url reference)) - (define commit - (git-reference-commit reference)) - (define hash - (origin-hash origin)) - - (match (or (lookup-by-nar-hash hash) - (if (commit-id? commit) - (or (lookup-revision commit) - (lookup-origin-revision url commit)) - (lookup-origin-revision url commit))) - ((or (? string?) (? revision?)) - '()) - (#f - ;; Revision is missing from the archive, attempt to save it. - (save-package-source package)))) - ((? origin? origin) - (if (and=> (origin-hash origin) ;XXX: for ungoogled-chromium - content-hash-value) ;& icecat - (let ((hash (origin-hash origin))) - (match (or (lookup-by-nar-hash hash) - (lookup-content (content-hash-value hash) - (symbol->string - (content-hash-algorithm hash)))) - (#f - ;; If ORIGIN is a version-control checkout, save it now. - ;; If not, check whether HASH is in the Disarchive - ;; database ("Save Code Now" does not accept tarballs). - (if (vcs-origin origin) - (save-package-source package) - (match (lookup-disarchive-spec hash) - (#f - (list (make-warning package - (G_ "source not archived on Software \ + (if (not (assq 'no-archival? (package-properties package))) + (parameterize ((%allow-request? skip-when-limit-reached)) + (catch #t + (lambda () + (match (package-source package) + (#f ;no source + '()) + ((and (? origin? origin) + (= origin-uri (? git-reference? reference))) + (define url + (git-reference-url reference)) + (define commit + (git-reference-commit reference)) + (define hash + (origin-hash origin)) + + (match (or (lookup-by-nar-hash hash) + (if (commit-id? commit) + (or (lookup-revision commit) + (lookup-origin-revision url commit)) + (lookup-origin-revision url commit))) + ((or (? string?) (? revision?)) + '()) + (#f + ;; Revision is missing from the archive, attempt to save it. + (save-package-source package)))) + ((? origin? origin) + (if (and=> (origin-hash origin) ;XXX: for ungoogled-chromium + content-hash-value) ;& icecat + (let ((hash (origin-hash origin))) + (match (or (lookup-by-nar-hash hash) + (lookup-content (content-hash-value hash) + (symbol->string + (content-hash-algorithm hash)))) + (#f + ;; If ORIGIN is a version-control checkout, save it now. + ;; If not, check whether HASH is in the Disarchive + ;; database ("Save Code Now" does not accept tarballs). + (if (vcs-origin origin) + (save-package-source package) + (match (lookup-disarchive-spec hash) + (#f + (list (make-warning package + (G_ "source not archived on Software \ Heritage and missing from the Disarchive database") - #:field 'source))) - (directory-ids - (match (find (lambda (id) - (not (lookup-directory id))) - directory-ids) - (#f '()) - (id - (list (make-warning package - (G_ "\ + #:field 'source))) + (directory-ids + (match (find (lambda (id) + (not (lookup-directory id))) + directory-ids) + (#f '()) + (id + (list (make-warning package + (G_ "\ Disarchive entry refers to non-existent SWH directory '~a'") - (list id) - #:field 'source)))))))) - ((? content?) - '()) - ((? string? swhid) - '()))) - '())) - ((? local-file?) - '()) - (_ - (list (make-warning package - (G_ "\ + (list id) + #:field 'source)))))))) + ((? content?) + '()) + ((? string? swhid) + '()))) + '())) + ((? local-file?) + '()) + (_ + (list (make-warning package + (G_ "\ source is not an origin, it cannot be archived") - #:field 'source))))) - (match-lambda* - (('swh-error url method response) - (swh-response->warning package url method response)) - ((key . args) - (if (eq? key skip-key) - '() - (with-networking-fail-safe - (G_ "while connecting to Software Heritage") - '() - (apply throw key args)))))))) + #:field 'source))))) + (match-lambda* + (('swh-error url method response) + (swh-response->warning package url method response)) + ((key . args) + (if (eq? key skip-key) + '() + (with-networking-fail-safe + (G_ "while connecting to Software Heritage") + '() + (apply throw key args))))))) + (list + (make-warning package + (G_ "skip archiving as marked by package"))))) (define (check-haskell-stackage package) "Check whether PACKAGE is a Haskell package ahead of the current