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 ms0.migadu.com with LMTPS id iIdcJWnETGGxPwEAgWs5BA (envelope-from ) for ; Thu, 23 Sep 2021 20:16:09 +0200 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 iJn0IGnETGEgCwAAB5/wlQ (envelope-from ) for ; Thu, 23 Sep 2021 18:16:09 +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 AE9D418CDC for ; Thu, 23 Sep 2021 20:16:08 +0200 (CEST) Received: from localhost ([::1]:55858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mTTGR-0000IR-HY for larch@yhetil.org; Thu, 23 Sep 2021 14:16:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55758) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mTT8d-0005sR-1c for guix-patches@gnu.org; Thu, 23 Sep 2021 14:08:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:44280) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mTT8c-0003ul-FD for guix-patches@gnu.org; Thu, 23 Sep 2021 14:08:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mTT8b-000108-TE for guix-patches@gnu.org; Thu, 23 Sep 2021 14:08:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50755] [PATCH] import: Generate list of importers based on available modules Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 23 Sep 2021 18:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50755 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: pinoaffe Cc: 50755@debbugs.gnu.org Received: via spool by 50755-submit@debbugs.gnu.org id=B50755.16324204713829 (code B ref 50755); Thu, 23 Sep 2021 18:08:01 +0000 Received: (at 50755) by debbugs.gnu.org; 23 Sep 2021 18:07:51 +0000 Received: from localhost ([127.0.0.1]:55826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTT8Q-0000zh-NJ for submit@debbugs.gnu.org; Thu, 23 Sep 2021 14:07:50 -0400 Received: from out0.migadu.com ([94.23.1.103]:61372) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mTT8K-0000zQ-T1 for 50755@debbugs.gnu.org; Thu, 23 Sep 2021 14:07:48 -0400 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mgsn.dev; s=key1; t=1632420463; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=MJveT8oUsZwmBf40p1G2ZSxKCmKDyJMA1XmZGSPQK6Y=; b=e+bz81ZkAcWyY73DpMM8XpAscIU+PTTdJWp9YDTP6Aj3et9C9GlpDBbg9JZw/S9RYD8wB2 +popm7O/GVeVkTa2gB2Ve0VTNIb+3N20dCWCBKjyu63TszvlwD8LoQ5C71v3Hiw4Bl9egC MVOxV18POGM6C0X2gLa+BFsNxcGvXEM= From: Sarah Morgensen References: <87tuibh43w.fsf@airmail.cc> Date: Thu, 23 Sep 2021 11:07:40 -0700 In-Reply-To: <87tuibh43w.fsf@airmail.cc> (pinoaffe@airmail.cc's message of "Thu, 23 Sep 2021 14:24:19 +0200 (5 hours, 37 minutes, 21 seconds ago)") Message-ID: <86pmszkvwz.fsf@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain 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=1632420969; 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=MJveT8oUsZwmBf40p1G2ZSxKCmKDyJMA1XmZGSPQK6Y=; b=iWA4o4qDVIryIWOcA6D8LfJ2Ns/n0LS5kNfA8owFFE+BDXoybtVSKTFqOhZ//rxy26jUXB TwtplBqJowZG4AkNl3KTPXUiQpi4cZAlaS0xOWTmf1iW2fRgW+f3cD3+ZqJkYwvy7eY3db H2SH1YTcYiMGP0nAtsl9To7JudFsgdzEg1VlK5kO4euGZecTo2/cCTfsDpP7zBCeTFij30 7yngSnPB7MTbGeZGg1labsbl4Bg9DRAAujnIoKgR91q3KqFGRIsR5npTBZ5/VJAGxB6WUj SqhgQTy+zPCNWlGkEE9uX/l4IyEeWC5ZRrQsd4ycW9ZwMAjdve0e7bLysWX6HQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632420969; a=rsa-sha256; cv=none; b=WP73L80Uv31pY7/BasYrcuuKarkFnHn9JLftNZ+/UWF2xCuRMZz1KbfPp3OvGqKK+7riTX fCvHdjf0EbLE2rEJ6s29B1NraF1FNsv93IoiwEAP0iu/mqya/0ExTCuHEsrg6jqKriW84K 2PvBjYnVrIdt+qyZcxJdWOXU7KEOzaAv5UEWcblegrBL1dJTqNuSW0748EtueX/osogI/v tYleQ6YgS4KUYxktnNaNYjh3pEhuhLJX8DE44hZvNJMJFmR7zf5TazEdGCZF1MIdmdY+8Z +T73r4Cx5dApfC6K3A+62Nfxzmtdp49fVWD7Wzdo83yT+xf9qNHA8S9hhxN4tg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=e+bz81Zk; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (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.21 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=e+bz81Zk; dmarc=fail reason="SPF not aligned (relaxed)" header.from=mgsn.dev (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: AE9D418CDC X-Spam-Score: 0.21 X-Migadu-Scanner: scn0.migadu.com X-TUID: F6uU7CZCmT4C Hello, This looks like a good improvement! Thanks for submitting the patch. Just reading ths, I have a couple comments. pinoaffe writes: > * guix/scripts/import.scm (importers): Generate a list of all importers by > looping over available guile modules, allowing for extensibility. > --- > guix/scripts/import.scm | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm > index 40fa6759ae..44cbaf13d6 100644 > --- a/guix/scripts/import.scm > +++ b/guix/scripts/import.scm > @@ -23,6 +23,7 @@ > > (define-module (guix scripts import) > #:use-module (guix ui) > + #:use-module (guix discovery) > #:use-module (guix scripts) > #:use-module (guix utils) > #:use-module (srfi srfi-1) > @@ -78,9 +79,11 @@ rather than \\n." > ;;; Entry point. > ;;; > > -(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "egg" "elpa" > - "gem" "go" "cran" "crate" "texlive" "json" "opam" > - "minetest")) > +(define importers (map (lambda (module) > + (symbol->string (caddr (module-name module)))) Prefer ice-9 'match'/'match-lambda' over 'car'/'cadr'/'caddr'/etc, or if necessary, SRFI-1 'first', 'second', ..., 'last'. > + (all-modules (map (lambda (entry) > + `(,entry . "guix/import")) should this be guix/scripts/import? ^ > + %load-path)))) > > (define (resolve-importer name) > (let ((module (resolve-interface -- Sarah