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 4Jd0Cdr72mC73QAAgWs5BA (envelope-from ) for ; Tue, 29 Jun 2021 12:54:18 +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 UH4sBdr72mA1DAAAbx9fmQ (envelope-from ) for ; Tue, 29 Jun 2021 10:54:18 +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 7D1102855B for ; Tue, 29 Jun 2021 12:54:17 +0200 (CEST) Received: from localhost ([::1]:56404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lyBNg-0003eI-FD for larch@yhetil.org; Tue, 29 Jun 2021 06:54:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33236) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lyBNS-0003di-VX for guix-patches@gnu.org; Tue, 29 Jun 2021 06:54:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:42142) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lyBNS-0000Cr-Ko for guix-patches@gnu.org; Tue, 29 Jun 2021 06:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lyBNS-0007qC-GU for guix-patches@gnu.org; Tue, 29 Jun 2021 06:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49196] [PATCH v5 2/3] import: utils: Skip not found packages. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 29 Jun 2021 10:54:02 +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.162496398330062 (code B ref 49196); Tue, 29 Jun 2021 10:54:02 +0000 Received: (at 49196) by debbugs.gnu.org; 29 Jun 2021 10:53:03 +0000 Received: from localhost ([127.0.0.1]:53684 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyBMV-0007on-8A for submit@debbugs.gnu.org; Tue, 29 Jun 2021 06:53:03 -0400 Received: from mail-wm1-f45.google.com ([209.85.128.45]:36399) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lyBMR-0007o4-Lr for 49196@debbugs.gnu.org; Tue, 29 Jun 2021 06:53:01 -0400 Received: by mail-wm1-f45.google.com with SMTP id m41-20020a05600c3b29b02901dcd3733f24so1489708wms.1 for <49196@debbugs.gnu.org>; Tue, 29 Jun 2021 03:52:59 -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=JIUDhdtpSNdHo/yIp4CRlrP1/NzvCPfls5BNZ1z2ujyAlvDwnSkSIotH3MkCvthUAI AN40K86HQigL7XfNtISCD+swjlgCpyETDS4p8Om85dP+f84im9upuB9scC/rv4ia/g4A rMlX0oF22ZRoygMBlfY7KZeG9Ii209eP5c3qExvOkSR8FEyNUjQQIP5JBbBJKarsi5Qr nmjNvqetRiZwC2tLzg+gvnh5uukjd5/0fBjj/iM8eLmvgftgsN9DpoXmXxju71Rl9D2C RfRxGyXiqmZev3q2nwEVE1IQKVJqsI7tv828+jI1HPXaLPj7q0iLAfdMtTCU91eOM6Ku vdqg== 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=mfoZ3UC6nKXuJx2F/EhMKgX0R2nGOvTngbOmXHIJTLgwySIcciaOApTPV4CIo+bLck gJdIVpcS9ouseHbYxtlM21okASYoHa4s9OImzBkFh+IrHNokpnPwjfXAt2ImdXE9WyXs cys5ZBicoM2mskemn4WUHN2GwoARr09QW3tCBKDu236CEgCiD1mzJjXyvM9YaYnl1/0g jEV4iljor1d+veCjSkf+QQyThAWcdXK5Ih9ZLhvZbUZuPsA2gD/0huckq3r75r6SRicO MeJZX0ZQ/Eh+zdtuzjnR6pS6/JEEspSGKgvRhGAgnNKphIxJt+yTPT8zSxUv7NVp91U5 iH0Q== X-Gm-Message-State: AOAM531IRlaOuDshZTPmItZH4ZsrvF6zBWoOjwU+M+YCx8cnDWzok8uv 4KVF8Wxr87bVqmtF/Aa2nNA/stUPCkM= X-Google-Smtp-Source: ABdhPJybMDv02phLmZWqzOyBiOCuPeBCr3pEno4J+dEpdOYv4HU5grz3W4PcuhYXN85eFAODZM8Lyw== X-Received: by 2002:a05:600c:3b8b:: with SMTP id n11mr31150510wms.159.1624963973995; Tue, 29 Jun 2021 03:52:53 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.110]) by smtp.gmail.com with ESMTPSA id c7sm17784794wrs.23.2021.06.29.03.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Jun 2021 03:52:53 -0700 (PDT) From: zimoun Date: Tue, 29 Jun 2021 12:52:36 +0200 Message-Id: <20210629105237.45517-2-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210629105237.45517-1-zimon.toutoune@gmail.com> References: <20210629105237.45517-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=1624964057; 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=t8RdLPEgejDfAmg5eUkrtOcJaAUivx6tSOctpdYdp0WSNYG4jXbKPgnblkrXrUlTGF5JOF 7129yJGWNPf+QqM+NI3fn6Eid+IqZVOeoRcqd/pK4Dv5/z1zNantj4NSGvJ8JhtJF7AN87 RKg9IhhV9PimphkKtT/ddIrsBENb8G3BkkYk7VycmY8vKvbSwKEvpsWlTImgNiWnksVYJy yoWTyfQuCW1OVcii0RyonHfSzzq2drx9QjEqQApM5a/rXUSZU8Vq7QIi2pdsp2T50MzoNo tu1DnNcI5Ygp9JHgtCOc8ge6XoKjGojrxI/DWh+0Gi7xsGVm6JeOkqzsNmp2Ew== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624964057; a=rsa-sha256; cv=none; b=X+KrWFSl8ZKYZspoDNm7OJ0v2ypcFcL/o2i8tnsqOe+U6COUnzvyKhTrBAA9/VOIwg59x8 lRTbiCDbZ2u2ELNAlv6MK9H8XzdZ9eynkQx3NfBQpd8IbgLVirpVnmUAREQ6FbBm/emopR aOyybQVafCN4ofK0up24zub9CsZUcfcWsmZtdwvfz1Rt/S31OIb06BWAG9lDPhI64VL5U3 rKtPPbB2Q9yqkTV/lXylj9fjelPyVRLIdEB7DILus+2w9PEHolPnJ49cgo01h0NRzqrQUn sNSKQMw8v4pW03wVC2+f+7xswzAnrn/1y+5yM39Of1DpxgOIIJcGgrnv4Ifjyg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=JIUDhdtp; 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.18 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=JIUDhdtp; 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: 7D1102855B X-Spam-Score: 0.18 X-Migadu-Scanner: scn0.migadu.com X-TUID: aeVpH1LEneO4 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