From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id uNiRMrQG1mAH/gAAgWs5BA (envelope-from ) for ; Fri, 25 Jun 2021 18:39:16 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id wFhPLrQG1mB+VAAAB5/wlQ (envelope-from ) for ; Fri, 25 Jun 2021 16:39:16 +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 49677230E7 for ; Fri, 25 Jun 2021 18:39:16 +0200 (CEST) Received: from localhost ([::1]:43690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lworL-00067j-9H for larch@yhetil.org; Fri, 25 Jun 2021 12:39:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59308) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lworA-00066i-0o for guix-patches@gnu.org; Fri, 25 Jun 2021 12:39:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:35152) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwor8-0007UJ-9s for guix-patches@gnu.org; Fri, 25 Jun 2021 12:39:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lwor8-0001Kc-7K for guix-patches@gnu.org; Fri, 25 Jun 2021 12:39:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49196] [PATCH v3 2/3] import: utils: Skip not found packages. Resent-From: zimoun Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 25 Jun 2021 16:39: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.16246390895020 (code B ref 49196); Fri, 25 Jun 2021 16:39:02 +0000 Received: (at 49196) by debbugs.gnu.org; 25 Jun 2021 16:38:09 +0000 Received: from localhost ([127.0.0.1]:46694 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwoqG-0001It-Um for submit@debbugs.gnu.org; Fri, 25 Jun 2021 12:38:09 -0400 Received: from mail-wm1-f49.google.com ([209.85.128.49]:34616) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwoqE-0001I3-Dh for 49196@debbugs.gnu.org; Fri, 25 Jun 2021 12:38:07 -0400 Received: by mail-wm1-f49.google.com with SMTP id u5-20020a7bc0450000b02901480e40338bso6703651wmc.1 for <49196@debbugs.gnu.org>; Fri, 25 Jun 2021 09:38:06 -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=Rjf3HBatfg67aqeE6yJDHorQVPkXdusIozmloghMJeLmr/e1uptvjvpo27ZsQWqtj6 RjMVAIEZJA1Up1foYNztqBxpUlXxrhbBnmYBedZzQU9fNxTmhqMJAaZcwEEuYCVXWOXK Jf4ZX8NdM+yWZkwWQUpS/eaS4fmFS+JfnDOi9bJaVFC8Khyd3hDR8xuinsU3Ek3V4T9u kcgpBr1/lWJOIAcSzkZ6YvdkY2JV2RRdXg8NbNJPtLNY1V77Jhl2N/7yY36BVDlBI5++ HThowZgUc9kYkPdEooxkLxuCBa+GzrAjSsz2EoIWKHBzQFtpteurCEPYW+l4rdn+e+1K /0BA== 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=uf3NQa0gbYKPqn6hb+l/ycd8JliPgb7aObnjNFrZ9jBUkwVM7w08+CPpH9J5EWFa6R xVBrv2mM4UZy1V7rBDsTX3I+QA2is9VaTC/VkA3FM/0wro3TwVldos19UgC0wyabc4/y T7nOP3dTNCaa3cCM7xAKkdOBcVLdvaIeeGTZyGzV26O/OTE1ccnnIzZt85vjz6fc4eA6 8EzfYBKHMf0Unf5gBZf5wEaPYL2g/Q8NUviB//PWoLWOUTncxi+gNZ7y0A8LKmP5SG9k YQslHh5LfqBJXWUSlm/a5nimLbR3C05hUlbxbtSlg4hNggHj03qILVFTmRWN4Kn3N3+W B37A== X-Gm-Message-State: AOAM532/FwHBhdaXGVQBAHTacryoWbNvag+l4tU3hR2AjZka7j9v2cKQ AMT6czAElti9igW1ITGyCBxF+iDTJIY= X-Google-Smtp-Source: ABdhPJz5wSw43PANWqV8eQ4eZ0A47XTTYUbTjXth+kL0EaU9DgPZhoxbO3QhtbY9ds3221IDbpZMvg== X-Received: by 2002:a7b:c052:: with SMTP id u18mr11808733wmc.105.1624639080843; Fri, 25 Jun 2021 09:38:00 -0700 (PDT) Received: from localhost.localdomain ([193.48.40.110]) by smtp.gmail.com with ESMTPSA id 2sm11642170wmk.24.2021.06.25.09.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Jun 2021 09:38:00 -0700 (PDT) From: zimoun Date: Fri, 25 Jun 2021 18:37:48 +0200 Message-Id: <20210625163749.65196-2-zimon.toutoune@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210625163749.65196-1-zimon.toutoune@gmail.com> References: <20210625163749.65196-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=1624639156; 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=qaxsbCUQ9OHsNSxtP1DRE5DG9HakrXk8cDCsYOL1fAOY8sQlLcHL4c2/15gva3s4yEnCrz Xf1MBLUu5B19G50OYsjgP+5/NUvpxCK61hgvKKCxT9i1DFFf6VmCgz3VBJ8nOFZwcazITv IkKvg205l+iNNIKavwQZo37CLREZ8lEWlhVrIg5EZwU9TuXz6TzCNZndi/laFl6PL3n55l KdB4lleECt612zgcPSEmlVHQwbbSZKEjM2AKZ/StkMttgKnvrR8+lr9HHOHT/dWxfstVKq z+GVNzqXp7HfyVgolApgpdJ9Whjt8XlrKoQUsb8S6EaJTYnSagcLGkRLh1C65g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624639156; a=rsa-sha256; cv=none; b=CyqfREun+cOtWoVSvSy8oseJTQBIF7aByxa4nDz52wCR5OW0MWV5MMdun7h6iE6hjQWPbI hYmlrWI5JU2BdGXPyOUK0FNJ4488N1ONv2jm0njJ7yH6iRuI6KAdzVrvsNtyjU9biC65VF OKf6WmFUSJPvYneGR2FSMqpQZDEG3lSh42XGRifCItIo5znsFblFr2SPGgWYzc4Q5wvUtG nLmRBTT6g+yj/5u9gOBL83rkzqIcPbOZdlQc7y64sUJWwLK0GhuDUSX4xq0E832FHN0vCy uEENz8IkJh28RIay7l3JIODPJjiC4SgwKaiBO9WXqzi4I+sogdWzMVRcMORYYQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=Rjf3HBat; 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.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=Rjf3HBat; 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: 49677230E7 X-Spam-Score: -1.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: 1dYHlCEs4Kk+ 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