From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id EDDVOrn32WBTdgAAgWs5BA (envelope-from ) for ; Mon, 28 Jun 2021 18:24:25 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id yCCzNrn32WBSGAAAbx9fmQ (envelope-from ) for ; Mon, 28 Jun 2021 16:24:25 +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 82A3219CAB for ; Mon, 28 Jun 2021 18:24:25 +0200 (CEST) Received: from localhost ([::1]:56440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lxu3c-0003cO-IU for larch@yhetil.org; Mon, 28 Jun 2021 12:24:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53692) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lxu0N-0004lv-IT for guix-patches@gnu.org; Mon, 28 Jun 2021 12:21:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40789) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lxu0N-0000UF-9i for guix-patches@gnu.org; Mon, 28 Jun 2021 12:21:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lxu0N-0005Wl-79 for guix-patches@gnu.org; Mon, 28 Jun 2021 12:21:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49196] [PATCH v4 2/3] import: utils: Skip not found packages. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 28 Jun 2021 16:21:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49196 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49196@debbugs.gnu.org Cc: iskarian@mgsn.dev Received: via spool by 49196-submit@debbugs.gnu.org id=B49196.162489723721150 (code B ref 49196); Mon, 28 Jun 2021 16:21:03 +0000 Received: (at 49196) by debbugs.gnu.org; 28 Jun 2021 16:20:37 +0000 Received: from localhost ([127.0.0.1]:52331 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxtzw-0005V4-Cr for submit@debbugs.gnu.org; Mon, 28 Jun 2021 12:20:37 -0400 Received: from mail-wr1-f46.google.com ([209.85.221.46]:38776) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lxtzp-0005UV-Jp for 49196@debbugs.gnu.org; Mon, 28 Jun 2021 12:20:35 -0400 Received: by mail-wr1-f46.google.com with SMTP id r8so8204686wrx.5 for <49196@debbugs.gnu.org>; Mon, 28 Jun 2021 09:20:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rty0ZqD+74SEHhUaLtCsSlBbmFKBoQTnN3k5Vftk+7k=; b=QGnuDnBzuU6Yo0rhapoQIUuzDIFTOtIzfTIzNGlYw8txbE8rnayWpl47QpplG4yFob Fsb95I4xBKe64ul7bZFJFLy5nvkkxM4zlyAfp1A3NQN+HV/k+XKUIfCoWDNLun8/345b VCg4CYdk9qktsCa6RgGmg8DJsvkCfsPDwNX9OLbs7hnFAGQB+j0pnp2Sg0O7cz/X7pZs aarou4FD9RCJWR3tizLmmLDBticLhpTFTn0yiDjPWNzaAJDxh4Mpm3+ZyHFzK0ZWcKso pW408AhSD4MZTCSyWXO7pBwxm5yrYh1xy1LN2FB0ryxNzjycwD/7yLsk434tgYPCofuq xZJA== 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:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rty0ZqD+74SEHhUaLtCsSlBbmFKBoQTnN3k5Vftk+7k=; b=p5HOY1s5qyJSwoIuolaqfCqW8bdSEqBQJ8Yk17w0Rmu7dQitdht9sAkX0A5VLV3iMa gJy9DuKaHFOoeZR4o9nsbxAUnmkgmEbbH8MWNvtbcmh8Cu2NlS4VCGy9FbqY3dpJ+gqc VXoGmP48HOzuWtiiYGfpFNM2PKMmauoJruo7oAjl2Q/t+RmFWaiSIgdUy9IFgWhmiMyr cgOzc524j3K0bTvP23ppgHoqPcWNQhzniFbg8LL8MNbrxIU1msBj17ExwncMDmLBZqFu 97NYUDeqAhQt9AxxOC85W6mm4Sbn3Jp7V8xvltCJGTqy4KggiSgL/Bs0roNbK6lVYbQN RK0Q== X-Gm-Message-State: AOAM5334BBnsJrKXo7uaDRIP39EY5tfgxq8+9S9KvWEZ4z7TdyPX5Uf3 3dNIEtcG/wfAM5CtCeMw+B/L3zAxNmI= X-Google-Smtp-Source: ABdhPJz+s04ntMiKNgglNM3GXUWKW1YRF7NXCNBP+gfQTAGMCKbxCL6H7HbaVMgnQkmIMZblbIJFYg== X-Received: by 2002:adf:f690:: with SMTP id v16mr12259239wrp.411.1624897224033; Mon, 28 Jun 2021 09:20:24 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.110]) by smtp.gmail.com with ESMTPSA id v18sm17050567wrv.24.2021.06.28.09.20.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Jun 2021 09:20:23 -0700 (PDT) From: zimoun Date: Mon, 28 Jun 2021 18:20:13 +0200 Message-Id: <20210628162014.15319-2-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210628162014.15319-1-zimon.toutoune@gmail.com> References: <20210628162014.15319-1-zimon.toutoune@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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=1624897465; 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=rty0ZqD+74SEHhUaLtCsSlBbmFKBoQTnN3k5Vftk+7k=; b=TkjzLrC2nM9Zp4iksxTJWM4Lz6bts+URrUoSWbJyx8jh01k0eugZY5h71uZ/3KFLBBRPr/ 3c9wJhl9ucU0UQpZigWGjIYZTrBjXz2YvAmsOamfvi1uAo+o/bmpY5mt4/p/puT6U2HsWj Tw/aDrecGae1x6LkS6ckhl1NyrEHmhHmMo7g6PWayvqfA61+4lAhFrvx/j6ZasAl5Rwqlt EzgBPqnzFY8jXjWNzGfEsPMOP1DgLIfFx2h3EWXZAAlVmMyoJVMERBtCzK8Hy+XiEdroWw BpbCnZlMNAJLMzLFpIhEmtPScaH/ECj3OuBQ+kiC92Aqsek2eKce4rtbMBghBQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624897465; a=rsa-sha256; cv=none; b=dfLMMnGPHGoQnwBEIb1tpSeROUeayEmQej9Y5zXfaIfh86kQ0o0Aae4YXLb7I/LD6mpKhC 0bNl4Wy2xKaysY5LdUbPlt1QoKHCqa4MjLo8Q4iM4dkzljMzPKktRa4lyKk0UmiU/o1ac0 Iqq9XiVTNA2sETOp0hT23E8E5Wo1YDA7yHBo7DK9OZedYvtX0k7Cd1ao6Q5eoCgVrEXwiv BlCMpwR9Yc4gAn55o26JLIubP7rsdZLnlZwurKKtC/J2jEmxDe8RnqE6Xh2hBYluZuv2EE 0ais3cxwUwCsKmneeP8nblWz6R5oHF/CLZebTD/9otQMtP5/v7XLdvQ5vwj67g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=QGnuDnBz; 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: -1.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=QGnuDnBz; 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: 82A3219CAB X-Spam-Score: -1.32 X-Migadu-Scanner: scn0.migadu.com X-TUID: Pvj4YXx5hFK0 From: Sarah Morgensen * guix/import/utils.scm (recursive-import): Skip packages when the package returned by 'repo->guix-package' is false. * tests/import-utils.scm: New tests. --- guix/import/utils.scm | 26 ++++++++++++++------------ tests/import-utils.scm | 28 ++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/guix/import/utils.scm b/guix/import/utils.scm index d817318a91..7f2e7ecb46 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2020 Helio Machado <0x2b3bfa0+guix@googlemail.com> ;;; Copyright © 2020 Martin Becze ;;; Copyright © 2021 Maxim Cournoyer +;;; Copyright © 2021 Sarah Morgensen ;;; ;;; This file is part of GNU Guix. ;;; @@ -471,15 +472,16 @@ to obtain the Guix package name corresponding to the upstream name." (name (list name #f))) dependencies))) (make-node name version package normalized-deps))) - (map node-package - (topological-sort (list (lookup-node package-name version)) - (lambda (node) - (map (lambda (name-version) - (apply lookup-node name-version)) - (remove (lambda (name-version) - (apply exists? name-version)) - (node-dependencies node)))) - (lambda (node) - (string-append - (node-name node) - (or (node-version node) "")))))) + (filter-map + node-package + (topological-sort (list (lookup-node package-name version)) + (lambda (node) + (map (lambda (name-version) + (apply lookup-node name-version)) + (remove (lambda (name-version) + (apply exists? name-version)) + (node-dependencies node)))) + (lambda (node) + (string-append + (node-name node) + (or (node-version node) "")))))) diff --git a/tests/import-utils.scm b/tests/import-utils.scm index 874816442e..7c6c782917 100644 --- a/tests/import-utils.scm +++ b/tests/import-utils.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2015, 2017 Ricardo Wurmus ;;; Copyright © 2016 Ben Woodcroft ;;; Copyright © 2020 Martin Becze +;;; Copyright © 2021 Sarah Morgensen ;;; ;;; This file is part of GNU Guix. ;;; @@ -64,6 +65,33 @@ '()))) #:guix-name identity)) +(test-equal "recursive-import: skip false packages (toplevel)" + '() + (recursive-import "foo" + #:repo 'repo + #:repo->guix-package + (match-lambda* + (("foo" #:version #f #:repo 'repo) + (values #f '()))) + #:guix-name identity)) + +(test-equal "recursive-import: skip false packages (dependency)" + '((package + (name "foo") + (inputs `(("bar" ,bar))))) + (recursive-import "foo" + #:repo 'repo + #:repo->guix-package + (match-lambda* + (("foo" #:version #f #:repo 'repo) + (values '(package + (name "foo") + (inputs `(("bar" ,bar)))) + '("bar"))) + (("bar" #:version #f #:repo 'repo) + (values #f '()))) + #:guix-name identity)) + (test-assert "alist->package with simple source" (let* ((meta '(("name" . "hello") ("version" . "2.10") -- 2.32.0