GNU bug report logs - #57732
[PATCH] gnu-maintenance: Support // URLs in latest-html-release

Previous Next

Package: guix-patches;

Reported by: Maxime Devos <maximedevos <at> telenet.be>

Date: Sun, 11 Sep 2022 14:24:02 UTC

Severity: normal

Tags: patch

Done: Christopher Baines <mail <at> cbaines.net>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57732 in the body.
You can then email your comments to 57732 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#57732; Package guix-patches. (Sun, 11 Sep 2022 14:24:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Maxime Devos <maximedevos <at> telenet.be>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sun, 11 Sep 2022 14:24:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: guix-patches <at> gnu.org
Cc: Maxime Devos <maximedevos <at> telenet.be>
Subject: [PATCH] gnu-maintenance: Support // URLs in latest-html-release
Date: Sun, 11 Sep 2022 16:23:37 +0200
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(+)

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 <ludo <at> gnu.org>
 ;;; Copyright © 2012, 2013 Nikita Karetnikov <nikita <at> karetnikov.org>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune <at> gmail.com>
+;;; Copyright © 2022 Maxime Devos <maximedevos <at> telenet.be>
 ;;;
 ;;; 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 <ludo <at> gnu.org>
+;;; Copyright © 2022 Maxime Devos <maximedevos <at> telenet.be>
 ;;;
 ;;; 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 "<html xmlns=\"http://www.w3.org/1999/xhtml\">
+<head>
+<title>Releases (on another domain)!</title>
+</head>
+<body
+<a href=\"//another-site/foo-2.tar.gz\">version 1</a>
+</body>
+</html>"))
+    (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)

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
-- 
2.37.2





Reply sent to Christopher Baines <mail <at> cbaines.net>:
You have taken responsibility. (Sat, 17 Sep 2022 17:22:02 GMT) Full text and rfc822 format available.

Notification sent to Maxime Devos <maximedevos <at> telenet.be>:
bug acknowledged by developer. (Sat, 17 Sep 2022 17:22:02 GMT) Full text and rfc822 format available.

Message #10 received at 57732-done <at> debbugs.gnu.org (full text, mbox):

From: Christopher Baines <mail <at> cbaines.net>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: 57732-done <at> debbugs.gnu.org
Subject: Re: [bug#57732] [PATCH] gnu-maintenance: Support // URLs in
 latest-html-release
Date: Sat, 17 Sep 2022 19:21:25 +0200
[Message part 1 (text/plain, inline)]
Maxime Devos <maximedevos <at> telenet.be> writes:

> 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(+)

Looks good to me :) Pushed to master as
c967d1153cae419e4acbe0dbed8f558d95ced0e3.

Thanks,

Chris
[signature.asc (application/pgp-signature, inline)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 16 Oct 2022 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 164 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.