The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/go-lxc/pull/89

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
liblxc will now append "-devel" (e.g. 2.1.0-devel") when LXC_DEVEL is true.
From a semantic versioning perspective liblxc is doing a saner thing than go-lxc
with appending "-devel" instead of " (devel)" but we shouldn't break existing
user. They might already rely on " (devel)" so let's keep it.

Signed-off-by: Christian Brauner <[email protected]>
From cbff440cf19ed6a5cc9c512d3b48c789cb9a9320 Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Thu, 12 Oct 2017 15:00:10 +0200
Subject: [PATCH] bindings: adapt to new liblxc version output

liblxc will now append "-devel" (e.g. 2.1.0-devel") when LXC_DEVEL is true.
From a semantic versioning perspective liblxc is doing a saner thing than go-lxc
with appending "-devel" instead of " (devel)" but we shouldn't break existing
user. They might already rely on " (devel)" so let's keep it.

Signed-off-by: Christian Brauner <[email protected]>
---
 lxc-binding.go | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lxc-binding.go b/lxc-binding.go
index dbb9689..29aaf80 100644
--- a/lxc-binding.go
+++ b/lxc-binding.go
@@ -64,9 +64,14 @@ func Release(c *Container) bool {
 // Version returns the LXC version.
 func Version() string {
        version := C.GoString(C.lxc_get_version())
-       if C.LXC_DEVEL == 1 {
+
+       // New liblxc versions append "-devel" when LXC_DEVEL is set.
+       if strings.HasSuffix(version, "-devel") {
+               return fmt.Sprintf("%s (devel)", version[:(len(version) - 
len("-devel"))])
+       } else if C.LXC_DEVEL == 1 {
                version = fmt.Sprintf("%s (devel)", version)
        }
+
        return version
 }
 
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to