unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#42847] [PATCH] utils: Add version-major+minor+point.
@ 2020-08-13 11:48 Efraim Flashner
  2020-08-13 12:25 ` Jonathan Brielmaier
  2020-08-17  4:58 ` bug#42847: " Efraim Flashner
  0 siblings, 2 replies; 4+ messages in thread
From: Efraim Flashner @ 2020-08-13 11:48 UTC (permalink / raw)
  To: 42847; +Cc: Efraim Flashner

* guix/utils.scm (version-major+minor+point): New procedure.
---
 guix/utils.scm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/guix/utils.scm b/guix/utils.scm
index 436c5cd093..2f698b0bb0 100644
--- a/guix/utils.scm
+++ b/guix/utils.scm
@@ -7,6 +7,7 @@
 ;;; Copyright © 2015 David Thompson <davet@gnu.org>
 ;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
 ;;; Copyright © 2018, 2020 Marius Bakke <marius@gnu.org>
+;;; Copyright © 2020 Efraim Flashner <efraim@flashner.co.il>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -82,6 +83,7 @@
             version>?
             version>=?
             version-prefix
+            version-major+minor+point
             version-major+minor
             version-major
             guile-version>?
@@ -564,6 +566,15 @@ or '= when they denote equal versions."
 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+point version-string)
+  "Return \"major>.<minor>.<point>\", where major, minor and point are the
+major, minor and point version numbers from the version-string.  For example,
+(version-major+minor+point \"6.4.5.2\") returns \"5.4.5\" or
+(version-major+minor+point \"1.19.2-2581-324ca14c3003\") returns \"1.19.2\"."
+  (let* ((3-dot (version-prefix version-string 3))
+         (index (string-index 3-dot #\-)))
+    (or (false-if-exception (substring 3-dot 0 index))
+        3-dot)))
 
 (define (version-major+minor version-string)
   "Return \"<major>.<minor>\", where major and minor are the major and
-- 
2.28.0





^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [bug#42847] [PATCH] utils: Add version-major+minor+point.
  2020-08-13 11:48 [bug#42847] [PATCH] utils: Add version-major+minor+point Efraim Flashner
@ 2020-08-13 12:25 ` Jonathan Brielmaier
  2020-08-13 16:16   ` Efraim Flashner
  2020-08-17  4:58 ` bug#42847: " Efraim Flashner
  1 sibling, 1 reply; 4+ messages in thread
From: Jonathan Brielmaier @ 2020-08-13 12:25 UTC (permalink / raw)
  To: 42847

On 13.08.20 13:48, Efraim Flashner wrote:
> +(version-major+minor+point \"6.4.5.2\") returns \"5.4.5\" or
                                                     ^ I guess that is
an typo and should be a 6




^ permalink raw reply	[flat|nested] 4+ messages in thread

* [bug#42847] [PATCH] utils: Add version-major+minor+point.
  2020-08-13 12:25 ` Jonathan Brielmaier
@ 2020-08-13 16:16   ` Efraim Flashner
  0 siblings, 0 replies; 4+ messages in thread
From: Efraim Flashner @ 2020-08-13 16:16 UTC (permalink / raw)
  To: Jonathan Brielmaier; +Cc: 42847

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

On Thu, Aug 13, 2020 at 02:25:55PM +0200, Jonathan Brielmaier wrote:
> On 13.08.20 13:48, Efraim Flashner wrote:
> > +(version-major+minor+point \"6.4.5.2\") returns \"5.4.5\" or
>                                                      ^ I guess that is
> an typo and should be a 6
> 

Definitely a typo. I fixed it locally in my patch file.

-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#42847: [PATCH] utils: Add version-major+minor+point.
  2020-08-13 11:48 [bug#42847] [PATCH] utils: Add version-major+minor+point Efraim Flashner
  2020-08-13 12:25 ` Jonathan Brielmaier
@ 2020-08-17  4:58 ` Efraim Flashner
  1 sibling, 0 replies; 4+ messages in thread
From: Efraim Flashner @ 2020-08-17  4:58 UTC (permalink / raw)
  To: 42847-done

[-- Attachment #1: Type: text/plain, Size: 229 bytes --]

Patch pushed


-- 
Efraim Flashner   <efraim@flashner.co.il>   אפרים פלשנר
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-08-17  4:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 11:48 [bug#42847] [PATCH] utils: Add version-major+minor+point Efraim Flashner
2020-08-13 12:25 ` Jonathan Brielmaier
2020-08-13 16:16   ` Efraim Flashner
2020-08-17  4:58 ` bug#42847: " Efraim Flashner

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).