From unknown Tue Aug 19 05:11:34 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#39753] [PATCH] guix: swh: Handle absolute URLs being returned by the API. Resent-From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 23 Feb 2020 11:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 39753 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 39753@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15824568117884 (code B ref -1); Sun, 23 Feb 2020 11:21:02 +0000 Received: (at submit) by debbugs.gnu.org; 23 Feb 2020 11:20:11 +0000 Received: from localhost ([127.0.0.1]:50437 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5pIw-000235-Ny for submit@debbugs.gnu.org; Sun, 23 Feb 2020 06:20:10 -0500 Received: from lists.gnu.org ([209.51.188.17]:58641) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5pIu-00022t-QC for submit@debbugs.gnu.org; Sun, 23 Feb 2020 06:20:09 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:58648) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j5pIt-0006wV-MN for guix-patches@gnu.org; Sun, 23 Feb 2020 06:20:08 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE, URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j5pIs-00045n-Io for guix-patches@gnu.org; Sun, 23 Feb 2020 06:20:07 -0500 Received: from pat.zlotemysli.pl ([37.59.186.212]:36000) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1j5pIs-00043a-8m for guix-patches@gnu.org; Sun, 23 Feb 2020 06:20:06 -0500 Received: (qmail 13442 invoked by uid 1009); 23 Feb 2020 12:19:58 +0100 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25731. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.010248 secs); 23 Feb 2020 11:19:58 -0000 Received: from unknown (HELO localhost.localdomain) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with AES256-SHA encrypted SMTP; 23 Feb 2020 12:19:58 +0100 From: Jakub =?UTF-8?Q?K=C4=85dzio=C5=82ka?= Date: Sun, 23 Feb 2020 12:20:33 +0100 Message-Id: <20200223112033.16166-1-kuba@kadziolka.net> X-Mailer: git-send-email 2.25.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Qmailux-2.08st: added fake Content-Type header Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 37.59.186.212 X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.7 (-) * guix/swh.scm (swh-url): Don't prepend (%swh-base-url) if a domain is already present. This fixes the "guix lint: warning: while connecting to Software Heritage: host lookup failure: Name or service not known" error message. --- guix/swh.scm | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/guix/swh.scm b/guix/swh.scm index 8bdf9965f6..a948a8f28f 100644 --- a/guix/swh.scm +++ b/guix/swh.scm @@ -126,9 +126,16 @@ (make-parameter "https://archive.softwareheritage.org")) (define (swh-url path . rest) + ;; URLs returned by the API may be relative or absolute. This has changed + ;; without notice before. Handle both cases by detecting whether the path + ;; starts with a domain. + (define root + (if (string-prefix? "/" path) + (string-append (%swh-base-url) path) + path)) + (define url - (string-append (%swh-base-url) path - (string-join rest "/" 'prefix))) + (string-append root (string-join rest "/" 'prefix))) ;; Ensure there's a trailing slash or we get a redirect. (if (string-suffix? "/" url) -- 2.25.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 23 06:32:43 2020 Received: (at control) by debbugs.gnu.org; 23 Feb 2020 11:32:43 +0000 Received: from localhost ([127.0.0.1]:50446 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5pV4-0002Uy-Nx for submit@debbugs.gnu.org; Sun, 23 Feb 2020 06:32:42 -0500 Received: from pat.zlotemysli.pl ([37.59.186.212]:57138) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1j5pV3-0002Uo-QT for control@debbugs.gnu.org; Sun, 23 Feb 2020 06:32:42 -0500 Received: (qmail 16483 invoked by uid 1009); 23 Feb 2020 12:32:39 +0100 Received: from 188.123.215.55 (kuba@kadziolka.net@188.123.215.55) by pat (envelope-from , uid 1002) with qmail-scanner-2.08st (clamdscan: 0.98.6/25731. spamassassin: 3.4.0. perlscan: 2.08st. Clear:RC:1(188.123.215.55):. Processed in 0.019238 secs); 23 Feb 2020 11:32:39 -0000 Received: from unknown (HELO gravity) (kuba@kadziolka.net@188.123.215.55) by pat.zlotemysli.pl with SMTP; 23 Feb 2020 12:32:39 +0100 Date: Sun, 23 Feb 2020 12:33:22 +0100 From: Jakub =?utf-8?B?S8SFZHppb8WCa2E=?= To: control@debbugs.gnu.org Subject: close 39753 Message-ID: <20200223113322.xoqqulutyjtpnhcu@gravity> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="tzbo2k722juwrhou" Content-Disposition: inline X-Spam-Score: 1.1 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: close 39753 Content analysis details: (1.1 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [37.59.186.212 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 TVD_SPACE_RATIO No description available. 1.1 TVD_SPACE_RATIO_MINFP Space ratio X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --tzbo2k722juwrhou Content-Type: text/plain; charset=us-ascii Content-Disposition: inline close 39753 --tzbo2k722juwrhou Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE5Xa/ss9usT31cTO54xWnWEYTFWQFAl5SYwIACgkQ4xWnWEYT FWTVcxAAo/BOh2TMzkmZa54Q6GFafUPQYPTdGUF+oJ0Q/5Hc2lqJs2SOk650A6aL WnfZ1HHfWqqmexy2mMS8E5eS+nbVBiRSvjpc7BY8xzGm4j4LwzC4YFmrW3JGnUUY xQAn11UauJJ9PRHNHTM2viO7rUKsS2QIXpDChubOpYrSnewfAggxawrrU5gwcGXf qN2hp8dpasN9PtBpwV2ontOGXipLTlCJVR2JnWjHb3bXO7doEcZUJB5xGV28evDq C0hK1NGGhmrnaNpHiEtrRKu5DQp6p+y2/3iZF10IY7Kt8MPg/ifIKdpPZGWbYfF1 2+eGnTq45L+NEeZ5ZE7WlXT+d+Sudpl7zvUHQ3zn044Dxlsp2ORizlOvDnjO2+lq J6jcL4NmfCdtvokOgiHSg6mkNqs8E645cDbWlM+REsTMOvTdK7pTu4NguL4Sxo7o vsk1EC6IY71ttq4Ctax21udZMdGFUm2W+r/rxyOaALgkc+k7+Gk3UShT8cMh5C3g ZhUoBdhNcTVyW8pTNq+R8Xr7+9OwwcUsiqRKrsbaJNjucNfz+ocHfr7OHTxyVIAv 7b0i0Keg0wE/4C/C/XR9YxP7Og/a5VFTuuyEyK39YpiqqCkXCcxw/lGZWpI75e5t wgaHo8cIK3hthqK2IvIdP84mqbFOHQjeeSKUW88LuuS1NouoWQI= =4PgG -----END PGP SIGNATURE----- --tzbo2k722juwrhou--