]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- show snapper and libsnapper versions 835/head
authorArvin Schnell <aschnell@suse.de>
Thu, 14 Sep 2023 14:47:17 +0000 (16:47 +0200)
committerArvin Schnell <aschnell@suse.de>
Thu, 14 Sep 2023 14:47:17 +0000 (16:47 +0200)
LIBVERSION
client/snapper.cc
configure.ac
snapper/Makefile.am
snapper/Snapper.cc
snapper/Version.cc [new file with mode: 0644]
snapper/Version.h.in

index a8a188756826dae72582b230aa315701fb096149..0ee843cc60466c722c3e7f2460f9761ad0e46b63 100644 (file)
@@ -1 +1 @@
-7.1.2
+7.2.0
index 3ddebe1e0bfdb581747983423894ce9e820e0b04..0f8e532a1574fd4063c1c664aff6e20529c0135c 100644 (file)
 
 #include "config.h"
 
-#include <stdlib.h>
-#include <string.h>
+#include <cstdlib>
+#include <cstring>
 #include <iostream>
 
 #include <snapper/Snapper.h>
 #include <snapper/SnapperTmpl.h>
 #include <snapper/Enum.h>
+#include <snapper/Version.h>
 
 #include "utils/text.h"
 #include "utils/Table.h"
@@ -178,6 +179,10 @@ main(int argc, char** argv)
        if (global_options.version())
        {
            cout << "snapper " << Snapper::compileVersion() << endl;
+           cout << "libsnapper " << LIBSNAPPER_VERSION_STRING;
+           if (strcmp(LIBSNAPPER_VERSION_STRING, get_libversion_string()) != 0)
+               cout << " (" << get_libversion_string() << ")";
+           cout << '\n';
            cout << "flags " << Snapper::compileFlags() << endl;
            exit(EXIT_SUCCESS);
        }
index 30be7b9c06dba850235d7e8f12dd209bb64d5a65..fbb0e103f1c869792a66140574f0956a89b5b009 100644 (file)
@@ -188,6 +188,7 @@ fi
 AC_CHECK_HEADER(acl/libacl.h,[],[AC_MSG_ERROR([Cannout find libacl headers. Please install libacl-devel])])
 
 AC_SUBST(VERSION)
+AC_SUBST(LIBVERSION)
 AC_SUBST(LIBVERSION_MAJOR)
 AC_SUBST(LIBVERSION_MINOR)
 AC_SUBST(LIBVERSION_PATCHLEVEL)
index 383b45eb8657779c0731f73b1db7be992b75a927..a03beceb176c396b80b3856f315fa6bfe73e2ef7 100644 (file)
@@ -31,7 +31,7 @@ libsnapper_la_SOURCES =                                       \
        SnapperTmpl.h                                   \
        SnapperTypes.h                                  \
        SnapperDefines.h                                \
-       Version.h
+       Version.cc              Version.h
 
 if ENABLE_BTRFS
 libsnapper_la_SOURCES +=                               \
index 9504b0507e7a31794f8aa58c03e414c699fc4b60..8375178e43a000a0bf4d97e633e9663b0b66a3f5 100644 (file)
@@ -48,6 +48,7 @@
 #include "snapper/Hooks.h"
 #include "snapper/ComparisonImpl.h"
 #include "snapper/Systemctl.h"
+#include "snapper/Version.h"
 #ifdef ENABLE_BTRFS
 #include "snapper/Btrfs.h"
 #include "snapper/BtrfsUtils.h"
@@ -94,7 +95,8 @@ namespace snapper
        : snapshots(this)
     {
        y2mil("Snapper constructor");
-       y2mil("libsnapper version " VERSION);
+       y2mil("snapper version " VERSION);
+       y2mil("libsnapper version " LIBSNAPPER_VERSION_STRING);
        y2mil("config_name:" << config_name << " root_prefix:" << root_prefix <<
              " disable_filters:" << disable_filters);
 
diff --git a/snapper/Version.cc b/snapper/Version.cc
new file mode 100644 (file)
index 0000000..cff47a0
--- /dev/null
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2023 SUSE LLC
+ *
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of version 2 of the GNU General Public License as published
+ * by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, contact Novell, Inc.
+ *
+ * To contact Novell about this file by physical or electronic mail, you may
+ * find current contact information at www.novell.com.
+ */
+
+
+#include "snapper/Version.h"
+
+
+namespace snapper
+{
+
+    const char*
+    get_libversion_string()
+    {
+       return LIBSNAPPER_VERSION_STRING;
+    }
+
+}
index b92b6c502a72ac177c35a0fe6bad082cd8965448..f7be4f270a667f2a1bfd6afb7f95fbb7374762a2 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2013 Novell, Inc.
+ * Copyright (c) 2023 SUSE LLC
  *
  * All Rights Reserved.
  *
 #define SNAPPER_VERSION_H
 
 
+#define LIBSNAPPER_VERSION_STRING "@LIBVERSION@"
+
 #define LIBSNAPPER_MAJOR "@LIBVERSION_MAJOR@"
 #define LIBSNAPPER_MINOR "@LIBVERSION_MINOR@"
 #define LIBSNAPPER_PATCHLEVEL "@LIBVERSION_PATCHLEVEL@"
 
-#define LIBSNAPPER_VERSION ( LIBSNAPPER_MAJOR * 10000 + \\
-                            LIBSNAPPER_MINOR * 100 + \\
-                            LIBSNAPPER_PATCHLEVEL )
+#define LIBSNAPPER_VERSION_AT_LEAST(major, minor)                                            \
+    ((LIBSNAPPER_VERSION_MAJOR > (major)) ||                                                 \
+     (LIBSNAPPER_VERSION_MAJOR == (major) && LIBSNAPPER_VERSION_MINOR >= (minor)))
+
+
+namespace snapper
+{
+
+    /**
+     * Return LIBSNAPPER_VERSION_STRING libsnapper was compiled with. May differ
+     * from the define (compile time vs. link time).
+     */
+    const char* get_libversion_string();
+
+}
 
 
 #endif