From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id EEzXKxJBQWXOLQAAG6o9tA:P1 (envelope-from ) for ; Tue, 31 Oct 2023 19:01:54 +0100 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id EEzXKxJBQWXOLQAAG6o9tA (envelope-from ) for ; Tue, 31 Oct 2023 19:01:54 +0100 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 57C045A19F for ; Tue, 31 Oct 2023 19:01:54 +0100 (CET) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=L1DKd5AL; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1698775314; 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:dkim-signature; bh=mk/zKzIoX0ooR00I072QxoEHyphAjWktVftXkv6pFRg=; b=cXQClNM3Hl95IZT/D+wNHS9LgwPe6MRysYxAKx3DlOXtHrtb4CbXvaZUNfIILqpTPHt9Yd NOr+8oAHzP5h4mChtoZJYCTvyXmvuMl5ZnhzGE47GbZh5iXQX5fxkeKPQxVopBy8qUUqSQ CB8qO5jGoqWLPoR3MN+cNkta9D7ySXN9I7OClOE77mOS26P9MQ4MM8kRSWqHBUt/UifWuN in4r7zUBtURqgqXysEIpUFP7pCahrAjT6Igr4ffpXAZUDjVF+hP52xfmtxjQIlXz/egCee ZVpwRmNodJHcGeWuRcBMVz1V+XhpSMc/9sNDjBg+WnSlZheC+SrPMbchF/ll6g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=L1DKd5AL; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1698775314; a=rsa-sha256; cv=none; b=EeLrkwgYGU0w9K+JBMQ6RkiQ3KcNKOWj93uHDHesh2wHMsT7FBEHszqsIcI1wIITghf34I mXh0s7VAg82FjllYtaUT+P4JlMXH0cGrfMOw4Q9UnfQ1LL4SAqHnXdhiiuWFcV0yztsCrY drvVRwxYUxaSWshJW/q8bnRIEkAz+Sla8yIbvxciy+wyAb064I6HYBqguUEVu1cMdTQ6/Q Vs+SHM7R1mQOD2oaz4oplYXqhXYerRt71EL49ctCfbPmYUiwJi1XgFaU9V5YIfwBKFgyAl PP+XBoI+TLiC0KsWXJjelQ7krRv9+MD7tGHn7LGfq1X8L1O7hUoUkVKTQgF7Lw== Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qxt3Z-0002Ds-9X; Tue, 31 Oct 2023 14:01:37 -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 1qxt3R-0002Da-Oz for guix-patches@gnu.org; Tue, 31 Oct 2023 14:01:30 -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 1qxt3R-0004EI-2C for guix-patches@gnu.org; Tue, 31 Oct 2023 14:01:29 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qxt3y-0006OP-AF for guix-patches@gnu.org; Tue, 31 Oct 2023 14:02:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66592] [PATCH v2] scripts: archive: Check compatibility of command line options. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 31 Oct 2023 18:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66592 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Tournier Cc: 66592@debbugs.gnu.org Received: via spool by 66592-submit@debbugs.gnu.org id=B66592.169877531124557 (code B ref 66592); Tue, 31 Oct 2023 18:02:02 +0000 Received: (at 66592) by debbugs.gnu.org; 31 Oct 2023 18:01:51 +0000 Received: from localhost ([127.0.0.1]:49128 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qxt3n-0006O1-7Q for submit@debbugs.gnu.org; Tue, 31 Oct 2023 14:01:51 -0400 Received: from mail-oo1-xc2a.google.com ([2607:f8b0:4864:20::c2a]:53271) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qxt3k-0006Nn-Es for 66592@debbugs.gnu.org; Tue, 31 Oct 2023 14:01:50 -0400 Received: by mail-oo1-xc2a.google.com with SMTP id 006d021491bc7-586ba7cdb6bso3091041eaf.2 for <66592@debbugs.gnu.org>; Tue, 31 Oct 2023 11:01:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698775268; x=1699380068; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mk/zKzIoX0ooR00I072QxoEHyphAjWktVftXkv6pFRg=; b=L1DKd5ALUA/Lzq2sjnpUz5F7fBL5spXDs38/Vxuk2nmS2sdbZ+cAj4fi5UhclvyuUt 8KoeKt2y98y8qj0Ad6SvXlvN2J4igl0GYDPkrQhXOqklEV1JvpbrDjNVuaIxPnqdx+31 cRWIJwIhRsVmpajASM+EFF1m+Ii6oMKXxi2VyAg+tsFFN1MRYO9KNXg+wfmSxm8DFuYg ZKVFUMgV1axrKwDGho5QqhlrdVoJlk1uObAmAk1xA+PJzTq5S1njtsBuFiv0pHCB7OpN GnmGSml7WjTqPb1w87tObSP5/0IAjGSGYCSP2Ix4qsq0umOt/yiWbeAmFLGqAQ7Ies/M JqWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698775268; x=1699380068; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mk/zKzIoX0ooR00I072QxoEHyphAjWktVftXkv6pFRg=; b=jyh0mZBYpETUyFwzIXZNjosfmLhlgVPEl4FCrlUbjMbT43qShM7lL8izYuIfgkiKgi wNmpDBJ9xap7QgJ9VLMmezjK7Pl3TE0HqqPX+LyJzFJGJ+6QEi7ANqBffs1rW14TTaPW a2uUFA7llZc2iuzDddh/oNfhQ5ESaDFH5ioDwoDUfe4tAPYBRElW6equ4t+IUuSvBaqP q/LjtmiMsKqqf+8jIBNWY59mgcTpPL1Kj1d4Ev67kCfrcSU9my8xQw3FwCaMcKXkSdgb 6oaNOnqsBgat+iwSxfKaLyIVGFJrvo7op8fDEjREB0bBFyMQxm/OPFuXAejH0GWEXmU9 yKrA== X-Gm-Message-State: AOJu0YwGwYr43ou1sfqC/k7J1npHImLi1DUmK/AXtzvWGceqKZKHitXm T8FvcHQqLw3kZfbNkkQVOn81gCztZVjuhg== X-Google-Smtp-Source: AGHT+IEmhcNKCPf1KTPS2Y9ZTURJ52HrLp7LNMRpTJS1Aj46TRceEszpFYyMD0dDJ8bdV82muDl6GQ== X-Received: by 2002:a05:6359:2884:b0:168:ba46:d9dd with SMTP id qa4-20020a056359288400b00168ba46d9ddmr10948583rwb.17.1698775268312; Tue, 31 Oct 2023 11:01:08 -0700 (PDT) Received: from hurd (dsl-10-128-239.b2b2c.ca. [72.10.128.239]) by smtp.gmail.com with ESMTPSA id ez2-20020ad45902000000b0066cf06339bcsm745619qvb.0.2023.10.31.11.01.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 11:01:07 -0700 (PDT) From: Maxim Cournoyer In-Reply-To: <5c26f17bbf1b4cf9872b4a782295260ce337d3fd.1698165008.git.zimon.toutoune@gmail.com> (Simon Tournier's message of "Tue, 24 Oct 2023 18:33:10 +0200") References: <5c26f17bbf1b4cf9872b4a782295260ce337d3fd.1698165008.git.zimon.toutoune@gmail.com> Date: Tue, 31 Oct 2023 14:01:07 -0400 Message-ID: <87ttq6pt7g.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: 2.89 X-Spam-Score: 2.89 X-Migadu-Queue-Id: 57C045A19F X-Migadu-Scanner: mx13.migadu.com X-TUID: b2xO07jW2mcC Hi Simon, Simon Tournier writes: > Fixes . > Reported by Perry, Daniel J . > > * guix/scripts/archive.scm (guix-archive)[compatible-option]: New procedu= re. > and use it. > --- > guix/scripts/archive.scm | 19 ++++++++++++++++++- > 1 file changed, 18 insertions(+), 1 deletion(-) > > diff --git a/guix/scripts/archive.scm b/guix/scripts/archive.scm > index 2b5a55a23f..466aa9c4d7 100644 > --- a/guix/scripts/archive.scm > +++ b/guix/scripts/archive.scm > @@ -1,6 +1,7 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright =C2=A9 2013, 2014, 2015, 2016, 2017, 2019, 2020, 2021 Ludo= vic Court=C3=A8s > ;;; Copyright =C2=A9 2020 Tobias Geerinckx-Rice > +;;; Copyright =C2=A9 2023 Simon Tournier > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -375,8 +376,24 @@ (define-command (guix-archive . args) > (loop (read-line port) > (cons line result))))) >=20=20 > + (define* (compatible-option options #:key actions) > + "Return the OPTIONS if it is compatible with the list of ACTIONS." > + (let ((some-actions (fold (lambda (action answers) > + (if (assoc-ref options action) > + (cons action answers) > + answers)) > + '() > + actions))) > + (match some-actions > + ((action) > + options) > + ((action other-actions ...) > + (leave (G_ "the options ~{'~s' ~}are exclusive~%") some-actions))= ))) > + > (with-error-handling > - (let ((opts (parse-command-line args %options (list %default-options= )))) > + (let* ((opts (parse-command-line args %options (list %default-option= s))) > + (opts (compatible-option opts > + #:actions (list 'authorize 'export '= import)))) > (parameterize ((%graft? (assoc-ref opts 'graft?))) > (cond ((assoc-ref opts 'generate-key) > =3D> Looks good from a cursory look, but it seems a nice to test in tests/guix-archive.sh. Could you please send a v3 with some tests for it? --=20 Thanks, Maxim