From: Arvin Schnell Date: Thu, 3 Dec 2020 09:13:00 +0000 (+0100) Subject: - fixed compilation with --disable-btrfs (gh#openSUSE/snapper#505) X-Git-Tag: v0.8.15~7^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d13fcd2fb38ca8f7096a8ec58cb0f14685845af4;p=thirdparty%2Fsnapper.git - fixed compilation with --disable-btrfs (gh#openSUSE/snapper#505) --- diff --git a/client/cmd-cleanup.cc b/client/cmd-cleanup.cc index 20f09167..14dd8f7e 100644 --- a/client/cmd-cleanup.cc +++ b/client/cmd-cleanup.cc @@ -21,11 +21,15 @@ */ +#include "config.h" + #include #include #include +#ifdef ENABLE_BTRFS #include +#endif #include #include "utils/HumanString.h" @@ -300,6 +304,8 @@ namespace snapper { vector 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:"; diff --git a/configure.ac b/configure.ac index f2345da7..a1deb18d 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/package/snapper.changes b/package/snapper.changes index c3c7a823..0bf1285d 100644 --- a/package/snapper.changes +++ b/package/snapper.changes @@ -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 diff --git a/snapper/Snapper.cc b/snapper/Snapper.cc index a5098805..52e8661e 100644 --- a/snapper/Snapper.cc +++ b/snapper/Snapper.cc @@ -46,8 +46,10 @@ #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(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 } diff --git a/snapper/Snapshot.cc b/snapper/Snapshot.cc index 288bf269..f63c5461 100644 --- a/snapper/Snapshot.cc +++ b/snapper/Snapshot.cc @@ -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" diff --git a/testsuite-real/Makefile.am b/testsuite-real/Makefile.am index 258e65f4..717313a4 100644 --- a/testsuite-real/Makefile.am +++ b/testsuite-real/Makefile.am @@ -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 diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index c8699f71..d7e30b8a 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -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