From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id KJnTH8dhSWBaOgAA0tVLHw (envelope-from ) for ; Thu, 11 Mar 2021 00:18:15 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qBCkG8dhSWAUJAAAB5/wlQ (envelope-from ) for ; Thu, 11 Mar 2021 00:18:15 +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 48403212C7 for ; Thu, 11 Mar 2021 01:18:12 +0100 (CET) Received: from localhost ([::1]:50898 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lK91n-0004BN-2H for larch@yhetil.org; Wed, 10 Mar 2021 19:18:11 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lK91e-0004BF-Nf for guix-patches@gnu.org; Wed, 10 Mar 2021 19:18:02 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:40708) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lK91e-00089P-GI for guix-patches@gnu.org; Wed, 10 Mar 2021 19:18:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lK91e-0006f8-AT for guix-patches@gnu.org; Wed, 10 Mar 2021 19:18:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#46182] [PATCH] lint: Add 'check-git-protocol' checker. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 11 Mar 2021 00:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46182 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Leo Famulari Cc: 46182@debbugs.gnu.org Received: via spool by 46182-submit@debbugs.gnu.org id=B46182.161542185225574 (code B ref 46182); Thu, 11 Mar 2021 00:18:02 +0000 Received: (at 46182) by debbugs.gnu.org; 11 Mar 2021 00:17:32 +0000 Received: from localhost ([127.0.0.1]:52254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lK91A-0006eP-5l for submit@debbugs.gnu.org; Wed, 10 Mar 2021 19:17:32 -0500 Received: from mail-wm1-f44.google.com ([209.85.128.44]:41725) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lK914-0006e8-QM for 46182@debbugs.gnu.org; Wed, 10 Mar 2021 19:17:30 -0500 Received: by mail-wm1-f44.google.com with SMTP id t5-20020a1c77050000b029010e62cea9deso11749144wmi.0 for <46182@debbugs.gnu.org>; Wed, 10 Mar 2021 16:17:26 -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; bh=CwvPDYND/f2qTozWtPmCEpv0xPZi4aAGpzPr2qGxogI=; b=rzRSQRIxlS079ObdnUk+ZW9+FFFiQpHD1mhe8QHxPfRZEWSXN3tQUxaunXWVTinGo/ eVKkE5ZIHde+f9LM3TPGCt+zQ60gsSf/+974Kn9eDEcnGvO1uqqy1bKczwQC9BxNE5I8 pAMOjbWzGX5DBNQVBco8lN1hzP+JnDCerCOiDWyecaDKgnvOk9kzmWeSfjKuf6XsJ/z2 oZJr0TByQYjE0XEEdY8tWsYEB5EcwG8JHlIXGffagWwF2Uxad+mAeJQ9YS4sY3kqiiON tDBN1BbMxmhEecf7LoO5BmEvkgkjSGrZymCmLXhXJFgAftlbZBSvJ+c56ebC4+H8RRIa X6ew== 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; bh=CwvPDYND/f2qTozWtPmCEpv0xPZi4aAGpzPr2qGxogI=; b=aSd2xrC6YPzyT8Eh8+zDk7yWHYHrde+NwIFjOszCQndAfO9L+4AhrTHTTe0ZPsO9AK ObzPm6xzLueQMyOQKV7Y07RzY1l6+fcNn2RrG+BmsNKW7wWjMxjKTx9BvG2caDebHvPZ TCTQoVrvwJB0FPmjkgmuanLftl+BzkcinKa1KbdFUatkxGNIif4TVKj7t4PmDSpplceG 455MNvUHEJyzLIufJgpeCzB1FmZZ1zTp5viIWGYZcKtRD1GQ9riU4g8CgOkzbQtcg5jX 66wX+A/FJN15Gc649P5mJV0NCyPdMdF6wnIqRrEcXwxVg0Eg0hh2279qSSCq46tTIF2C 55zg== X-Gm-Message-State: AOAM532Db8CrLZIxggFL52jGe45le8WHNpMoz5eahXzfxGXQw70p7zPG HNl4rFP4Hqdb70PujyJYsCkWitNZdeA= X-Google-Smtp-Source: ABdhPJwJ9AZDoxf3gLm9Glc/1zRhK5wvXxGjWgSIwKRcYZm/x+2Z//af6aYuPRKOi+KJM5dO3T4Rlg== X-Received: by 2002:a05:600c:4844:: with SMTP id j4mr5548344wmo.179.1615421840911; Wed, 10 Mar 2021 16:17:20 -0800 (PST) Received: from lili ([2a01:e0a:59b:9120:65d2:2476:f637:db1e]) by smtp.gmail.com with ESMTPSA id 12sm965322wmw.43.2021.03.10.16.17.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Mar 2021 16:17:20 -0800 (PST) From: zimoun References: Date: Thu, 11 Mar 2021 01:14:33 +0100 In-Reply-To: (Leo Famulari's message of "Fri, 29 Jan 2021 20:04:06 -0500") Message-ID: <86a6rabl7a.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-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=1615421892; 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: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: dkim-signature; bh=CwvPDYND/f2qTozWtPmCEpv0xPZi4aAGpzPr2qGxogI=; b=YukbicVN5U2sUsmhnis6h+wjsIayxyIMaHTbO/Z/pT0EhhciR7JRwd69W5U06a+s19YKuV qp8/2UMO9xxXa2/GV021FKFEuTFA9UoA9+6fb54tlNrjOm7xii9X34HNZDSR/4s3bhoU7e enGHHr5rPdM+TWZ2SJf7eI+siLXRQsZacUXqsLieE18XczqsZMA63itczGVzZ7FyMGHMF2 sMlF1KYJ3jFJ2j73oiSKG51rpl/M8Is3ejvqAwFBVuQHbILE+GyLIJwl3pk2W/HmVJdZ0k fwDWQHh1J3um5CbcNcguOp4W8aKfJGZ3MuKKnhR0JnHPpUGLPl7P94I2gnTyxg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1615421892; a=rsa-sha256; cv=none; b=WQtLdpjJhr1HzShdbSVmXqwSNs3GigpRrmbi9G5vycRwXBN3ugQl1CU7qfKDWz5MXxLB7v 9AqyxCoqtfdrIHDL7CWRTP0oQ7fTGP4Ha6opfxy7oBXcZ3/ARmrpSdd4v8vdXj/AWXldhe 5XizU6gGTuzRQfNc6PLOycQW33pIN+ThlKtLOb1wwf0SkxCzMFyZR4ZQ9u8okvX0O5ZIjV FSaBBEGfmf6aMLwKKdYhWIenI6POea02RGmqTxQgpJzcmWsEA1ozk25UCxg+VK2imRCFg9 cpkjUyC9sNN4vWCDabz+wfK0KsgbJpLekrsCpKSwj6skFAhL07Xf19jvv3A0YA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=rzRSQRIx; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -0.70 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=rzRSQRIx; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 48403212C7 X-Spam-Score: -0.70 X-Migadu-Scanner: scn1.migadu.com X-TUID: miUR2bDKhebU --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Leo, Giving a look to the bug tracker for the next release, I see this bug. :-) On Fri, 29 Jan 2021 at 20:04, Leo Famulari wrote: > We could also make it warn about use of the HTTP protocol (as opposed to > HTTPS). Your thoughts? > > * guix/lint.scm (check-git-protocol): New procedure. > (%local-checkers): Add 'git-protocol' checker. > * doc/guix.texi (Invoking guix lint): Document it. The doc/ does not apply anymore. Instead of these =E2=80=99eqv?=E2=80=99 > +(define (check-git-protocol package) > + "Emit a warning if PACKAGE's source URI protocol is 'git://'." > + (define (check-source-uri-scheme uri) > + (if (eqv? (uri-scheme uri) 'git) [...] > + (let ((origin (package-source package))) > + (if (and (origin? origin) > + (eqv? (origin-method origin) git-fetch)) > + (check-source-uri-scheme > + (string->uri (git-reference-url (origin-uri origin)))) > + '()))) I propose =E2=80=99match=E2=80=99 which is more coherent with the Guix styl= e. Well, from my understanding. :-) Patch attached. Well, it could be nice to add a test in tests/guix-lint.sh for that. WDYT? Cheers, simon --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=lint-git-protocol.patch Content-Description: lint-git-protocol.patch diff --git a/guix/lint.scm b/guix/lint.scm index 311bc94cc3..980f77c736 100644 --- a/guix/lint.scm +++ b/guix/lint.scm @@ -51,7 +51,7 @@ #:use-module (guix gnu-maintenance) #:use-module (guix cve) #:use-module ((guix swh) #:hide (origin?)) - #:autoload (guix git-download) (git-reference? + #:autoload (guix git-download) (git-reference? git-fetch git-reference-url git-reference-commit) #:use-module (guix import stackage) #:use-module (ice-9 match) @@ -84,6 +84,7 @@ check-source check-source-file-name check-source-unstable-tarball + check-git-protocol check-mirror-url check-github-url check-license @@ -918,6 +919,26 @@ descriptions maintained upstream." (origin-uris origin)) '()))) +(define (check-git-protocol package) + "Emit a warning if PACKAGE's source URI protocol is 'git://'." + (define (check-source-uri-scheme uri) + (match (uri-scheme uri) + ('git + (list + (make-warning package + (G_ "the source URI should not use the git:// protocol") + #:field 'source))) + (_ '()))) + + (match (package-source package) + ((? origin? origin) + (match (origin-method origin) + (git-fetch + (check-source-uri-scheme + (string->uri (git-reference-url (origin-uri origin))))) + (_ '()))) + (_ '()))) + (define (check-mirror-url package) "Check whether PACKAGE uses source URLs that should be 'mirror://'." (define (check-mirror-uri uri) ;XXX: could be optimized @@ -1476,6 +1497,10 @@ or a list thereof") (name 'source-unstable-tarball) (description "Check for autogenerated tarballs") (check check-source-unstable-tarball)) + (lint-checker + (name 'git-protocol) + (description "Check for use of the git:// protocol") + (check check-git-protocol)) (lint-checker (name 'derivation) (description "Report failure to compile a package to a derivation") --=-=-=--