From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id SAzMBxF6DWGZqgAAgWs5BA (envelope-from ) for ; Fri, 06 Aug 2021 20:06:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id EJUvAxF6DWG3WwAAbx9fmQ (envelope-from ) for ; Fri, 06 Aug 2021 18:06: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 1EE356EBF for ; Fri, 6 Aug 2021 20:06:08 +0200 (CEST) Received: from localhost ([::1]:40490 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mC4ER-0008DJ-0b for larch@yhetil.org; Fri, 06 Aug 2021 14:06:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mC4EM-0008Be-Do for guix-patches@gnu.org; Fri, 06 Aug 2021 14:06:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mC4EM-0008TC-6s for guix-patches@gnu.org; Fri, 06 Aug 2021 14:06:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mC4EL-0000l9-Tm for guix-patches@gnu.org; Fri, 06 Aug 2021 14:06:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49196] [PATCH v6 2/3] import: utils: Skip not found packages. Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 06 Aug 2021 18:06:01 +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 Received: via spool by 49196-submit@debbugs.gnu.org id=B49196.16282731242853 (code B ref 49196); Fri, 06 Aug 2021 18:06:01 +0000 Received: (at 49196) by debbugs.gnu.org; 6 Aug 2021 18:05:24 +0000 Received: from localhost ([127.0.0.1]:51310 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mC4Dj-0000jx-Nn for submit@debbugs.gnu.org; Fri, 06 Aug 2021 14:05:24 -0400 Received: from out1.migadu.com ([91.121.223.63]:51350) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mC4Dg-0000jm-WC for 49196@debbugs.gnu.org; Fri, 06 Aug 2021 14:05:22 -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=1628273119; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GY+tWV8ZnrRX0Txct26gOjpBxfXEfckdpKmstWzlp14=; b=Dc1DxY9FZr9q8xMy0Bx47+tQQFTbwsQfV8Yjxk/Bbn0fFObNGr91A39b4cXMm2jmefAjyr UKPxrm3n60oFAdXsSkAsetuRjZ1y5s9FohLoHzO1QUGzaI1suheuNStmfYBDecCxSWcZJZ sCmYHsauzFKQbangNEUfK+ZdIOA2lR0= From: Sarah Morgensen Date: Fri, 6 Aug 2021 11:05:16 -0700 Message-Id: In-Reply-To: <5d11fc04400d26de06efba709cf2e1b14a1d5949.1628272957.git.iskarian@mgsn.dev> References: <5d11fc04400d26de06efba709cf2e1b14a1d5949.1628272957.git.iskarian@mgsn.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Auth-User: iskarian@mgsn.dev 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=1628273168; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=GY+tWV8ZnrRX0Txct26gOjpBxfXEfckdpKmstWzlp14=; b=TpxNZujAU9SMvHp517EMhr8oIqPs+DxNWhuZ31rPCmhUzw8vQ7CM+f0KM80lAykMegePUN R+DA8w8D+5e2iL+iMqLrUZhoORR2hPEg92Uw8MYgsTOJQPYVz/gUTT80DROCPcdx/gDGxL KO4FnRQKxC8zkxoi5V7zn/FpwUKyzKbT7BN90RnfxI4nAbpvkgTBAjznIHU1zZoks36IP7 C4+pJ21PAyjeAPXyPz6EanEiudwF0uBxEijhNrbB1rvEIPRJkjrBlu76pPhbvxAXOMtw+z glpO6TD7UX3V1RARXPD6VBaZy5mrWB5XdRClLRySD1YJIuITqv/stFScleZqgw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1628273168; a=rsa-sha256; cv=none; b=actfiwDn6XweXBDmOZeQfFzPIfUQKNB24oBqFQEFhoJeC47J+zQPbTS9yhVGSNbaKVbFno TFa9D75AG1pTbaloaflR+BxNQ8ppqiey1eC2ReIUeLm2f1a+NoqkGbgtHbRS7T9Y7ux0VP sufIssdgZoNCZfCUnD1N+F0ivBvZFs0891iNsdy+g5REtSoKR1JDJpVArDl+2SJ9Qmuiff EwfVM0ZwSxSNqjuogyA5RyNIR3mhad03hr8NJycB/qK9w6UiTAhz8u8oxY2u4ugb4YhlQM V2jhwGHFeudX+aAD5vqMhkWfNTMlexx191LNFReGPWBB9O6A7iM5bSIO5WUBTw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=Dc1DxY9F; 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.32 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=Dc1DxY9F; 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: 1EE356EBF X-Spam-Score: -0.32 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3QdFGAkurXyb * 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.31.1