summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2022-11-11 12:26:41 +0100
committerLudovic Courtès <ludo@gnu.org>2022-11-11 23:17:43 +0100
commit9a35e4c5bd5c4148f32336c3a156d14a895fc5dd (patch)
treeee15e2c89755838a1c5fc616567097ef1a672c32
parent692d987d0f995b18ff69eee001ee915ba31a691f (diff)
downloadguix-9a35e4c5bd5c4148f32336c3a156d14a895fc5dd.tar.gz
gnu-maintenance: 'gnu' updater prefers tarball with same compression.
Fixes <https://issues.guix.gnu.org/59168>.

Previously 'guix build make --with-latest=make' would pick ".tar.lz",
rather than "tar.gz", because "tar.lz" happened to come first in the
<upstream-source> 'urls' field.

* guix/gnu-maintenance.scm (latest-gnu-release)[archive-type]
[better-tarball?]: New variables.
Sort TARBALLS according to BETTER-TARBALL?.
-rw-r--r--guix/gnu-maintenance.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index 10a6ec05f1..a1b73e6316 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -596,6 +596,12 @@ ftp.gnu.org.
 
 This method does not rely on FTP access at all; instead, it browses the file
 list available from %GNU-FILE-LIST-URI over HTTP(S)."
+  (define archive-type
+    (package-archive-type package))
+
+  (define (better-tarball? tarball1 tarball2)
+    (string=? (file-extension tarball1) archive-type))
+
   (let-values (((server directory)
                 (ftp-server/directory package))
                ((name)
@@ -626,7 +632,9 @@ list available from %GNU-FILE-LIST-URI over HTTP(S)."
                          (string-append "mirror://gnu/"
                                         (string-drop file
                                                      (string-length "/gnu/"))))
-                       tarballs))
+                       ;; Sort so that the tarball with the same compression
+                       ;; format as currently used in PACKAGE comes first.
+                       (sort tarballs better-tarball?)))
             (signature-urls (map (cut string-append <> ".sig") urls)))))
         (()
          #f)))))