From patchwork Sun Sep 11 14:23:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: M X-Patchwork-Id: 42476 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 8CB9627BBE9; Sun, 11 Sep 2022 15:24:12 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,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 DE01027BBEA for ; Sun, 11 Sep 2022 15:24:11 +0100 (BST) Received: from localhost ([::1]:35068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oXNsZ-00056J-22 for patchwork@mira.cbaines.net; Sun, 11 Sep 2022 10:24:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51510) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXNsR-00055m-7B for guix-patches@gnu.org; Sun, 11 Sep 2022 10:24:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54394) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oXNsQ-0004FZ-LA for guix-patches@gnu.org; Sun, 11 Sep 2022 10:24:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oXNsQ-00019r-G6 for guix-patches@gnu.org; Sun, 11 Sep 2022 10:24:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57732] [PATCH] gnu-maintenance: Support // URLs in latest-html-release Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 11 Sep 2022 14:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57732 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57732@debbugs.gnu.org Cc: Maxime Devos X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16629062364435 (code B ref -1); Sun, 11 Sep 2022 14:24:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 Sep 2022 14:23:56 +0000 Received: from localhost ([127.0.0.1]:43093 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXNsK-00019Q-9M for submit@debbugs.gnu.org; Sun, 11 Sep 2022 10:23:56 -0400 Received: from lists.gnu.org ([209.51.188.17]:56520) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oXNsI-00019J-NK for submit@debbugs.gnu.org; Sun, 11 Sep 2022 10:23:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:56114) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oXNsI-00054a-I2 for guix-patches@gnu.org; Sun, 11 Sep 2022 10:23:54 -0400 Received: from michel.telenet-ops.be ([2a02:1800:110:4::f00:18]:34166) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oXNsG-0004Ez-8G for guix-patches@gnu.org; Sun, 11 Sep 2022 10:23:54 -0400 Received: from localhost.localdomain ([188.189.36.122]) by michel.telenet-ops.be with bizsmtp id JePf280042e7A3g06ePfJT; Sun, 11 Sep 2022 16:23:39 +0200 From: Maxime Devos Date: Sun, 11 Sep 2022 16:23:37 +0200 Message-Id: <20220911142337.1208-1-maximedevos@telenet.be> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1662906219; bh=sYrar1XbHM/IC0Kcq/voNyhkXQJDSro/KjztxMv3xFg=; h=From:To:Cc:Subject:Date; b=MFhbGz9+52RRLx0rUU7oskyKQOLkPGxQ/6sWdL/e6H6ZJVL7Jfso+MpcnDXg5dTjc 1wAYQqsgVh0O4n4fviAZVYixgJkm0uwKdpjggPqVU/IrfBYSZIBvRHHVAEmRtXXLa+ 5k/dzhUbhDHq/40FNSmaplcaHaXx0H3bzZ9KTdbpiGBirMy78ORGEqnLbkgwiPiGeu TxVQWbFW0EcKsvq9JciWnuK0m145Rq1RF0PVNAuixY7ID1Ewbz/BOYeDARRe/6O+nT C6y/6B5XiYzVAC9odK6xiaBKJdX7FWfiwk0eJabvj75Kvqoj22RGuZTsKFckOMgClP T0glU8GF1K4cQ== Received-SPF: pass client-ip=2a02:1800:110:4::f00:18; envelope-from=maximedevos@telenet.be; helo=michel.telenet-ops.be X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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" X-getmail-retrieved-from-mailbox: Patches This makes "./pre-inst-env guix refresh -u" download the release tarball from the right place -- previously, it downloaded from https://www.libreoffice.org//download.documentfoundation.org/libreoffice/src/7.4.0/libreoffice-7.4.0.3.tar.xz?idx=1 whereas it should download from https://download.documentfoundation.org/libreoffice/src/7.4.0/libreoffice-7.4.0.3.tar.xz?idx=1 instead. * guix/gnu-maintenance.scm (latest-html-release)[url-release]: Adjust computation in the case of an absolute URI-reference without a scheme. * tests/gnu-maintenance.scm ("latest-html-release, scheme-less URIs"): Test it. --- guix/gnu-maintenance.scm | 7 +++++++ tests/gnu-maintenance.scm | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) base-commit: a44e08337d15b3f254a35d0311663c2bbd501852 prerequisite-patch-id: 0caac311875ee39cb48573657ebb960e90da6dfb prerequisite-patch-id: 418285493d89ebf102175902d9b09a0174e88190 prerequisite-patch-id: 3c39eb839d9d3ff3fca6cd98621a5d5c411b7af4 prerequisite-patch-id: 8d5662e874c469f5ee496ef5181cf2d0a30ad1d8 prerequisite-patch-id: 26513c3b3b86963df718ee41d14a25d1cc6a8f3f prerequisite-patch-id: 2b2497e2edec0afc48ebadd6f09f0c661c466127 prerequisite-patch-id: 2712efb97bf33985fd0658e4dd8e936dc08be5fe prerequisite-patch-id: 9d2409b480a8bff0fef029b4b095922d4957e06f prerequisite-patch-id: 51a32abca3efec1ba67ead59b8694c5ea3129ad3 diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm index e7edbf6656..1ffa408666 100644 --- a/guix/gnu-maintenance.scm +++ b/guix/gnu-maintenance.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès ;;; Copyright © 2012, 2013 Nikita Karetnikov ;;; Copyright © 2021 Simon Tournier +;;; Copyright © 2022 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -499,6 +500,12 @@ (define (url->release url) (base-url (string-append base-url directory)) (url (cond ((and=> (string->uri url) uri-scheme) ;full URL? url) + ;; full URL, except for URI scheme. Reuse the URI + ;; scheme of the document that contains the link. + ((string-prefix? "//" url) + (string-append + (symbol->string (uri-scheme (string->uri base-url))) + ":" url)) ((string-prefix? "/" url) ;absolute path? (let ((uri (string->uri base-url))) (uri->string diff --git a/tests/gnu-maintenance.scm b/tests/gnu-maintenance.scm index c04d8ba733..89b0684c25 100644 --- a/tests/gnu-maintenance.scm +++ b/tests/gnu-maintenance.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015, 2021 Ludovic Courtès +;;; Copyright © 2022 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -18,6 +19,10 @@ (define-module (test-gnu-maintenance) #:use-module (guix gnu-maintenance) + #:use-module (guix tests) + #:use-module (guix tests http) + #:use-module (guix upstream) + #:use-module (guix utils) #:use-module (srfi srfi-1) #:use-module (srfi srfi-64) #:use-module (ice-9 match)) @@ -55,4 +60,28 @@ (define-module (test-gnu-maintenance) ("mpg321_0.3.2.orig.tar.gz" "0.3.2") ("bvi-1.4.1.src.tar.gz" "1.4.1"))))) +(test-assert "latest-html-release, scheme-less URIs" + (with-http-server + `((200 " + +Releases (on another domain)! + +version 1 + +")) + (let () + (define package + (dummy-package "foo" + (source + (dummy-origin + (uri (string-append (%local-url) "/foo-1.tar.gz")))) + (properties + `((release-monitoring-url . ,(%local-url)))))) + (define update ((upstream-updater-latest %generic-html-updater) package)) + (define expected-new-url "http://another-site/foo-2.tar.gz") + (and (pk 'u update) + (equal? (upstream-source-version update) "2") + (equal? (list expected-new-url) (upstream-source-urls update)))))) + (test-end)