From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id kAxBCXqk6WHwZwEAgWs5BA (envelope-from ) for ; Thu, 20 Jan 2022 19:05:46 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id iMI/Anqk6WFqmAAAG6o9tA (envelope-from ) for ; Thu, 20 Jan 2022 19:05:46 +0100 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 BAADE84C3 for ; Thu, 20 Jan 2022 19:05:45 +0100 (CET) Received: from localhost ([::1]:45506 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nAboe-0000yE-Pw for larch@yhetil.org; Thu, 20 Jan 2022 13:05:44 -0500 Received: from eggs.gnu.org ([209.51.188.92]:50838) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nAXCZ-0004Ee-9G for guix-patches@gnu.org; Thu, 20 Jan 2022 08:10:08 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:35576) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nAXCX-0006Yb-2N for guix-patches@gnu.org; Thu, 20 Jan 2022 08:10:06 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nAXCW-0004tX-UG for guix-patches@gnu.org; Thu, 20 Jan 2022 08:10:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#53389] [PATCH 8/9] tests/cpan: Verify URIs. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 20 Jan 2022 13:10:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53389 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 53389@debbugs.gnu.org Cc: ludo@gnu.org, Maxime Devos Received: via spool by 53389-submit@debbugs.gnu.org id=B53389.164268415918708 (code B ref 53389); Thu, 20 Jan 2022 13:10:04 +0000 Received: (at 53389) by debbugs.gnu.org; 20 Jan 2022 13:09:19 +0000 Received: from localhost ([127.0.0.1]:56706 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nAXBn-0004rb-Ie for submit@debbugs.gnu.org; Thu, 20 Jan 2022 08:09:19 -0500 Received: from baptiste.telenet-ops.be ([195.130.132.51]:42086) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nAXBM-0004p0-Qp for 53389@debbugs.gnu.org; Thu, 20 Jan 2022 08:08:55 -0500 Received: from localhost.localdomain ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by baptiste.telenet-ops.be with bizsmtp id l18q2600H4UW6Th0118sP2; Thu, 20 Jan 2022 14:08:52 +0100 From: Maxime Devos Date: Thu, 20 Jan 2022 13:08:48 +0000 Message-Id: <20220120130849.292178-8-maximedevos@telenet.be> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220120130849.292178-1-maximedevos@telenet.be> References: <20220120130849.292178-1-maximedevos@telenet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1642684132; bh=Yb+CBeWIUkyWzCg0FPTKESsj5EpnOre7F80LbkZWId4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=bWgCBPuEQMcviFwNL927pKyKSQQhoLGAf4m0PXdaFBDQ73gLeo2Tt1SapAeU1HCj6 kYhUX8jJavWUbFJvT44vYo1vfaFKCqGFGnwBhvNicGGyiQxdCrWHeAaktUCAFp7tdl tCAQUKPquzI7JT6JGR5p836ODvjThdIL1dcfop/GFkuzD5drHB7rjymEK/4A8DOqCI g/9oMeP03Gu4obO9SfcJ0JRViVeaA5AHtNkmT4HV6btwT8HlVfJc6ZAJzDjsf4zIZW Zh1oe3BYY2DtVakhZV4Ask6k2BfoEShoyPiKmAMgeZmBrB4BnQ/noLYuB603XHD8NE wnDYTouQsnTyA== 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 X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642701945; 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=Yb+CBeWIUkyWzCg0FPTKESsj5EpnOre7F80LbkZWId4=; b=KpBKRP8gPtB+Vc/v601VtMCFVN3RYMJZoHIdq3nWe3wbgnN5ts7vRTN4LREul5YVy+Rvvg ++8unBxHzrAx98k46cPCBvR38Q99LJKGJqWQXfz132jBXZfaLw/35PHlyMn3xQDjYynKsc eX4q5pZ42DRrRceKa99Dcq2UWXhzBnciAlftpVvakVF9WhTioEZpXu9iyFfVS+SsV82cPd HnDkX0Y7drQLAMVtuXz/UF4OaLg2IFKXBGeVx3ujdB+LuRxCl42r/xoMxkEqs9kL44Vjro 2vD6GsmFe3DpFzRQ57zY80RaAWoZfcHxG+B29dg3giQQzSsNjpa+bqieZebNVQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642701945; a=rsa-sha256; cv=none; b=sKGHlLXrYrQaThKPEXoUfRBFAAoSAg08rLuQVuOP2OGROnlwewiPV+GaVxSbQEFCJ3C9ZH PP+sJ0VLVd8zzlHpT/pQKLl00HjGwTwHGnI+AfksRZXVHxFOycDPS6HSg7fgKvATDo15gP YF0bGuibcRLRWqom37AHmihSbuIxLGFMRVpgUB26KDV1eTXe9I3LHKaYsBM1hUymq/k6cb luu9lQeRbIRt2OmyO6hDRekpvRYzhlRlnf3di2M+aJa7pviokquym5qf5x8alS76KWEb+K AzzM6e6DqQMER+t/aWDjEUJjtzbG3Quk2emC3FdRIfFPlbEFcBDraxeLKTJIkw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b=bWgCBPuE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -2.42 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=telenet.be header.s=r22 header.b=bWgCBPuE; dmarc=fail reason="SPF not aligned (relaxed)" header.from=telenet.be (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: BAADE84C3 X-Spam-Score: -2.42 X-Migadu-Scanner: scn0.migadu.com X-TUID: LBovGRwZZ5E/ This restores some functionality lost in commit 4aea90b1876179aab8d603a42533a6bdf97ccd3c. * tests/cpan.scm (test-json): Thunk and construct the download URL with '%local-url*'. ("cpan->guix-package"): For simplicity, don't use the HTTP server as a proxy. Verify the contacted URLs. Adjust for thunking. Adjust for new download URL. --- tests/cpan.scm | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/tests/cpan.scm b/tests/cpan.scm index 89e6be0b4f..e6fa965969 100644 --- a/tests/cpan.scm +++ b/tests/cpan.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2015 Eric Bavier ;;; Copyright © 2016 Alex Sassmannshausen ;;; Copyright © 2020 Ludovic Courtès +;;; Copyright © 2022 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -31,8 +32,9 @@ ;; Globally disable grafts because they can trigger early builds. (%graft? #f) -(define test-json - "{ +(define (test-json) + (string-append + "{ \"metadata\" : { \"name\" : \"Foo-Bar\", \"version\" : \"0.1\" @@ -50,10 +52,10 @@ } ], \"abstract\" : \"Fizzle Fuzz\", - \"download_url\" : \"http://example.com/Foo-Bar-0.1.tar.gz\", + \"download_url\" : \"" (%local-url* "/Foo-Bar-0.1.tar.gz") "\" \"author\" : \"Guix\", \"version\" : \"0.1\" -}") +}")) (define test-source "foobar") @@ -62,18 +64,19 @@ (test-assert "cpan->guix-package" ;; Replace network resources with sample data. - (with-http-server `((200 ,test-json) - (200 ,test-source) - (200 "{ \"distribution\" : \"Test-Script\" }")) - (parameterize ((%metacpan-base-url (%local-url)) - (current-http-proxy (%local-url))) + (with-http-server `(("/release/Foo-Bar" 200 ,(test-json)) + ("/Foo-Bar-0.1.tar.gz" 200 ,test-source) + ("/module/Test::Script?fields=distribution" + 200 "{ \"distribution\" : \"Test-Script\" }")) + (parameterize ((%metacpan-base-url (%local-url* "")) + (current-http-proxy #false)) (match (cpan->guix-package "Foo::Bar") (('package ('name "perl-foo-bar") ('version "0.1") ('source ('origin ('method 'url-fetch) - ('uri ('string-append "http://example.com/Foo-Bar-" + ('uri ('string-append (? string? base-uri) 'version ".tar.gz")) ('sha256 ('base32 @@ -86,9 +89,10 @@ ('synopsis "Fizzle Fuzz") ('description 'fill-in-yourself!) ('license 'perl-license)) - (string=? (bytevector->nix-base32-string - (call-with-input-string test-source port-sha256)) - hash)) + (and (string=? base-uri (%local-url* "/Foo-Bar-")) + (string=? (bytevector->nix-base32-string + (call-with-input-string test-source port-sha256)) + hash))) (x (pk 'fail x #f)))))) -- 2.30.2