From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id aIM3N/aC1mRfdQEASxT56A (envelope-from ) for ; Fri, 11 Aug 2023 20:50:30 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id eOAuN/aC1mSUbQAAauVa8A (envelope-from ) for ; Fri, 11 Aug 2023 20:50:30 +0200 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 890FE5C58B for ; Fri, 11 Aug 2023 20:50:30 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b="oJ3/8ihg"; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1691779830; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: 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=8GYkcMLDbzOAcGgCc1nCyv1frv9pP3ExUd45hqYSgHg=; b=JXcnvi75DklaoPjh4UQ5GruWyCs91LGB6J8dOeGDdTjisTT7cvKgbE91Hjxmw570nYbdvx vRZkLd7PvmMjPQHy4ReiXX9dVKlGW/Urizevp+M7EUxjMPqbcZtp2/LakhJIvsc7/rPlHt vj+6WsQ4Jn8JZ3GGmjBmNqcFJaasD5gxxZ9hwfxd3rXsI6XR8jDknDRnnPwlstBdck/0Aq 2/6D5vPIulR3Z4QtikW100QNa+KoV8sYG17QKI4IAMcUkIndlsBBmwvAdxKCxmLbcBFtPV v/a6bnyjIk5zezNqm7ev4fxDi7rORmxTwMp4kYJJW6pXjlTT1XPrQAkWDKiAtg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1691779830; a=rsa-sha256; cv=none; b=RNQVTtFZNnl1qp+US1p1kx+hmcSCnKrYfZECJ9/hoSX0y9q/VmIGlBX8gOKdHh656aDSiu +2e+VhC6RCgo4AQuTQ+DjE1Fc/OeBrX/AnENqTS01PTEH6MeLSH+R44runaOGs7Jpz7gHn 9PmicGhDA7RG4V81xc71DZv7iK5XiLpTDNW7UujUwECRsZWOsgs7ZClIe43zDRy2UGarue B0BulTF/tKJsJbv2ludFHHYw1HKQJ6OMa2+grVbzQ8r9WSGObFB4dGVwW+MklnDt2hLDnB VOL29c/wRVoobOmYvmf6ReRgsGTguZfJnLK06RnQtefK5lVfQtlc/6anaEDiJQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20221208 header.b="oJ3/8ihg"; 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"; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qUXD9-0003da-Rh; Fri, 11 Aug 2023 14:50:12 -0400 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 1qUXD6-0003bE-3w for guix-patches@gnu.org; Fri, 11 Aug 2023 14:50:08 -0400 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 1qUXD5-00009E-RD; Fri, 11 Aug 2023 14:50:07 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qUXD4-0007rT-6T; Fri, 11 Aug 2023 14:50:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65230] [PATCH 06/13] gnu-maintenance: Extract url->links procedure. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 11 Aug 2023 18:50:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65230 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65230@debbugs.gnu.org Cc: Maxim Cournoyer , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 65230-submit@debbugs.gnu.org id=B65230.169177978630054 (code B ref 65230); Fri, 11 Aug 2023 18:50:06 +0000 Received: (at 65230) by debbugs.gnu.org; 11 Aug 2023 18:49:46 +0000 Received: from localhost ([127.0.0.1]:47986 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUXCj-0007ob-LY for submit@debbugs.gnu.org; Fri, 11 Aug 2023 14:49:45 -0400 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]:60517) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qUXCh-0007ne-BS for 65230@debbugs.gnu.org; Fri, 11 Aug 2023 14:49:43 -0400 Received: by mail-qt1-x835.google.com with SMTP id d75a77b69052e-4039f7e1d3aso15353371cf.0 for <65230@debbugs.gnu.org>; Fri, 11 Aug 2023 11:49:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691779777; x=1692384577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8GYkcMLDbzOAcGgCc1nCyv1frv9pP3ExUd45hqYSgHg=; b=oJ3/8ihgcuhuoTyxy9GjyUnuYo1r5xYlwqhTik/nBUKKz0MIWC+J4VzINj5OKVToyk uXiZAM9QTyLNwQcTlcWjRZsm1Ah44Qez+jAklx/Z0z1TyhWZagkWxcs/bSL0xKR5L7iq c+4gcZdgun/fwbQTdCep7xV77eeWy3rqcrMJGsO+OTvODAj/SdmX5Lk3h7jE1kYOoeUD RXJWyPbtmCV0ArdcEnSzf6kZmRH/Ioex/61Emx+5re5pesJjMqWVD8QVSX0bvpVvAVy8 /qXgnzZVdnz2g/byaVrDcm45kTuCWja5fV21pjk5l3IK27jDQ5vWnI2kv8RNxJWNvVR0 SNLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691779777; x=1692384577; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8GYkcMLDbzOAcGgCc1nCyv1frv9pP3ExUd45hqYSgHg=; b=MxLYVaTqNR0SM2CFFnDDhD3g7bcQGKVA2+YbO0wTUB5RQYNFrEB1zO13epsxVU2aTX HVFXJRBNAZU1Mmwtva5G4Sh245E1EiscjLXnQ67Nq4mmTc5mNlKbAWN1lj5zPGtyz5qN MffejAvPNloCqJkPXL9Z6U/uaSzRhG8WMOXbcnzCRL1C6ZzOrgWvfFDz7J/OLfcWl1Au VnT4qWBtXChJs5ZWZDzIMgB0scsvaciRpbeas9/mpsXCGmdPAzIxPNKmQ2DzzKOt5aOh 7j2L0iiknpjQfOiOGvbpLEhz5TcFdw/ouAHgs8FWYs3j1BVlG3b+cmrk5N4bid8LYPTe NbYw== X-Gm-Message-State: AOJu0YwYT41g+e0cRt8tj++GNnDAaHRHsSsrx7MElRlO5z1nZ98qpRQ6 YQJUtsU9C7y8MkoOKyacNUG+QtUG5/xZ1Q== X-Google-Smtp-Source: AGHT+IFciT8MGMOjkSPn21wwKBKa0W8+0U/m8bddW0x+ZWVyhdVfszU5vMsmG9DuIMyo+CCnvUF9Zw== X-Received: by 2002:a05:622a:1a87:b0:403:be2b:590b with SMTP id s7-20020a05622a1a8700b00403be2b590bmr3132930qtc.44.1691779777741; Fri, 11 Aug 2023 11:49:37 -0700 (PDT) Received: from localhost.localdomain (dsl-205-236-230-92.b2b2c.ca. [205.236.230.92]) by smtp.gmail.com with ESMTPSA id e29-20020ac8011d000000b00405553305casm1366398qtg.86.2023.08.11.11.49.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Aug 2023 11:49:37 -0700 (PDT) From: Maxim Cournoyer Date: Fri, 11 Aug 2023 14:44:53 -0400 Message-ID: <980150ff4fa380d47b016247063d7c3da52a6b55.1691779500.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <4f0ffa940ca39719ffa9719a9593190620855769.1691779500.git.maxim.cournoyer@gmail.com> References: <4f0ffa940ca39719ffa9719a9593190620855769.1691779500.git.maxim.cournoyer@gmail.com> MIME-Version: 1.0 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: 890FE5C58B X-Migadu-Scanner: mx0.migadu.com X-Migadu-Spam-Score: -3.08 X-Spam-Score: -3.08 X-TUID: qjSrVmagWugz * guix/gnu-maintenance.scm (url->links): New procedure. (import-html-release): Use it. --- guix/gnu-maintenance.scm | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm index a314923d3b..2e0fc3e8ab 100644 --- a/guix/gnu-maintenance.scm +++ b/guix/gnu-maintenance.scm @@ -483,6 +483,14 @@ (define (html-links sxml) (_ links)))) +(define (url->links url) + "Return the unique links on the HTML page accessible at URL." + (let* ((uri (string->uri url)) + (port (http-fetch/cached uri #:ttl 3600)) + (sxml (html->sxml port))) + (close-port port) + (delete-duplicates (html-links sxml)))) + (define* (import-html-release base-url package #:key (version #f) @@ -499,12 +507,10 @@ (define* (import-html-release base-url package if any. Otherwise, FILE->SIGNATURE must be a procedure; it is passed a source file URL and must return the corresponding signature URL, or #f it signatures are unavailable." - (let* ((uri (string->uri (if (string-null? directory) - base-url - (string-append base-url directory "/")))) - (port (http-fetch/cached uri #:ttl 3600)) - (sxml (html->sxml port)) - (links (delete-duplicates (html-links sxml)))) + (let* ((url (if (string-null? directory) + base-url + (string-append base-url directory "/"))) + (links (url->links url))) (define (file->signature/guess url) (let ((base (basename url))) (any (lambda (link) @@ -562,7 +568,6 @@ (define* (import-html-release base-url package (define candidates (filter-map url->release links)) - (close-port port) (match candidates (() #f) ((first . _) -- 2.41.0