From patchwork Fri Nov 29 09:40:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 34219 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 003F327BBEB; Fri, 29 Nov 2024 09:43:24 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C63CE27BBE2 for ; Fri, 29 Nov 2024 09:43:24 +0000 (GMT) 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?b?4oCYZ2Vu?= =?utf-8?b?ZXJpYy1odG1s4oCZ?= 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 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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."