From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id aCgmK0Rg1WBERgEAgWs5BA (envelope-from ) for ; Fri, 25 Jun 2021 06:49:08 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id nAr2JkRg1WDJaQAAB5/wlQ (envelope-from ) for ; Fri, 25 Jun 2021 04:49:08 +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 BC85A165BE for ; Fri, 25 Jun 2021 06:49:07 +0200 (CEST) Received: from localhost ([::1]:47806 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lwdm6-0005MO-I8 for larch@yhetil.org; Fri, 25 Jun 2021 00:49:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lwdm2-0005MD-AJ for guix-patches@gnu.org; Fri, 25 Jun 2021 00:49:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lwdm2-0003dK-3K for guix-patches@gnu.org; Fri, 25 Jun 2021 00:49:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lwdm2-0002oh-0N for guix-patches@gnu.org; Fri, 25 Jun 2021 00:49:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49196] [PATCH v2] import: utils: 'recursive-import' skips unfound packages Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 25 Jun 2021 04:49: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.162459651710789 (code B ref 49196); Fri, 25 Jun 2021 04:49:01 +0000 Received: (at 49196) by debbugs.gnu.org; 25 Jun 2021 04:48:37 +0000 Received: from localhost ([127.0.0.1]:44594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwdlY-0002nr-QD for submit@debbugs.gnu.org; Fri, 25 Jun 2021 00:48:37 -0400 Received: from out1.migadu.com ([91.121.223.63]:56262) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lwdlW-0002nb-9x for 49196@debbugs.gnu.org; Fri, 25 Jun 2021 00:48:32 -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=1624596508; 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=lF4oF1r5xTcLpwOTDamAzc8hyfLU7Mb8QAtxHMswXes=; b=HSr6o2jAy591p6K/8gAONbDOrDXMprzWq5yNuPrsBmDk1ZdmsDBnaEF01DhD/sI8DXBM3M ftL8NXweqWoEqHzi+vkENqNUE/x8hIUHjSTFwMc/rkUBWd2g7FgYrqYvlYMQTIeyJYMYdy 320bVTsbCCnlDrmTOx99gJEqeQ1F53M= Date: Thu, 24 Jun 2021 21:48:26 -0700 Message-Id: <770a40d86bb1b67d628b23ef3e4ae7668b7e522f.1624595313.git.iskarian@mgsn.dev> In-Reply-To: <07d7149fc0f89f7f2d11fba47e1b0b2db5ceb809.1624479231.git.iskarian@mgsn.dev> References: <07d7149fc0f89f7f2d11fba47e1b0b2db5ceb809.1624479231.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" Reply-to: Sarah Morgensen X-ACL-Warn: , Sarah Morgensen via Guix-patches From: Sarah Morgensen via Guix-patches via X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1624596548; h=from:from:sender:sender:reply-to: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=lF4oF1r5xTcLpwOTDamAzc8hyfLU7Mb8QAtxHMswXes=; b=gbzSlqkqBj5o/VebRgA4f7FukhWKxgwVX2A6pwqSoeXgi8LDgA/OrfS1103i4jkuL9kjHE GKNqvxVeui+MEgzJ7a3aDfpBJgjIPuxTFjd9NfTUCm4VrtHEoF4o1hqrsnHDRocQ7qBBRh Wpm9PuUGupEwobCLy+lRScaenX+zW/dGNt5kdN+8abVrUSFCfsv0PjJ4o7xE2jNxaRsAgR J4EFtzq/zLc0adVoZ4AFNR1OQjUVFpmF0Ft4nXpRYXmDN96xg1v+SPgV6kbGPILGDnSlZ7 X5ZgnpCUwdSPbI8IsjuygIgCZlH/2oyWFuN0e79rttXOU0t74gZ2MxXLp7wJHA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624596548; a=rsa-sha256; cv=none; b=pETsFjbNZAAuI0tsmoddW1KKmaa0VAMOoh0bElJNzd6tlYMQWjHyLiFYrNLxORoNAAOgMh wI+Cy5WQQJjDl3PAZWKjTzneactmWR5QfZRWcz3GQygUPBlaaDxTHHCXWsdMU0WoX5wYbZ 5KHkBgVqQf20niZp9gbhSkQdw+Sqw5NB7eHPiZdSq4spGpB/U/4VgnxwbaVfWfltjcThAl +CVbO0WhkY06+n48ueb+OY8qcKovLxhGyjWvkCj3qY0cP4ZASEwemvmcfQQjXZd2QbDrKr wEL3KpkTk4uM+ftnz884TH3jaSOWSbGH+xZNnu9/Q4ICFcLwHCw7AiDWsALZKw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=HSr6o2jA; 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: -2.93 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=HSr6o2jA; dmarc=pass (policy=none) header.from=gnu.org; 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: BC85A165BE X-Spam-Score: -2.93 X-Migadu-Scanner: scn0.migadu.com X-TUID: Y2/XzFbPUebH * guix/import/utils.scm (recursive-import): Skip packages when the package returned by repo->guix-package is false. * guix/import/go.scm (go-module-recursive-import): Explicitly return false in 'repo->guix-package' when packages are not found. * tests/import-utils.scm ("recursive-import: skip false packages"): New test. --- guix/import/go.scm | 3 ++- guix/import/utils.scm | 26 ++++++++++++++------------ tests/import-utils.scm | 28 ++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/guix/import/go.scm b/guix/import/go.scm index d110954664..c859098492 100644 --- a/guix/import/go.scm +++ b/guix/import/go.scm @@ -5,6 +5,7 @@ ;;; Copyright © 2021 Maxim Cournoyer ;;; Copyright © 2021 Ludovic Courtès ;;; Copyright © 2021 Xinglu Chen +;;; Copyright © 2021 Sarah Morgensen ;;; ;;; This file is part of GNU Guix. ;;; @@ -651,7 +652,7 @@ This package and its dependencies won't be imported.~%") (uri->string (http-get-error-uri c)) (http-get-error-code c) (http-get-error-reason c)) - (values '() '()))) + (values #f '()))) (receive (package-sexp dependencies) (go-module->guix-package* name #:goproxy goproxy #:version version 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") base-commit: c7804cd97b28ef012acc20c1d861904e9592382b -- 2.31.1