[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/06: gnu-maintenance: Add 'sourceforge' updater.
From: |
guix-commits |
Subject: |
01/06: gnu-maintenance: Add 'sourceforge' updater. |
Date: |
Tue, 6 Apr 2021 18:00:39 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit b92cfc322d2f3ca55315861ecf89b3340788a5f3
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Sun Apr 4 22:33:44 2021 +0200
gnu-maintenance: Add 'sourceforge' updater.
This updater currently covers 2.4% of the packages.
* guix/gnu-maintenance.scm (latest-sourceforge-release): New procedure.
(%sourceforge-updater): New variable.
* doc/guix.texi (Invoking guix refresh): Document it.
---
doc/guix.texi | 2 ++
guix/gnu-maintenance.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+)
diff --git a/doc/guix.texi b/doc/guix.texi
index 957f14b..d1a15cb 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -11713,6 +11713,8 @@ list of updaters). Currently, @var{updater} may be one
of:
the updater for GNU packages;
@item savannah
the updater for packages hosted at @uref{https://savannah.gnu.org, Savannah};
+@item sourceforge
+the updater for packages hosted at @uref{https://sourceforge.net, SourceForge};
@item gnome
the updater for GNOME packages;
@item kde
diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index 0390df5..ba659c0 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -66,6 +66,7 @@
%gnu-updater
%gnu-ftp-updater
%savannah-updater
+ %sourceforge-updater
%xorg-updater
%kernel.org-updater
%generic-html-updater))
@@ -660,6 +661,50 @@ GNOME packages; EMMS is included though, because its
releases are on gnu.org."
#:directory directory)
(cut adjusted-upstream-source <> rewrite))))
+(define (latest-sourceforge-release package)
+ "Return the latest release of PACKAGE."
+ (define (uri-append uri extension)
+ ;; Return URI with EXTENSION appended.
+ (build-uri (uri-scheme uri)
+ #:host (uri-host uri)
+ #:path (string-append (uri-path uri) extension)))
+
+ (define (valid-uri? uri)
+ ;; Return true if URI is reachable.
+ (false-if-exception
+ (case (response-code (http-head uri))
+ ((200 302) #t)
+ (else #f))))
+
+ (let* ((name (package-upstream-name package))
+ (base (string-append "https://sourceforge.net/projects/"
+ name "/files"))
+ (url (string-append base "/latest/download"))
+ (response (false-if-exception (http-head url))))
+ (and response
+ (= 302 (response-code response))
+ (response-location response)
+ (match (string-tokenize (uri-path (response-location response))
+ (char-set-complement (char-set #\/)))
+ ((_ components ...)
+ (let* ((path (string-join components "/"))
+ (url (string-append "mirror://sourceforge/" path)))
+ (and (release-file? name (basename path))
+
+ ;; Take the heavy-handed approach of probing 3 additional
+ ;; URLs. XXX: Would be nicer if this could be avoided.
+ (let* ((loc (response-location response))
+ (sig (any (lambda (extension)
+ (let ((uri (uri-append loc extension)))
+ (and (valid-uri? uri)
+ (string-append url extension))))
+ '(".asc" ".sig" ".sign"))))
+ (upstream-source
+ (package name)
+ (version (tarball->version (basename path)))
+ (urls (list url))
+ (signature-urls (and sig (list sig))))))))))))
+
(define (latest-xorg-release package)
"Return the latest release of PACKAGE."
(let ((uri (string->uri (origin-uri (package-source package)))))
@@ -774,6 +819,13 @@ the directory containing its source tarball."
(pred (url-prefix-predicate "mirror://savannah/"))
(latest latest-savannah-release)))
+(define %sourceforge-updater
+ (upstream-updater
+ (name 'sourceforge)
+ (description "Updater for packages hosted on sourceforge.net")
+ (pred (url-prefix-predicate "mirror://sourceforge/"))
+ (latest latest-sourceforge-release)))
+
(define %xorg-updater
(upstream-updater
(name 'xorg)
- branch master updated (10b01e7 -> ee9c44c), guix-commits, 2021/04/06
- 01/06: gnu-maintenance: Add 'sourceforge' updater.,
guix-commits <=
- 05/06: services: dovecot: Fix serialization of a free-form-args arguments., guix-commits, 2021/04/06
- 04/06: gnu: Add opensmtpd-filter-rspamd., guix-commits, 2021/04/06
- 02/06: upstream: 'package-latest-release' tries all the matching updaters., guix-commits, 2021/04/06
- 03/06: lint: refresh: Warn about missing or dysfunctional updaters., guix-commits, 2021/04/06
- 06/06: gnu: Add camlidl., guix-commits, 2021/04/06