summary refs log tree commit diff
diff options
context:
space:
mode:
authorDavid Craven <david@craven.ch>2016-08-01 11:05:28 +0200
committerDavid Craven <david@craven.ch>2016-08-02 13:28:21 +0200
commit9c97afe8588d4e822676d278e251247d1476df7c (patch)
tree8d5ef3238995b3a18c995a112046d9f0f524c2a4
parentff02b826780ee5f85f5a363114b5234b6d44dfd1 (diff)
downloadguix-9c97afe8588d4e822676d278e251247d1476df7c.tar.gz
gnu-maintenance: Add KDE updater.
* guix/gnu-maintenance.scm (kde-package?, latest-kde-release): New private
  functions.
  (%kde-updater): New public variable.
* guix/scripts/refresh.scm (list-updaters): Add %kde-updater.
* doc/guix.texi (Invoking guix refresh): Mention the new updater.
-rw-r--r--doc/guix.texi2
-rw-r--r--guix/download.scm1
-rw-r--r--guix/gnu-maintenance.scm35
-rw-r--r--guix/scripts/refresh.scm6
4 files changed, 43 insertions, 1 deletions
diff --git a/doc/guix.texi b/doc/guix.texi
index f1848a1c5d..9b3f51ecaf 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -4985,6 +4985,8 @@ list of updaters).  Currently, @var{updater} may be one of:
 the updater for GNU packages;
 @item gnome
 the updater for GNOME packages;
+@item kde
+the updater for KDE packages;
 @item xorg
 the updater for X.org packages;
 @item elpa
diff --git a/guix/download.scm b/guix/download.scm
index 660ade5619..f1422bebc0 100644
--- a/guix/download.scm
+++ b/guix/download.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2013, 2014, 2015 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2015 Federico Beffa <beffa@fbengineering.ch>
 ;;; Copyright © 2016 Alex Griffin <a@ajgrf.com>
+;;; Copyright © 2016 David Craven <david@craven.ch>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
diff --git a/guix/gnu-maintenance.scm b/guix/gnu-maintenance.scm
index 0dd08bf535..20f08027da 100644
--- a/guix/gnu-maintenance.scm
+++ b/guix/gnu-maintenance.scm
@@ -59,6 +59,7 @@
 
             %gnu-updater
             %gnome-updater
+            %kde-updater
             %xorg-updater))
 
 ;;; Commentary:
@@ -500,6 +501,33 @@ elpa.gnu.org, and all the GNOME packages."
                        ;; checksums.
                        #:file->signature (const #f))))
 
+(define (kde-package? package)
+  "Return true if PACKAGE is a KDE package, developed by KDE.org."
+  (define kde-uri?
+    (match-lambda
+      ((? string? uri)
+       (string-prefix? "mirror://kde/" uri))
+      (_
+       #f)))
+
+  (match (package-source package)
+    ((? origin? origin)
+     (match (origin-uri origin)
+      ((? kde-uri?) #t)
+      (_             #f)))
+    (_ #f)))
+
+(define (latest-kde-release package)
+  "Return the latest release of PACKAGE, the name of an KDE.org package."
+  (let ((uri (string->uri (origin-uri (package-source package)))))
+    (false-if-ftp-error
+     (latest-ftp-release
+      (package-name package)
+      #:server "mirrors.mit.edu"
+      #:directory
+      (string-append "/kde" (dirname (dirname (uri-path uri))))
+      #:file->signature (const #f)))))
+
 (define (xorg-package? package)
   "Return true if PACKAGE is an X.org package, developed by X.org."
   (define xorg-uri?
@@ -540,6 +568,13 @@ elpa.gnu.org, and all the GNOME packages."
    (pred gnome-package?)
    (latest latest-gnome-release)))
 
+(define %kde-updater
+  (upstream-updater
+    (name 'kde)
+    (description "Updater for KDE packages")
+    (pred kde-package?)
+    (latest latest-kde-release)))
+
 (define %xorg-updater
   (upstream-updater
    (name 'xorg)
diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm
index 209f0d8be9..b00ac98c96 100644
--- a/guix/scripts/refresh.scm
+++ b/guix/scripts/refresh.scm
@@ -32,7 +32,10 @@
   #:use-module (guix scripts graph)
   #:use-module (guix monads)
   #:use-module ((guix gnu-maintenance)
-                #:select (%gnu-updater %gnome-updater %xorg-updater))
+                #:select (%gnu-updater
+                          %gnome-updater
+                          %kde-updater
+                          %xorg-updater))
   #:use-module (guix import elpa)
   #:use-module (guix import cran)
   #:use-module (guix import hackage)
@@ -195,6 +198,7 @@ unavailable optional dependencies such as Guile-JSON."
   ;; List of "updaters" used by default.  They are consulted in this order.
   (list-updaters %gnu-updater
                  %gnome-updater
+                 %kde-updater
                  %xorg-updater
                  %elpa-updater
                  %cran-updater