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 4BR9IJWe02BT6AAAgWs5BA (envelope-from ) for ; Wed, 23 Jun 2021 22:50:29 +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 iB2AG5We02DuDwAAbx9fmQ (envelope-from ) for ; Wed, 23 Jun 2021 20:50:29 +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 66518245EC for ; Wed, 23 Jun 2021 22:50:28 +0200 (CEST) Received: from localhost ([::1]:50876 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lw9pL-0001EV-CB for larch@yhetil.org; Wed, 23 Jun 2021 16:50:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51194) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw9ow-0001EF-KG for guix-patches@gnu.org; Wed, 23 Jun 2021 16:50:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58607) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lw9ow-0002zB-Cj for guix-patches@gnu.org; Wed, 23 Jun 2021 16:50:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lw9ow-0005HS-CU for guix-patches@gnu.org; Wed, 23 Jun 2021 16:50:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49196] [PATCH] import: utils: 'recursive-import' skips unfound packages Resent-From: Sarah Morgensen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 23 Jun 2021 20:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49196 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49196@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162448136920254 (code B ref -1); Wed, 23 Jun 2021 20:50:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Jun 2021 20:49:29 +0000 Received: from localhost ([127.0.0.1]:41920 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lw9oI-0005GV-JF for submit@debbugs.gnu.org; Wed, 23 Jun 2021 16:49:29 -0400 Received: from lists.gnu.org ([209.51.188.17]:38158) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lw9oF-0005GM-Pz for submit@debbugs.gnu.org; Wed, 23 Jun 2021 16:49:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51132) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw9oE-00012h-2n for guix-patches@gnu.org; Wed, 23 Jun 2021 16:49:18 -0400 Received: from out0.migadu.com ([94.23.1.103]:41681) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lw9o9-0002S5-8I for guix-patches@gnu.org; Wed, 23 Jun 2021 16:49:17 -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=1624481348; 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; bh=GIqMS4yx7U+W6hvM9xbuYm1hHoQwWWIqtyxX/iDNpsA=; b=eojOVO7SEM39PfXQZC0DWvOKwBhvhqlo+Mwz44Hq/AySf9/71AMvlVdLsRahuoo75XDN6d YZThzBqwePkOTbpmkTjWj45b4+j589tHUNx4jGCunA+a9a5fMTijUJuTEmOiD/nz0VMPwL DnBU2L1fLxQha7pyhgU4023rPYNq1hA= Date: Wed, 23 Jun 2021 13:49:05 -0700 Message-Id: <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 Received-SPF: pass client-ip=94.23.1.103; envelope-from=iskarian@mgsn.dev; helo=out0.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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=1624481428; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=GIqMS4yx7U+W6hvM9xbuYm1hHoQwWWIqtyxX/iDNpsA=; b=DK/iYbORKNieMsTO35Hig4lkkKcu9AloHVT3QC62QDtDB0zpf75aMdxVUZkEyEbXQLKX4K yGzMmS/Q27CNha5MWHCPHWldvOeSN/9iayxU9+f+xWgr8t5gpykR8/5uKTJ6OJ/AoU0afc PBBfWoo9UDJ00PtdVCDWAagJ/y2teMJ6O9WSn9yvFW5OaX/l7Y31hlI5s57AQACSzkHQTp HRyfWXH7SXXaDBtrYzBMECCIP/5dtw+9e2cxgY7/sYj6ysFru3Fw9GxPr7tpfdaY96sGjT 7/raTsACSbucxiS/k/MwIH+/42PP8oVPCk7RkD6/J4xAMW+UTvxUna+GVMxGEA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1624481428; a=rsa-sha256; cv=none; b=gnfX012rZLAQ94FINBqzs6nHXVgkVG4QnovozeJc2Yny1Uf8s6ECvmzcqCPBkfTBgL/LZ+ Xa5N3cWQ+Xpc0G01Fvh039NqKZ9JXmFKgYzRQ8REt8+q6ZgOXaaw2lHrYUbZLT/rwdIgpG 4BuC0QRdDt/a+IRsKFgf8x7qlU8ZfEaEiQtYq9ghkC68hxHdH2MN9ayWPnR6kHciLPIXEH w5hbHMoAQ0ODcMwdB4ANW4A5XEYQVj1sHowTHvlJUbtnadpyXjpnhJgwx0eocO7YoHfSGf yV7bd/vJrQOg86N+KbgVd8ePReb8mRp5P8hobO5Kmju1GoyeMNP82F19SSQSrA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=mgsn.dev header.s=key1 header.b=eojOVO7S; 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=eojOVO7S; 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: 66518245EC X-Spam-Score: -2.93 X-Migadu-Scanner: scn1.migadu.com X-TUID: 1PqFhfPg4zfF * 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. --- Hello Guix, While trying to recursively import a go package I encountered the following error when it was unable to find one of the dependencies: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix import go -r git.sr.ht/~sircmpwn/aerc guix import: warning: Failed to import package "github.com/brunnre8/go.notmuch". reason: "https://pkg.go.dev/github.com/brunnre8/go.notmuch" could not be fetched: HTTP error 404 ("Not Found"). This package and its dependencies won't be imported. following redirection to `https://github.com/ProtonMail/go-crypto?go-get=1'... following redirection to `https://github.com/jtolio/gls?go-get=1'... Backtrace: In srfi/srfi-1.scm: 586:29 19 (map1 ((package (name "go-github-com-rivo-uniseg") …) …)) 586:29 18 (map1 ((package (name "go-github-com-mattn-go-r…") …) …)) 586:29 17 (map1 ((package (name "go-github-com-miolini-da…") …) …)) 586:29 16 (map1 ((package (name "go-github-com-riywo-logi…") …) …)) 586:29 15 (map1 ((package (name "go-github-com-neelance-a…") …) …)) 586:29 14 (map1 ((package (name "go-github-com-neelance-s…") …) …)) 586:29 13 (map1 ((package (name "go-github-com-shurcool-go") …) …)) 586:29 12 (map1 ((package (name "go-github-com-shurcool-h…") …) …)) 586:29 11 (map1 ((package (name "go-github-com-shurcool-v…") …) …)) 586:29 10 (map1 ((package (name "go-github-com-gopherjs-g…") …) …)) 586:29 9 (map1 ((package (name "go-github-com-jtolds-gls") # …) …)) 586:29 8 (map1 ((package (name "go-github-com-smartystre…") …) …)) 586:29 7 (map1 ((package (name "go-github-com-smartystre…") …) …)) 586:29 6 (map1 ((package (name "go-github-com-google-go-…") …) …)) 586:29 5 (map1 ((package (name "go-google-golang-org-pro…") …) …)) 586:29 4 (map1 ((package (name "go-github-com-golang-pro…") …) …)) 586:29 3 (map1 ((package (name "go-google-golang-org-app…") …) …)) 586:29 2 (map1 ((package (name "go-github-com-protonmail…") …) …)) 586:17 1 (map1 (() (package (name "go-git-sr-ht-~sircmpwn…") …))) In guix/import/utils.scm: 280:2 0 (package->definition _ _) guix/import/utils.scm:280:2: In procedure package->definition: Throw to key `match-error' with args `("match" "no matching pattern" ())'. --8<---------------cut here---------------end--------------->8--- It seems like several importers (gem, egg, go) expect to be able to return #f or '() in #:repo->guix-package when a package is not found (while printing a warning to the user) but recursive-import doesn't look like it handles it. I suppose this worked before but was silently broken at some point. This patch (re-)enables this behavior. I added a test for this as well. Hope this helps, Sarah guix/import/go.scm | 3 ++- guix/import/utils.scm | 14 ++++++++------ tests/import-utils.scm | 18 ++++++++++++++++++ 3 files changed, 28 insertions(+), 7 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..49f38cfa2a 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. ;;; @@ -469,16 +470,17 @@ to obtain the Guix package name corresponding to the upstream name." (normalized-deps (map (match-lambda ((name version) (list name version)) (name (list name #f))) dependencies))) - (make-node name version package normalized-deps))) + (and package + (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)))) + (filter-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) diff --git a/tests/import-utils.scm b/tests/import-utils.scm index 874816442e..1b728104e0 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,23 @@ '()))) #:guix-name identity)) +(test-equal "recursive-import: skip false packages" + '((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: acfa55a581ca4e688ee4b8f860fe365b1f153ef9 -- 2.31.1