]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- fixed compilation with --disable-btrfs (gh#openSUSE/snapper#505) 607/head
authorArvin Schnell <aschnell@suse.de>
Thu, 3 Dec 2020 09:13:00 +0000 (10:13 +0100)
committerArvin Schnell <aschnell@suse.de>
Thu, 3 Dec 2020 09:13:00 +0000 (10:13 +0100)
client/cmd-cleanup.cc
configure.ac
package/snapper.changes
snapper/Snapper.cc
snapper/Snapshot.cc
testsuite-real/Makefile.am
testsuite/Makefile.am

index 20f09167999cb0c6ef883c0a813198c49fc02cfb..14dd8f7e8ea5060ca46af6462652df29343be5d2 100644 (file)
  */
 
 
+#include "config.h"
+
 #include <iostream>
 #include <boost/algorithm/string.hpp>
 
 #include <snapper/AppUtil.h>
+#ifdef ENABLE_BTRFS
 #include <snapper/BtrfsUtils.h>
+#endif
 #include <snapper/FileUtils.h>
 
 #include "utils/HumanString.h"
@@ -300,6 +304,8 @@ namespace snapper
        {
            vector<ProxySnapper*> affected_snappers;
 
+#ifdef ENABLE_BTRFS
+
            try
            {
                Uuid uuid = BtrfsUtils::get_uuid(path);
@@ -324,6 +330,8 @@ namespace snapper
                // free space is available.
            }
 
+#endif
+
            if (global_options.verbose())
            {
                cout << "affected configs:";
index f2345da7f48da939598896d4f0ec41894be2c658..a1deb18dd1d1b61fab66f876caa2ab3b0f0bc84f 100644 (file)
@@ -139,9 +139,14 @@ AC_ARG_ENABLE([rollback], AC_HELP_STRING([--disable-rollback],[Disable rollback
 AM_CONDITIONAL(ENABLE_ROLLBACK, [test "x$enable_rollback" = "xyes"])
 
 if test "x$enable_rollback" = "xyes"; then
+       if test "x$with_btrfs" != "xyes"; then
+               AC_MSG_ERROR([rollback support needs btrfs support])
+       fi
+
        AC_DEFINE(ENABLE_ROLLBACK, 1, [Enable rollback support])
-        # libmount is needed for rollback feature
-        AC_CHECK_HEADER(libmount/libmount.h,[],[AC_MSG_ERROR([Cannout find libmount headers. Please install libmount-devel])])
+
+       # libmount is needed for rollback feature
+       AC_CHECK_HEADER(libmount/libmount.h,[],[AC_MSG_ERROR([Cannout find libmount headers. Please install libmount-devel])])
 fi
 
 AC_ARG_ENABLE([btrfs-quota], AC_HELP_STRING([--disable-btrfs-quota],[Disable btrfs quota support]),
@@ -149,6 +154,10 @@ AC_ARG_ENABLE([btrfs-quota], AC_HELP_STRING([--disable-btrfs-quota],[Disable btr
 AM_CONDITIONAL(ENABLE_BTRFS_QUOTA, [test "x$enable_btrfs_quota" = "xyes"])
 
 if test "x$enable_btrfs_quota" = "xyes"; then
+       if test "x$with_btrfs" != "xyes"; then
+               AC_MSG_ERROR([btrfs quota support needs btrfs support])
+       fi
+
        AC_DEFINE(ENABLE_BTRFS_QUOTA, 1, [Enable btrfs quota support])
 fi
 
index c3c7a82322fd7412b3d61b6dc849895521c1364e..0bf1285d49a7bca1588aa23df792544db219ed92 100644 (file)
@@ -1,3 +1,8 @@
+-------------------------------------------------------------------
+Thu Dec 03 10:12:04 CET 2020 - aschnell@suse.com
+
+- fixed compilation with --disable-btrfs (gh#openSUSE/snapper#505)
+
 -------------------------------------------------------------------
 Tue Nov 24 11:58:44 CET 2020 - aschnell@suse.com
 
index a509880534e0ffdab988d13f3feef0f0fa112630..52e8661e7e8c615c1bd5e41a2d8af90fb445811d 100644 (file)
 #include "snapper/AsciiFile.h"
 #include "snapper/Exception.h"
 #include "snapper/Hooks.h"
+#ifdef ENABLE_BTRFS
 #include "snapper/Btrfs.h"
 #include "snapper/BtrfsUtils.h"
+#endif
 #ifdef ENABLE_SELINUX
 #include "snapper/Selinux.h"
 #endif
@@ -820,6 +822,8 @@ namespace snapper
     FreeSpaceData
     Snapper::queryFreeSpaceData() const
     {
+#ifdef ENABLE_BTRFS
+
        const Btrfs* btrfs = dynamic_cast<const Btrfs*>(getFilesystem());
        if (!btrfs)
            SN_THROW(FreeSpaceException("free space only supported with btrfs"));
@@ -837,6 +841,13 @@ namespace snapper
            SN_THROW(FreeSpaceException("impossible free space values"));
 
        return free_space_data;
+
+#else
+
+        SN_THROW(QuotaException("not implemented"));
+        __builtin_unreachable();
+
+#endif
     }
 
 
index 288bf26987a9dee22a81163b97749526353c853f..f63c5461b9ca7e4f4e5b821159bcb6e250ef9871 100644 (file)
@@ -38,7 +38,9 @@
 #include "snapper/AppUtil.h"
 #include "snapper/XmlFile.h"
 #include "snapper/Filesystem.h"
+#ifdef ENABLE_BTRFS
 #include "snapper/Btrfs.h"
+#endif
 #include "snapper/Enum.h"
 #include "snapper/SnapperTmpl.h"
 #include "snapper/SnapperDefines.h"
index 258e65f44835483a0145148be060eceaf26be018..717313a4373d65d51bea880b1e56b89c41cf9fd7 100644 (file)
@@ -8,18 +8,21 @@ AM_CPPFLAGS = -I$(top_srcdir)
 
 LDADD = ../snapper/libsnapper.la
 
-if HAVE_XATTRS
-TMP_XATST = xattrs1 xattrs2 xattrs3 xattrs4
-endif
-
 testdir = $(libdir)/snapper/testsuite
 
 test_DATA = CAUTION
 test_SCRIPTS = run-all setup-and-run-all
 
 test_PROGRAMS = simple1 permissions1 permissions2 permissions3 owner1 owner2 \
-       owner3 directory1 missing-directory1 error1 error2 error4 \
-       $(TMP_XATST) test-btrfsutils ug-tests
+       owner3 directory1 missing-directory1 error1 error2 error4 ug-tests
+
+if ENABLE_BTRFS
+test_PROGRAMS += test-btrfsutils
+endif
+
+if HAVE_XATTRS
+test_PROGRAMS += xattrs1 xattrs2 xattrs3 xattrs4
+endif
 
 simple1_SOURCES = simple1.cc common.h common.cc
 
index c8699f71eaef99b563c9eb3c28aefe4d1ba3be8a..d7e30b8a0c43be93e2b2640cc5ab6aa4f5cad4ac 100644 (file)
@@ -9,12 +9,16 @@ LDADD = ../snapper/libsnapper.la ../dbus/libdbus.la -lboost_unit_test_framework
 check_PROGRAMS = sysconfig-get1.test dirname1.test basename1.test              \
        equal-date.test dbus-escape.test cmp-lt.test humanstring.test           \
        table.test table-formatter.test csv-formatter.test json-formatter.test  \
-       getopts.test lvm-utils.test
+       getopts.test
 
 if ENABLE_BTRFS_QUOTA
 check_PROGRAMS += qgroup1.test
 endif
 
+if ENABLE_LVM
+check_PROGRAMS += lvm-utils.test
+endif
+
 TESTS = $(check_PROGRAMS)
 
 AM_DEFAULT_SOURCE_EXT = .cc