From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id eDhAD72MSWdaYAAAqHPOHw:P1 (envelope-from ) for ; Fri, 29 Nov 2024 09:43:25 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id eDhAD72MSWdaYAAAqHPOHw (envelope-from ) for ; Fri, 29 Nov 2024 10:43:25 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=Thn8mG5a; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=dRMqrzHF; dmarc=pass (policy=none) header.from=gnu.org; 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" 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 D9E635CAE9 for ; Fri, 29 Nov 2024 10:43:24 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tGxWO-0000sJ-Oe; Fri, 29 Nov 2024 04:42:44 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGxWF-0000kc-1H for guix-patches@gnu.org; Fri, 29 Nov 2024 04:42:35 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tGxVq-0004aN-8m; Fri, 29 Nov 2024 04:42:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:Date:From:To:Subject; bh=daye11wnh0O2WBRGlTnRr0RWCL+zd3LG/X6f+lWkhIo=; b=Thn8mG5aNC3iwFLCXXsTw9RXGNsCsgo5ocFtEfnYTJT9GyvoCEYyyhFUilggaPtEK7+/SrJcSYNopXmmawgkFSN2vcFXrG7kgJfOVvKFQX2sccwxV1QdYEyW8tFFLAHVCWuIp+M6hzvtEUK9e+OvLTJrteEnQiNM2Vm5wNwb3zpMg6TEoxnHSpE2RDXqKRmjCodcAeqP6ZdkRqEBwnVyUCYTWddX+Cwe2srUl4Vv7joB89qe/ZcVayDvbMddTNAUUyocTdDrkTyWV6ANPUBG+5f9yXxoo+Hxr1tjCl9ZnrPTe1VP7Jc90d71hkETXSQJMo27JmVzuWrnFpVpNMjY6Q==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tGxVo-0005xl-5c; Fri, 29 Nov 2024 04:42:08 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74542] [PATCH v2 12/16] gnu-maintenance: =?UTF-8?Q?=E2=80=98generic-html=E2=80=99?= update honors . Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 29 Nov 2024 09:42:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74542 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74542@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 74542-submit@debbugs.gnu.org id=B74542.173287328722729 (code B ref 74542); Fri, 29 Nov 2024 09:42:08 +0000 Received: (at 74542) by debbugs.gnu.org; 29 Nov 2024 09:41:27 +0000 Received: from localhost ([127.0.0.1]:41075 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGxV9-0005uQ-Am for submit@debbugs.gnu.org; Fri, 29 Nov 2024 04:41:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:57474) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tGxUp-0005r9-3x for 74542@debbugs.gnu.org; Fri, 29 Nov 2024 04:41:07 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tGxUj-0003rH-Tb; Fri, 29 Nov 2024 04:41:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=daye11wnh0O2WBRGlTnRr0RWCL+zd3LG/X6f+lWkhIo=; b=dRMqrzHFyi2MCv8s97lO 0KmUJsi9G/9tyJFIfdXCWxue0AW37qDO8s8vmOdAlNAaf+FEBUvJ9F14rc4BnBWDyvDHhEw+1rjMV AbFZyW3+UBnBuwwc6bnPDgFTW7ETPJDzb8ZFJfoFRQmYzOXRrb00Pv8nhw9MQV2kB+Fp2SmZnbz4U MftlurQ91tFW1Y2BuZilB7UNl110kS58bxO28QTHD0LN1xYL6TNagjmPv+D2qUWgZTDD6TL3C6Gyn 9i2Dpl0bfqEHK0EuzJtQTXeJy5uQRsf9TppfAF4z8wzDp9mrhi8/XKNwI2i7aJhjDdfxnmYpfGInw 0bY1Q5oj8Q4l1g==; From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Fri, 29 Nov 2024 10:40:15 +0100 Message-ID: <112b57b3d8cf1208f3390602dfab6932fac7c505.1732872499.git.ludo@gnu.org> X-Mailer: git-send-email 2.46.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: D9E635CAE9 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -5.01 X-Spam-Score: -5.01 X-TUID: Q/BRzvawxq/o This fixes updates of ‘curl’: includes in its head and ignoring it would lead to incorrect download URLs. * guix/gnu-maintenance.scm (html-links): Keep track of in ‘loop’. Rewrite relative links at the end. Change-Id: I989da78df3431034c9a584f8e10cad87ae6dc920 --- guix/gnu-maintenance.scm | 41 +++++++++++++++++++++++++++------------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm index b612b11c00..ee4882326f 100644 --- a/guix/gnu-maintenance.scm +++ b/guix/gnu-maintenance.scm @@ -39,6 +39,7 @@ (define-module (guix gnu-maintenance) #:use-module (guix utils) #:use-module (guix diagnostics) #:use-module (guix i18n) + #:autoload (guix combinators) (fold2) #:use-module (guix memoization) #:use-module (guix records) #:use-module (guix upstream) @@ -483,19 +484,33 @@ (define* (import-release* package #:key (version #f)) (define (html-links sxml) "Return the list of links found in SXML, the SXML tree of an HTML page." - (let loop ((sxml sxml) - (links '())) - (match sxml - (('a ('@ attributes ...) body ...) - (match (assq 'href attributes) - (#f (fold loop links body)) - (('href url) (fold loop (cons url links) body)))) - ((tag ('@ _ ...) body ...) - (fold loop links body)) - ((tag body ...) - (fold loop links body)) - (_ - links)))) + (define-values (links base) + (let loop ((sxml sxml) + (links '()) + (base #f)) + (match sxml + (('a ('@ attributes ...) body ...) + (match (assq 'href attributes) + (#f (fold2 loop links base body)) + (('href url) (fold2 loop (cons url links) base body)))) + (('base ('@ ('href new-base))) + ;; The base against which relative URL paths must be resolved. + (values links new-base)) + ((tag ('@ _ ...) body ...) + (fold2 loop links base body)) + ((tag body ...) + (fold2 loop links base body)) + (_ + (values links base))))) + + (if base + (map (lambda (link) + (let ((uri (string->uri link))) + (if (or uri (string-prefix? "/" link)) + link + (in-vicinity base link)))) + links) + links)) (define (url->links url) "Return the unique links on the HTML page accessible at URL." -- 2.46.0