From 4c8306312767de49726b138af747363939b26bcc Mon Sep 17 00:00:00 2001 From: FollieHiyuki Date: Sun, 24 Jan 2021 23:13:06 +0300 Subject: [PATCH] snapper: update to 0.8.15 --- .../snapper/patches/0001-musl-sterror_r.patch | 26 --- .../snapper/patches/0002-musl-mktime.patch | 26 --- .../patches/0004-musl-stdout_stderr.patch | 26 --- .../backport_equal-date_testsuite.patch | 164 ++++++++++++++++++ srcpkgs/snapper/patches/musl_u_int-type.patch | 27 --- srcpkgs/snapper/template | 21 +-- 6 files changed, 173 insertions(+), 117 deletions(-) delete mode 100644 srcpkgs/snapper/patches/0001-musl-sterror_r.patch delete mode 100644 srcpkgs/snapper/patches/0002-musl-mktime.patch delete mode 100644 srcpkgs/snapper/patches/0004-musl-stdout_stderr.patch create mode 100644 srcpkgs/snapper/patches/backport_equal-date_testsuite.patch delete mode 100644 srcpkgs/snapper/patches/musl_u_int-type.patch diff --git a/srcpkgs/snapper/patches/0001-musl-sterror_r.patch b/srcpkgs/snapper/patches/0001-musl-sterror_r.patch deleted file mode 100644 index 3bd9be5872e..00000000000 --- a/srcpkgs/snapper/patches/0001-musl-sterror_r.patch +++ /dev/null @@ -1,26 +0,0 @@ -From a4068f03b471777151c4eb43fc70c3b6ebf8df3a Mon Sep 17 00:00:00 2001 -From: Nathan Owens -Date: Wed, 18 Dec 2019 18:23:38 -0600 -Subject: [PATCH 1/4] musl-sterror_r - -Signed-off-by: Nathan Owens ---- - snapper/AppUtil.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/snapper/AppUtil.cc b/snapper/AppUtil.cc -index 553065c..2897276 100644 ---- snapper/AppUtil.cc -+++ snapper/AppUtil.cc -@@ -223,7 +223,7 @@ namespace snapper - string - stringerror(int errnum) - { --#if (_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE -+#if (_POSIX_C_SOURCE >= 200112L) && ! _GNU_SOURCE || MUSL_LIBC - char buf1[100]; - if (strerror_r(errnum, buf1, sizeof(buf1) - 1) == 0) - return string(buf1); --- -2.24.1 - diff --git a/srcpkgs/snapper/patches/0002-musl-mktime.patch b/srcpkgs/snapper/patches/0002-musl-mktime.patch deleted file mode 100644 index 25850a519a3..00000000000 --- a/srcpkgs/snapper/patches/0002-musl-mktime.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 6385e34fb13dbfabd0b4b93f7670eac0c490637f Mon Sep 17 00:00:00 2001 -From: Nathan Owens -Date: Wed, 18 Dec 2019 18:24:08 -0600 -Subject: [PATCH 2/4] musl-mktime - -Signed-off-by: Nathan Owens ---- - snapper/AppUtil.cc | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/snapper/AppUtil.cc b/snapper/AppUtil.cc -index 2897276..64812d7 100644 ---- snapper/AppUtil.cc -+++ snapper/AppUtil.cc -@@ -288,7 +288,7 @@ namespace snapper - const char* p = strptime(str.c_str(), "%F %T", &s); - if (!p || *p != '\0') - return (time_t)(-1); -- return utc ? timegm(&s) : timelocal(&s); -+ return utc ? timegm(&s) : mktime(&s); - } - - --- -2.24.1 - diff --git a/srcpkgs/snapper/patches/0004-musl-stdout_stderr.patch b/srcpkgs/snapper/patches/0004-musl-stdout_stderr.patch deleted file mode 100644 index 0524aa1c0fb..00000000000 --- a/srcpkgs/snapper/patches/0004-musl-stdout_stderr.patch +++ /dev/null @@ -1,26 +0,0 @@ -From d519c3c94a029d6891b0703ce5adb6ea0ac8b9fa Mon Sep 17 00:00:00 2001 -From: Nathan Owens -Date: Wed, 18 Dec 2019 18:27:17 -0600 -Subject: [PATCH 4/4] musl-stdout_stderr - -Signed-off-by: Nathan Owens ---- - snapper/SystemCmd.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/snapper/SystemCmd.h b/snapper/SystemCmd.h -index 3d38604..72bbb2b 100644 ---- snapper/SystemCmd.h -+++ snapper/SystemCmd.h -@@ -32,6 +32,8 @@ - #include - #include - -+#undef stdout -+#undef stderr - - namespace snapper - { --- -2.24.1 - diff --git a/srcpkgs/snapper/patches/backport_equal-date_testsuite.patch b/srcpkgs/snapper/patches/backport_equal-date_testsuite.patch new file mode 100644 index 00000000000..b8c967d8632 --- /dev/null +++ b/srcpkgs/snapper/patches/backport_equal-date_testsuite.patch @@ -0,0 +1,164 @@ +diff --git package/snapper.changes package/snapper.changes +index 9235de3..5570cf1 100644 +--- package/snapper.changes ++++ package/snapper.changes +@@ -1,3 +1,8 @@ ++------------------------------------------------------------------- ++Mon Jan 25 11:29:45 CET 2021 - aschnell@suse.com ++ ++- fixed testsuite for equal-date (gh#openSUSE/snapper#526) ++ + ------------------------------------------------------------------- + Thu Dec 17 12:20:59 CET 2020 - aschnell@suse.com + +diff --git testsuite/Makefile.am testsuite/Makefile.am +index d7e30b8..cfd1002 100644 +--- testsuite/Makefile.am ++++ testsuite/Makefile.am +@@ -9,7 +9,7 @@ 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 ++ getopts.test scan-datetime.test + + if ENABLE_BTRFS_QUOTA + check_PROGRAMS += qgroup1.test +@@ -27,6 +27,8 @@ EXTRA_DIST = $(noinst_SCRIPTS) sysconfig-get1.txt sysconfig-set1.txt + + equal_date_test_LDADD = -lboost_unit_test_framework ../client/utils/libutils.la + ++scan_datetime_test_LDADD = -lboost_unit_test_framework ../client/utils/libutils.la ++ + humanstring_test_LDADD = -lboost_unit_test_framework ../client/utils/libutils.la + + table_test_LDADD = -lboost_unit_test_framework ../client/utils/libutils.la +diff --git testsuite/equal-date.cc testsuite/equal-date.cc +index 42e00d8..8d8eda8 100644 +--- testsuite/equal-date.cc ++++ testsuite/equal-date.cc +@@ -5,18 +5,25 @@ + #include + + #include "../client/utils/equal-date.h" ++#include "../snapper/AppUtil.h" ++ ++using namespace snapper; + + + bool + equal_week(const char* s1, const char* s2) + { ++ // use interim time_t since strptime on musl does not set tm_yday ++ ++ time_t t1 = scan_datetime(s1, true); + struct tm tmp1; + memset(&tmp1, 0, sizeof(tmp1)); +- strptime(s1, "%Y-%m-%d", &tmp1); ++ gmtime_r(&t1, &tmp1); + ++ time_t t2 = scan_datetime(s2, true); + struct tm tmp2; + memset(&tmp2, 0, sizeof(tmp2)); +- strptime(s2, "%Y-%m-%d", &tmp2); ++ gmtime_r(&t2, &tmp2); + + return equal_week(tmp1, tmp2); + } +@@ -25,46 +32,46 @@ equal_week(const char* s1, const char* s2) + BOOST_AUTO_TEST_CASE(test1) + { + // 2012 is a leap year +- BOOST_CHECK(equal_week("2011-12-31", "2012-01-01")); +- BOOST_CHECK(equal_week("2012-01-01", "2011-12-31")); ++ BOOST_CHECK(equal_week("2011-12-31 00:00:00", "2012-01-01 00:00:00")); ++ BOOST_CHECK(equal_week("2012-01-01 00:00:00", "2011-12-31 00:00:00")); + } + + + BOOST_AUTO_TEST_CASE(test2) + { + // 2012 is a leap year +- BOOST_CHECK(equal_week("2012-12-31", "2013-01-01")); +- BOOST_CHECK(equal_week("2013-01-01", "2012-12-31")); ++ BOOST_CHECK(equal_week("2012-12-31 00:00:00", "2013-01-01 00:00:00")); ++ BOOST_CHECK(equal_week("2013-01-01 00:00:00", "2012-12-31 00:00:00")); + } + + + BOOST_AUTO_TEST_CASE(test3) + { + // Saturday and Sunday +- BOOST_CHECK(equal_week("2014-01-04", "2014-01-05")); +- BOOST_CHECK(equal_week("2014-01-05", "2014-01-04")); ++ BOOST_CHECK(equal_week("2014-01-04 00:00:00", "2014-01-05 00:00:00")); ++ BOOST_CHECK(equal_week("2014-01-05 00:00:00", "2014-01-04 00:00:00")); + + // Sunday and Monday +- BOOST_CHECK(!equal_week("2014-01-05", "2014-01-06")); +- BOOST_CHECK(!equal_week("2014-01-06", "2014-01-05")); ++ BOOST_CHECK(!equal_week("2014-01-05 00:00:00", "2014-01-06 00:00:00")); ++ BOOST_CHECK(!equal_week("2014-01-06 00:00:00", "2014-01-05 00:00:00")); + + // Monday and Tuesday +- BOOST_CHECK(equal_week("2014-01-06", "2014-01-07")); +- BOOST_CHECK(equal_week("2014-01-07", "2014-01-06")); ++ BOOST_CHECK(equal_week("2014-01-06 00:00:00", "2014-01-07 00:00:00")); ++ BOOST_CHECK(equal_week("2014-01-07 00:00:00", "2014-01-06 00:00:00")); + } + + + BOOST_AUTO_TEST_CASE(test4) + { + // 2014-12-31 is a Wednesday, 2015-01-01 is a Thursday +- BOOST_CHECK(equal_week("2014-12-31", "2015-01-01")); +- BOOST_CHECK(equal_week("2015-01-01", "2014-12-31")); ++ BOOST_CHECK(equal_week("2014-12-31 00:00:00", "2015-01-01 00:00:00")); ++ BOOST_CHECK(equal_week("2015-01-01 00:00:00", "2014-12-31 00:00:00")); + } + + + BOOST_AUTO_TEST_CASE(test5) + { + // 2017-12-31 is a Sunday, 2018-01-01 is a Monday +- BOOST_CHECK(!equal_week("2017-12-31", "2018-01-01")); +- BOOST_CHECK(!equal_week("2018-01-01", "2017-12-31")); ++ BOOST_CHECK(!equal_week("2017-12-31 00:00:00", "2018-01-01 00:00:00")); ++ BOOST_CHECK(!equal_week("2018-01-01 00:00:00", "2017-12-31 00:00:00")); + } +diff --git testsuite/scan-datetime.cc testsuite/scan-datetime.cc +new file mode 100644 +index 0000000..8f0d1c0 +--- /dev/null ++++ testsuite/scan-datetime.cc +@@ -0,0 +1,30 @@ ++ ++#define BOOST_TEST_DYN_LINK ++#define BOOST_TEST_MODULE snapper ++ ++#include ++ ++#include "../snapper/AppUtil.h" ++ ++using namespace snapper; ++ ++ ++BOOST_AUTO_TEST_CASE(test1) ++{ ++ time_t t1 = scan_datetime("2020-03-04 12:34:56", true); ++ ++ struct tm tmp1; ++ memset(&tmp1, 0, sizeof(tmp1)); ++ gmtime_r(&t1, &tmp1); ++ ++ BOOST_CHECK_EQUAL(tmp1.tm_year, 2020 - 1900); ++ BOOST_CHECK_EQUAL(tmp1.tm_mon, 3 - 1); ++ BOOST_CHECK_EQUAL(tmp1.tm_mday, 4); ++ ++ BOOST_CHECK_EQUAL(tmp1.tm_yday, 31 + 28 + 4); ++ BOOST_CHECK_EQUAL(tmp1.tm_wday, 3); ++ ++ BOOST_CHECK_EQUAL(tmp1.tm_hour, 12); ++ BOOST_CHECK_EQUAL(tmp1.tm_min, 34); ++ BOOST_CHECK_EQUAL(tmp1.tm_sec, 56); ++} diff --git a/srcpkgs/snapper/patches/musl_u_int-type.patch b/srcpkgs/snapper/patches/musl_u_int-type.patch deleted file mode 100644 index 66cb63b2f12..00000000000 --- a/srcpkgs/snapper/patches/musl_u_int-type.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 7ddd58ee5e6b7c3a8df3086ff5a6d17d19362761 Mon Sep 17 00:00:00 2001 -From: Nathan Owens -Date: Wed, 18 Dec 2019 18:35:55 -0600 -Subject: [PATCH] musl-_u_int-types - -Signed-off-by: Nathan Owens ---- - client/utils/JsonFormatter.h | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git client/utils/JsonFormatter.h client/utils/JsonFormatter.h -index 79f7672..501b77d 100644 ---- client/utils/JsonFormatter.h -+++ client/utils/JsonFormatter.h -@@ -25,6 +25,9 @@ - #include - #include - #include -+#ifndef __GLIBC__ -+#include -+#endif - - namespace snapper - { --- -2.24.1 - diff --git a/srcpkgs/snapper/template b/srcpkgs/snapper/template index 292cfed6a19..83811bf6b2c 100644 --- a/srcpkgs/snapper/template +++ b/srcpkgs/snapper/template @@ -1,31 +1,30 @@ # Template file for 'snapper' pkgname=snapper -version=0.8.14 -revision=2 +version=0.8.15 +revision=1 build_style=gnu-configure -configure_args="--disable-zypp --with-conf=/etc/conf.d" +configure_args="--disable-zypp --disable-systemd --with-conf=/etc/conf.d" conf_files="/etc/conf.d/snapper" make_dirs="/etc/snapper/configs 0755 root root" hostmakedepends="automake docbook-xsl libtool libxml2-devel libxslt gettext pkg-config" makedepends="acl-devel boost-devel dbus-devel e2fsprogs-devel libbtrfs-devel - libmount-devel libxml2-devel pam-devel" + libmount-devel libxml2-devel pam-devel ncurses-devel ncurses-libtinfo-devel + json-c-devel" depends="dbus" short_desc="Tool for Linux filesystem snapshot management" maintainer="Orphaned " license="GPL-2.0-only" homepage="http://snapper.io" distfiles="https://github.com/openSUSE/snapper/archive/v${version}.tar.gz" -checksum=d3abe4d542dade06b361e7c89b5de03bb5202853bc5e314ca74080caa24923f6 +checksum=fe0e32912275713f8fad17dbe510f32dbba8526365a849e3f7d6c786d43cfca2 lib32disabled=yes +LDFLAGS="-ljson-c" case "$XBPS_TARGET_MACHINE" in - *-musl) # We define MUSL_LIBC to pick the correct return type - # for strerror_r(2) which is int (XSI-compliant) - CXXFLAGS="-DMUSL_LIBC=1" - # We also link against libintl + *-musl) makedepends+=" gettext-devel" - LDFLAGS="-lintl" + LDFLAGS+=" -lintl" esac pre_configure() { @@ -43,8 +42,6 @@ pre_configure() { post_install() { vinstall data/sysconfig.snapper 644 etc/conf.d snapper vsv snapperd - - rm -rf -- "${DESTDIR}"/usr/lib/systemd } libsnapper_package() {