* [PATCH v2 1/1] Factor out a common pattern into a procedure.
2014-10-19 22:06 [PATCH v2 0/1] Factor out a common pattern into a procedure Ian Denhardt
@ 2014-10-19 2:03 ` Ian Denhardt
2014-10-20 13:34 ` Ludovic Courtès
0 siblings, 1 reply; 4+ messages in thread
From: Ian Denhardt @ 2014-10-19 2:03 UTC (permalink / raw)
To: guix-devel
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 13278 bytes --]
The procedure version-prefix truncates a version string to a certain
number of components. version-major+minor is a special case of this,
which extracts the "major.minor" part of the string. Previously this
was handled by an expression common to several packages.
* guix/utils.scm (version-prefix, version-major+minor): New procedures
* gnu/packages/backup.scm (duplicity): Use version-major+minor.
* gnu/packages/cmake.scm (cmake): Likewise.
* gnu/packages/gnome.scm (libbonobo, libbonoboui): Likewise.
* gnu/packages/gnutls.scm (gnutls): Likewise.
* gnu/packages/mail.scm (gmime): Likewise.
* gnu/packages/mpd.scm (mpd): Likewise.
* gnu/packages/mpi.scm (openmpi): Likewise.
---
gnu/packages/backup.scm | 7 ++++---
gnu/packages/cmake.scm | 11 +++++------
gnu/packages/gnome.scm | 10 +++++-----
gnu/packages/gnutls.scm | 8 ++++----
gnu/packages/mail.scm | 9 ++++-----
gnu/packages/mpd.scm | 6 +++---
gnu/packages/mpi.scm | 8 ++++----
guix/utils.scm | 14 ++++++++++++++
8 files changed, 43 insertions(+), 30 deletions(-)
diff --git a/gnu/packages/backup.scm b/gnu/packages/backup.scm
index 1aef75e..a634c94 100644
--- a/gnu/packages/backup.scm
+++ b/gnu/packages/backup.scm
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,6 +21,7 @@
#:use-module (guix packages)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix download)
+ #:use-module (guix utils)
#:use-module (guix build utils)
#:use-module (guix build-system gnu)
#:use-module (guix build-system python)
@@ -38,8 +40,7 @@
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages rsync)
#:use-module (gnu packages ssh)
- #:use-module (gnu packages xml)
- #:use-module (srfi srfi-1))
+ #:use-module (gnu packages xml))
(define-public duplicity
(package
@@ -49,7 +50,7 @@
(origin
(method url-fetch)
(uri (string-append "https://code.launchpad.net/duplicity/"
- (string-join (take (string-split version #\.) 2) ".")
+ (version-major+minor version)
"-series/" version "/+download/duplicity-"
version ".tar.gz"))
(sha256
diff --git a/gnu/packages/cmake.scm b/gnu/packages/cmake.scm
index 2c20c73..63805ef 100644
--- a/gnu/packages/cmake.scm
+++ b/gnu/packages/cmake.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2013 Cyril Roelandt <tipecaml@gmail.com>
;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -22,14 +23,14 @@
#:use-module ((guix licenses) #:select (bsd-3))
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages backup)
#:use-module (gnu packages compression)
#:use-module (gnu packages curl)
#:use-module (gnu packages file)
- #:use-module (gnu packages xml)
- #:use-module (srfi srfi-1))
+ #:use-module (gnu packages xml))
(define-public cmake
(package
@@ -39,8 +40,7 @@
(method url-fetch)
(uri (string-append
"http://www.cmake.org/files/v"
- (string-join (take (string-split version #\.) 2)
- ".")
+ (version-major+minor version)
"/cmake-" version ".tar.gz"))
(sha256
(base32 "11q21vyrr6c6smyjy81k2k07zmn96ggjia9im9cxwvj0n88bm1fq"))
@@ -91,8 +91,7 @@
"--mandir=share/man"
,(string-append
"--docdir=share/doc/cmake-"
- (string-join (take (string-split version #\.) 2)
- "."))))))
+ (version-major+minor version))))))
%standard-phases)))))
(inputs
`(("file" ,file)
diff --git a/gnu/packages/gnome.scm b/gnu/packages/gnome.scm
index bbb3053..d497246 100644
--- a/gnu/packages/gnome.scm
+++ b/gnu/packages/gnome.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -21,6 +22,7 @@
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages bison)
@@ -42,8 +44,7 @@
#:use-module (gnu packages xml)
#:use-module (gnu packages gl)
#:use-module (gnu packages compression)
- #:use-module (gnu packages xorg)
- #:use-module (srfi srfi-1))
+ #:use-module (gnu packages xorg))
(define-public brasero
(package
@@ -706,8 +707,7 @@ featuring mature C, C++ and Python bindings.")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnome/sources/" name "/"
- (string-join (take (string-split version #\.) 2)
- ".")
+ (version-major+minor version)
"/" name "-" version ".tar.bz2"))
(sha256
(base32 "0swp4kk6x7hy1rvd1f9jba31lvfc6qvafkvbpg9h0r34fzrd8q4i"))
@@ -1077,7 +1077,7 @@ widgets built in the loading process.")
(method url-fetch)
(uri (string-append
"mirror://gnome/sources/" name "/"
- (string-join (take (string-split version #\.) 2) ".")
+ (version-major+minor version)
"/" name "-" version ".tar.bz2"))
(sha256
(base32
diff --git a/gnu/packages/gnutls.scm b/gnu/packages/gnutls.scm
index 3e4fa63..1660588 100644
--- a/gnu/packages/gnutls.scm
+++ b/gnu/packages/gnutls.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -21,6 +22,7 @@
#:use-module (guix licenses)
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module ((gnu packages compression) #:prefix guix:)
#:use-module (gnu packages)
@@ -29,8 +31,7 @@
#:use-module (gnu packages perl)
#:use-module (gnu packages which)
#:use-module (gnu packages texinfo)
- #:use-module (gnu packages pkg-config)
- #:use-module (srfi srfi-1))
+ #:use-module (gnu packages pkg-config))
(define-public libtasn1
(package
@@ -69,8 +70,7 @@ specifications.")
;; Note: Releases are no longer on ftp.gnu.org since the
;; schism (after version 3.1.5).
(string-append "mirror://gnupg/gnutls/v"
- (string-join (take (string-split version #\.) 2)
- ".")
+ (version-major+minor version)
"/gnutls-" version ".tar.xz"))
(sha256
(base32
diff --git a/gnu/packages/mail.scm b/gnu/packages/mail.scm
index 2a742cd..46c2409 100644
--- a/gnu/packages/mail.scm
+++ b/gnu/packages/mail.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
+;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -49,9 +50,9 @@
#:select (gpl2 gpl2+ gpl3+ lgpl2.1+ lgpl3+))
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix utils)
#:use-module (guix build-system gnu)
- #:use-module (guix build-system python)
- #:use-module (srfi srfi-1))
+ #:use-module (guix build-system python))
(define-public mailutils
(package
@@ -192,9 +193,7 @@ operating systems.")
(source (origin
(method url-fetch)
(uri (string-append "mirror://gnome/sources/gmime/"
- (string-join (take (string-split version #\.)
- 2)
- ".")
+ (version-major+minor version)
"/gmime-" version ".tar.xz"))
(sha256
(base32
diff --git a/gnu/packages/mpd.scm b/gnu/packages/mpd.scm
index 0accc5e..4aa313b 100644
--- a/gnu/packages/mpd.scm
+++ b/gnu/packages/mpd.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2014 David Thompson <dthompson2@worcester.edu>
;;; Copyright © 2014 Andreas Enge <andreas@enge.fr>
;;; Copyright © 2014 Cyrill Schenkel <cyrill.schenkel@gmail.com>
+;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -19,11 +20,11 @@
;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
(define-module (gnu packages mpd)
- #:use-module (srfi srfi-1)
#:use-module (gnu packages)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
+ #:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (gnu packages avahi)
#:use-module (gnu packages compression)
@@ -72,8 +73,7 @@ interfacing MPD in the C, C++ & Objective C languages.")
(method url-fetch)
(uri
(string-append "http://musicpd.org/download/mpd/"
- (string-join (take (string-split
- version #\.) 2) ".")
+ (version-major+minor version)
"/mpd-" version ".tar.gz"))
(sha256
(base32
diff --git a/gnu/packages/mpi.scm b/gnu/packages/mpi.scm
index e7919bc..a268239 100644
--- a/gnu/packages/mpi.scm
+++ b/gnu/packages/mpi.scm
@@ -1,6 +1,7 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
;;; Copyright © 2014 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -22,6 +23,7 @@
#:use-module ((guix licenses)
#:hide (expat))
#:use-module (guix download)
+ #:use-module (guix utils)
#:use-module (guix build-system gnu)
#:use-module (gnu packages)
#:use-module (gnu packages gcc)
@@ -32,8 +34,7 @@
#:use-module (gnu packages xml)
#:use-module (gnu packages ncurses)
#:use-module (gnu packages pkg-config)
- #:use-module (gnu packages valgrind)
- #:use-module (srfi srfi-1))
+ #:use-module (gnu packages valgrind))
(define-public hwloc
(package
@@ -88,8 +89,7 @@ bind processes, and much more.")
(origin
(method url-fetch)
(uri (string-append "http://www.open-mpi.org/software/ompi/v"
- (string-join (take (string-split version #\.) 2)
- ".")
+ (version-major+minor version)
"/downloads/openmpi-" version ".tar.bz2"))
(sha256
(base32
diff --git a/guix/utils.scm b/guix/utils.scm
index 6392914..9b802b6 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -2,6 +2,7 @@
;;; Copyright © 2012, 2013, 2014 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2013 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
+;;; Copyright © 2014 Ian Denhardt <ian@zenhack.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -65,6 +66,8 @@
%current-target-system
version-compare
version>?
+ version-prefix
+ version-major+minor
guile-version>?
package-name->name+version
string-tokenize*
@@ -518,6 +521,17 @@ or '= when they denote equal versions."
((negative? result) '<)
(else '=))))))
+(define (version-prefix version-string num-parts)
+ "Truncate version-string to the first num-parts components of the version.
+For example, (version-prefix \"2.1.47.4.23\" 3) returns \"2.1.47\""
+ (string-join (take (string-split version-string #\.) num-parts) "."))
+
+
+(define (version-major+minor version-string)
+ "Return \"<major>.<minor>\", where major and minor are the major and
+minor version numbers from version-string."
+ (version-prefix version-string 2))
+
(define (version>? a b)
"Return #t when A denotes a newer version than B."
(eq? '> (version-compare a b)))
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 0/1] Factor out a common pattern into a procedure.
@ 2014-10-19 22:06 Ian Denhardt
2014-10-19 2:03 ` [PATCH v2 1/1] " Ian Denhardt
0 siblings, 1 reply; 4+ messages in thread
From: Ian Denhardt @ 2014-10-19 22:06 UTC (permalink / raw)
To: guix-devel
Updated according to feedback from John, Ludo, and Mark.
-Ian
Ian Denhardt (1):
Factor out a common pattern into a procedure.
gnu/packages/backup.scm | 7 ++++---
gnu/packages/cmake.scm | 11 +++++------
gnu/packages/gnome.scm | 10 +++++-----
gnu/packages/gnutls.scm | 8 ++++----
gnu/packages/mail.scm | 9 ++++-----
gnu/packages/mpd.scm | 6 +++---
gnu/packages/mpi.scm | 8 ++++----
guix/utils.scm | 14 ++++++++++++++
8 files changed, 43 insertions(+), 30 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] Factor out a common pattern into a procedure.
2014-10-19 2:03 ` [PATCH v2 1/1] " Ian Denhardt
@ 2014-10-20 13:34 ` Ludovic Courtès
2014-10-20 18:47 ` Ian Denhardt
0 siblings, 1 reply; 4+ messages in thread
From: Ludovic Courtès @ 2014-10-20 13:34 UTC (permalink / raw)
To: Ian Denhardt; +Cc: guix-devel
Ian Denhardt <ian@zenhack.net> skribis:
> The procedure version-prefix truncates a version string to a certain
> number of components. version-major+minor is a special case of this,
> which extracts the "major.minor" part of the string. Previously this
> was handled by an expression common to several packages.
>
> * guix/utils.scm (version-prefix, version-major+minor): New procedures
> * gnu/packages/backup.scm (duplicity): Use version-major+minor.
> * gnu/packages/cmake.scm (cmake): Likewise.
> * gnu/packages/gnome.scm (libbonobo, libbonoboui): Likewise.
> * gnu/packages/gnutls.scm (gnutls): Likewise.
> * gnu/packages/mail.scm (gmime): Likewise.
> * gnu/packages/mpd.scm (mpd): Likewise.
> * gnu/packages/mpi.scm (openmpi): Likewise.
Thanks, pushed! I’ve made the subject line more explicit.
Also, note that the paragraph above isn’t strictly necessary because
these procedures have docstrings anyway.
Ludo’.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/1] Factor out a common pattern into a procedure.
2014-10-20 13:34 ` Ludovic Courtès
@ 2014-10-20 18:47 ` Ian Denhardt
0 siblings, 0 replies; 4+ messages in thread
From: Ian Denhardt @ 2014-10-20 18:47 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
Quoting Ludovic Courtès (2014-10-20 09:34:34)
> Ian Denhardt <ian@zenhack.net> skribis:
> Thanks, pushed! I’ve made the subject line more explicit.
You're welcome, and thank you! I agree your subject line is better.
> Also, note that the paragraph above isn’t strictly necessary because
> these procedures have docstrings anyway.
Yeah, I know -- but it seems sensible to have a "this is what this patch
is all about" right upfront. Actually, most (all?) of the commits in the
repo have a fair amount of information that's obvious from the diff -- I
see lots of `foo/bar/baz.scm: New file`, for example.
-Ian
[-- Attachment #2: signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2
iQIcBAABAgAGBQJURViqAAoJEPZUuMfUyjy4S2UP/Am7VjuEXAhe/spoOBGrRedr
BbNjvnDVCKFAAXOGFZwq6ez50/qG/ignugyOab6iAUtUdSKomsJcGu7ch2qLe2Ph
EvyKkIjtTG5YEgOLzDgzJ1bdU4HUPRsUgpksVzhCRY0ObtcpyJQt4S4dnyIZEHte
grg69QskXwaV2v2FbaTxN6ZGFkCReS8kmof9G1BWWh4ruE1iutVyPBfjsgzDoQ2/
PB5KiBtD961HZLNN+B66cxxkigTumz2qJThB8SF75rek8wfVhFvVN1DN/z7YGdNu
qTpmrsON4T1hQ5am6gv55C1kI2rpdEWjCjhkrQunkYFkxiu7ilksJUdhHkgKZksa
kQMOBcLTP9PPJfMxm2fZz6j9vGTeU2zZy2kJkDuZ4186A18zOvSp0h84fqi8Xm1y
qhQbOWBbcLaJXDSD0OhqItGRyQGGoFG5SG4k7VVW8Wwk6JxOBcZZd06C8nfrO7U8
OAPF9LGYx0Is5arOYNAIFsDW2wH9ySWK6ijwjroQ7Trh3+kp2F0amB/HIo3OvpBG
KSB+tD1ezg408LcdakdWq6ZIlz+GimoJAzhk0JG6N1NCjmTFWhSfKF/4OTdIMSks
bmHJGKekyGph5h0sOGpMTt+q9b/W0yJIJ7KbAjbP+XVpbSBsA8dRo+jihodBhP0w
/uhAxxXcajrjMEnd3jtU
=DV3k
-----END PGP SIGNATURE-----
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-10-20 18:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-19 22:06 [PATCH v2 0/1] Factor out a common pattern into a procedure Ian Denhardt
2014-10-19 2:03 ` [PATCH v2 1/1] " Ian Denhardt
2014-10-20 13:34 ` Ludovic Courtès
2014-10-20 18:47 ` Ian Denhardt
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.