unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 47126@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#47126] [PATCH 2/7] gnu-maintenance: 'latest-html-release' considers non-relative URLs.
Date: Sat, 13 Mar 2021 22:46:15 +0100	[thread overview]
Message-ID: <20210313214620.28186-2-ludo@gnu.org> (raw)
In-Reply-To: <20210313214620.28186-1-ludo@gnu.org>

* guix/gnu-maintenance.scm (latest-html-release): Allow for URL to be an
arbitrary URL rather than a relative URL reference.
---
 guix/gnu-maintenance.scm | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index febed57c3a..98d326e500 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -1,5 +1,5 @@
 ;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright © 2012, 2013 Nikita Karetnikov <nikita@karetnikov.org>
 ;;; Copyright © 2021 Simon Tournier <zimon.toutoune@gmail.com>
 ;;;
@@ -479,19 +479,21 @@ return the corresponding signature URL, or #f it signatures are unavailable."
          (port (http-fetch/cached uri #:ttl 3600))
          (sxml (html->sxml port)))
     (define (url->release url)
-      (and (string=? url (basename url))          ;relative reference?
-           (release-file? package url)
-           (let-values (((name version)
-                         (package-name->name+version
-                          (tarball-sans-extension url)
-                          #\-)))
-             (upstream-source
-              (package name)
-              (version version)
-              (urls (list (string-append base-url directory "/" url)))
-              (signature-urls
-               (list (file->signature
-                      (string-append base-url directory "/" url))))))))
+      (let* ((base (basename url))
+             (url  (if (string=? base url)
+                       (string-append base-url directory "/" url)
+                       url)))
+        (and (release-file? package base)
+             (let-values (((name version)
+                           (package-name->name+version
+                            (tarball-sans-extension base)
+                            #\-)))
+               (upstream-source
+                (package name)
+                (version version)
+                (urls (list url))
+                (signature-urls
+                 (list (file->signature url))))))))
 
     (define candidates
       (filter-map url->release (html-links sxml)))
-- 
2.30.1





  reply	other threads:[~2021-03-13 21:47 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-13 21:43 [bug#47126] [PATCH 0/7] Add 'generic-html' updater Ludovic Courtès
2021-03-13 21:46 ` [bug#47126] [PATCH 1/7] gnu-maintenance: Use (htmlprag) for 'latest-html-release' Ludovic Courtès
2021-03-13 21:46   ` Ludovic Courtès [this message]
2021-03-13 21:46   ` [bug#47126] [PATCH 3/7] gnu-maintenance: 'release-file?' rejects checksum files Ludovic Courtès
2021-03-13 21:46   ` [bug#47126] [PATCH 4/7] gnu-maintenance: 'latest-html-release' can determine signature file name Ludovic Courtès
2021-03-13 21:46   ` [bug#47126] [PATCH 5/7] gnu-maintenance: 'latest-html-release' better computes version number Ludovic Courtès
2021-03-13 21:46   ` [bug#47126] [PATCH 6/7] gnu-maintenance: Add 'generic-html' updater Ludovic Courtès
2021-03-13 21:46   ` [bug#47126] [PATCH 7/7] gnu: hwloc: Add 'release-monitoring-url' property Ludovic Courtès
2021-03-17 10:18 ` [bug#47126] [PATCH 0/7] Add 'generic-html' updater Léo Le Bouter via Guix-patches via
2021-03-17 13:52   ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210313214620.28186-2-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=47126@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).