[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
02/12: upstream: Factorize 'package-archive-type'.
From: |
guix-commits |
Subject: |
02/12: upstream: Factorize 'package-archive-type'. |
Date: |
Fri, 11 Nov 2022 17:19:30 -0500 (EST) |
civodul pushed a commit to branch master
in repository guix.
commit 692d987d0f995b18ff69eee001ee915ba31a691f
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Fri Nov 11 12:25:52 2022 +0100
upstream: Factorize 'package-archive-type'.
* guix/upstream.scm (package-archive-type): New procedure.
(package-update/url-fetch): Use it.
---
guix/upstream.scm | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/guix/upstream.scm b/guix/upstream.scm
index cbfd1aa609..32736940aa 100644
--- a/guix/upstream.scm
+++ b/guix/upstream.scm
@@ -78,6 +78,7 @@
lookup-updater
download-tarball
+ package-archive-type
package-latest-release
package-latest-release*
package-update
@@ -430,6 +431,19 @@ values: the item from LST1 and the item from LST2 that
match PRED."
(()
(values #f #f)))))
+(define (package-archive-type package)
+ "If PACKAGE's source is a tarball or zip archive, return its archive type--a
+string such as \"xz\". Otherwise return #f."
+ (match (and=> (package-source package) origin-actual-file-name)
+ (#f #f)
+ (file
+ (let ((extension (file-extension file)))
+ ;; FILE might be "example-1.2-checkout", in which case we want to
+ ;; ignore the extension.
+ (and (or (string-contains extension "z")
+ (string-contains extension "tar"))
+ extension)))))
+
(define* (package-update/url-fetch store package source
#:key key-download)
"Return the version, tarball, and SOURCE, to update PACKAGE to
@@ -437,17 +451,7 @@ SOURCE, an <upstream-source>."
(match source
(($ <upstream-source> _ version urls signature-urls)
(let*-values (((archive-type)
- (match (and=> (package-source package) origin-uri)
- ((? string? uri)
- (let ((type (or (file-extension (basename uri)) "")))
- ;; Sometimes we have URLs such as
- ;; "https://github.com/…/tarball/v0.1";, in which case
- ;; we must not consider "1" as the extension.
- (and (or (string-contains type "z")
- (string=? type "tar"))
- type)))
- (_
- "gz")))
+ (package-archive-type package))
((url signature-url)
;; Try to find a URL that matches ARCHIVE-TYPE.
(find2 (lambda (url sig-url)
- branch master updated (8c0c223fab -> ad03c2d461), guix-commits, 2022/11/11
- 03/12: gnu-maintenance: 'gnu' updater prefers tarball with same compression., guix-commits, 2022/11/11
- 05/12: gnu: valgrind: Add version 3.20.0., guix-commits, 2022/11/11
- 02/12: upstream: Factorize 'package-archive-type'.,
guix-commits <=
- 01/12: grafts: Run with a UTF-8 locale., guix-commits, 2022/11/11
- 06/12: gnu: xfce4-settings: Update to 4.16.4., guix-commits, 2022/11/11
- 07/12: gnu: mangohud: Update to 0.6.8., guix-commits, 2022/11/11
- 10/12: gnu: spdlog: Update to 1.11.0., guix-commits, 2022/11/11
- 11/12: gnu: waybar: Update to 0.9.15., guix-commits, 2022/11/11
- 12/12: gnu: wofi: Update to 1.3., guix-commits, 2022/11/11
- 09/12: gnu: bear: Replace spdlog with spdlog-1.10., guix-commits, 2022/11/11
- 04/12: gnu-maintenance: 'release-file?' excludes "valgrind-3.20.0.RC1.tar.bz2"., guix-commits, 2022/11/11
- 08/12: gnu: Add spdlog-1.10., guix-commits, 2022/11/11