summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2025-11-04 14:22:08 +0100
committerLudovic Courtès <ludo@gnu.org>2025-11-18 13:05:49 +0100
commit1ce270fb85be517c32c0369df6293ca73b26ebac (patch)
tree82be943bc300834618df458519d7e114c75335c9 /tests
parent830562e5cdb6c244f39c3168b4649c1144099450 (diff)
gnu-maintenance: ‘generic-html’ recognizes ‘release-file-regexp’ property.
* guix/gnu-maintenance.scm (package-release-file?): New procedure. (tarball->version): Add optional parameter and honor it. (import-html-release): Use ‘package-release-file?’ and pass second argument to ‘tarball->version’. * tests/gnu-maintenance.scm ("latest-html-release, 'release-file-regexp' property") ("latest-html-release, invalid 'release-file-regexp' property"): New tests. * doc/guix.texi (Invoking guix refresh): Document it. Change-Id: Ia9328418fdd2faf118e4ec9d5fbde4a279e100ed Reviewed-by: Maxim Cournoyer <maxim@guixotic.coop>
Diffstat (limited to 'tests')
-rw-r--r--tests/gnu-maintenance.scm58
1 files changed, 56 insertions, 2 deletions
diff --git a/tests/gnu-maintenance.scm b/tests/gnu-maintenance.scm
index 644cd1f2a90..01bcea04aab 100644
--- a/tests/gnu-maintenance.scm
+++ b/tests/gnu-maintenance.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2015, 2021 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2015, 2021, 2025 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2022 Maxime Devos <maximedevos@telenet.be>
;;; Copyright © 2023-2024 Maxim Cournoyer <maxim@guixotic.coop>
;;;
@@ -27,7 +27,7 @@
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-64)
#:use-module ((web client) #:select (current-http-proxy))
- #:use-module ((web uri) #:select (uri? uri->string))
+ #:use-module ((web uri) #:select (uri? uri->string string->uri uri-path))
#:use-module (ice-9 match))
(test-begin "gnu-maintenance")
@@ -91,6 +91,60 @@
(equal? (upstream-source-version update) "2")
(equal? (list expected-new-url) (upstream-source-urls update))))))
+(test-equal "latest-html-release, 'release-file-regexp' property"
+ '("foo"
+ "1.2.3"
+ ("/dl/FOO1.2.3.tgz"))
+ (with-http-server
+ `((200 "<html xmlns=\"http://www.w3.org/1999/xhtml\">
+<head>
+<title>Releases with unusual file names</title>
+</head>
+<body
+<a href=\"FOO1.2.3.tgz\">version 1.2</a>
+</body>
+</html>"))
+ (let ()
+ (define package
+ (dummy-package "foo"
+ (source
+ (dummy-origin
+ (uri (string-append (%local-url #:path "/dl")
+ "/FOO1.0.0.tar.gz"))))
+ (properties
+ `((release-monitoring-url . ,(%local-url #:path "/dl/"))
+ (release-file-regexp . "FOO([0-9\\.]+)\\.tgz")))))
+ (define update
+ ((upstream-updater-import %generic-html-updater) package))
+
+ (list (upstream-source-package update)
+ (upstream-source-version update)
+ (map (compose uri-path string->uri)
+ (upstream-source-urls update))))))
+
+(test-assert "latest-html-release, invalid 'release-file-regexp' property"
+ (with-http-server
+ `((200 "<html xmlns=\"http://www.w3.org/1999/xhtml\">
+<head>
+<title>Releases with unusual file names</title>
+</head>
+<body
+<a href=\"FOO1.2.3.tgz\">version 1.2</a>
+</body>
+</html>"))
+ (let ()
+ (define package
+ (dummy-package "foo"
+ (source
+ (dummy-origin
+ (uri (string-append (%local-url #:path "/dl")
+ "/FOO1.0.0.tar.gz"))))
+ (properties
+ `((release-monitoring-url . ,(%local-url #:path "/dl/"))
+ (release-file-regexp . "FOO[0-9\\.]+\\.tgz")))))
+ (not ((upstream-updater-import %generic-html-updater) package)))))
+
+
(test-assert "latest-html-release, no signature"
(with-http-server
`((200 "<html xmlns=\"http://www.w3.org/1999/xhtml\">