~alpine/aports

[alpine-aports] [PATCH] testing/snapper: config and musl fixes

Details
Message ID
<VI1PR02MB4784346E026C72BD6ABE1900B2640@VI1PR02MB4784.eurprd02.prod.outlook.com>
Sender timestamp
1549890476
DKIM signature
missing
Download raw message
Patch: +76 -19
Add dbus as dependency.
Readd dbus config files in remove-systemd.patch.
Fix conjob paths in scripts/Makefile.am.
Install data/sysconfig.snapper to /etc/conf.d/snapper.
Disable ext4 support, because it is experimental and not support with standard kernel and tools.
Fix regex (because the '?' operator isn't supported).
Fix strptime in snapper/AppUtil.cc, because musl doesn't support '%F'.
---
 testing/snapper/APKBUILD             | 20 +++++++----
 testing/snapper/musl-mktime.patch    | 12 ++++---
 testing/snapper/regex.patch          | 50 ++++++++++++++++++++++++++++
 testing/snapper/remove-systemd.patch | 13 +++-----
 4 files changed, 76 insertions(+), 19 deletions(-)
 create mode 100644 testing/snapper/regex.patch

diff --git a/testing/snapper/APKBUILD b/testing/snapper/APKBUILD
index dbd58e2f4d..3f50e05178 100644
--- a/testing/snapper/APKBUILD
+++ b/testing/snapper/APKBUILD
@@ -2,13 +2,14 @@
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=snapper
pkgver=0.8.2
pkgrel=0
pkgrel=1
pkgdesc="Manage filesystem snapshots and allow undo of system modifications"
url="https://snapper.io"
arch="all !armhf !armv7"  # armhf: fails to build
license="GPL-2.0"
# 3 tests are failing
options="!check"
depends="dbus"
makedepends="automake autoconf libtool bash
	btrfs-progs-dev e2fsprogs-dev dbus-dev acl-dev 
	lvm2-dev libxml2-dev boost-dev bsd-compat-headers
@@ -25,7 +26,8 @@ source="$pkgname-$pkgver.tar.gz::https://github.com/openSUSE/snapper/archive/v$p
	musl-boost.patch
	remove-systemd.patch
	fix-poll_h.patch
	musl-dbus.patch"
	musl-dbus.patch
	regex.patch"

builddir="$srcdir/$pkgname-$pkgver"

@@ -34,6 +36,8 @@ prepare() {
	autoreconf -fi
	# rename cron scripts
	sed -i -e 's@suse.de-@@g' scripts/Makefile.am
	# copy cron scripts to /etc/periodic/* instead of /etc/cron.*
	sed -i -e 's/cron\./periodic\//g' scripts/Makefile.am
	# fix config location in cron scripts
	sed -i -e 's@/etc/sysconfig/@/etc/conf.d/@g' scripts/snapper-daily
	sed -i -e 's@/etc/sysconfig/@/etc/conf.d/@g' scripts/snapper-hourly
@@ -50,7 +54,8 @@ build() {
		--disable-silent-rules \
		--with-conf=/etc/conf.d \
		--disable-pam \
		--disable-zypp
		--disable-zypp \
		--disable-ext4
	make
}

@@ -62,17 +67,20 @@ check() {
package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install

	install -Dm644 data/sysconfig.snapper "$pkgdir"/etc/conf.d/$pkgname
}

sha512sums="53e801e5e3c939a63833fab143c665e2289e128004dd67dcc98826b994d2150b268af021505b0f98982d66ea520a2d98279da15a904a003f2a0a1f1fac80124f  snapper-0.8.2.tar.gz
a9eec8105e94c4eb097aa293754b0de45420a297ad845933a7be66b3ff49af409dd427e9bd1de569c49982c619211d1e90183ed8bf8550acb0fa9d83176e22bf  musl-posix.patch
ddcd279f77007fe905df27b904dc84c8c2eebf0cf42c9f992fdc992e2912ddaab59712c13a798243c4f81727c04ef8e0993773686ab0c682e41726a2bcad962b  musl-mode_t.patch
57479b51c821f880c2fc6d50ac59a3f9c2dc49a1da509e643a4e3f93491fb50220b97cacf0c09943b5b3b9cce531a3d5d11b8d0d146aa06ef21c1acb139cb193  musl-mktime.patch
f2581e1b5f05a43daea77b27b0c383d4f201bffb485ef1af9e6fcbe26e8dfa44bab36c23ca2d8ea7963fba0c3507d014bdbf1bc0c582c790b9e627fc97b62820  musl-mktime.patch
ed393b476a679ebc8f130e34826958a30aa98dc7ac77c0c324a486cc3ed8539584552a305e2ddcb810626c6ab3478e634c77762395e2560abc935cd18e882beb  musl-stdout_stderr.patch
d5305df362df7db3b882cb491d32d11f479d1d56b21a39bc5e0cbdf7cdf70341eb566e7374bb9acc6d4fa1db027d4f009857fed21ef48ed311efaaa1be7b6329  musl-_nl_msg_cat_cntr.patch
8278c469def65e58cb2aee039882d1d237b4b404386472f9540da11a1d3cddd60dda08a99074f9f418b328ce2c4ac73d3190a74a6fe3e00eab9adb4fed87a4ec  musl-__isleap.patch
8bc2b42bbee927ce88f77e71a9594da3b6e54e92008e5603c6d8db35b3ec37add456bcc52d7d6a913c69a395c73bd3f6a3934ea549d4cc0097cb65613f61ed48  musl-types.patch
a0c25dc1cc7ec1cc512f41302ecd293b2207902a79b9d2ee3b92585d1aab554f5c0546add8fb12ad3b5936636f3a86516287ac1667122c6045f5ef33fcbfc14b  musl-boost.patch
719c0dbc8c9c008928a496184a7d22d08afd25ababede62d73bf4df09d32e3f1ca92cab4437d73b183f9faefdfeeab69ec324ed4d3d0ce6c7647d85ef8bfb653  remove-systemd.patch
61401ac8e91b838231e018490af61e7fe8c954750eaff4a9ff4e435aea78531cfa2882e354cb088a3a43951d869bdf7c516969a437195362f700e655878bcd71  remove-systemd.patch
2730b5d3d627e5d6140df1509a4676e4a8429f73a12804b88f0ef7dab46097f35ac209f3456bb0094a09843ebb810887a6392c3a6a308d27f43f2ea9621e586d  fix-poll_h.patch
11627af9713013dfc4cbdca5a5be644cd49fe205edcaa6eaf64507903edd241f262e40e97a091b0f8ee3b495fe2c8fb904e4dbcc0e4e5bfabcc16c66654f561b  musl-dbus.patch"
11627af9713013dfc4cbdca5a5be644cd49fe205edcaa6eaf64507903edd241f262e40e97a091b0f8ee3b495fe2c8fb904e4dbcc0e4e5bfabcc16c66654f561b  musl-dbus.patch
6f70b20b1fdc4e935deaef9bc8978068041732e5296d0c9924cbd09f1b3bd0a46e4579f6b3542d7e1f17081dd88960cad7d19e56420f8d91ba906fa1f19f4842  regex.patch"
diff --git a/testing/snapper/musl-mktime.patch b/testing/snapper/musl-mktime.patch
index 48fbc0802e..22cbff4888 100644
--- a/testing/snapper/musl-mktime.patch
+++ b/testing/snapper/musl-mktime.patch
@@ -2,10 +2,14 @@ According to http://ftp.gnu.org/old-gnu/Manuals/glibc-2.2.3/html_chapter/libc_21
timelocal(2) is functionally identical to mktime(2), but more
mnemonically named. There is no timelocal(2) defined in musl libc.

--- a/snapper/AppUtil.cc	2015-02-18 18:54:03.000000000 +0100
+++ b/snapper/AppUtil.cc	2015-08-30 10:39:31.318158599 +0200
@@ -274,7 +274,7 @@
 	const char* p = strptime(str.c_str(), "%F %T", &s);
--- a/snapper/AppUtil.cc
+++ b/snapper/AppUtil.cc
@@ -279,10 +279,10 @@
     {
 	struct tm s;
 	memset(&s, 0, sizeof(s));
-	const char* p = strptime(str.c_str(), "%F %T", &s);
+	const char* p = strptime(str.c_str(), "%Y-%m-%d %T", &s);
 	if (!p || *p != '\0')
 	    return (time_t)(-1);
-	return utc ? timegm(&s) : timelocal(&s);
diff --git a/testing/snapper/regex.patch b/testing/snapper/regex.patch
new file mode 100644
index 0000000000..97dc7fa4af
--- /dev/null
+++ b/testing/snapper/regex.patch
@@ -0,0 +1,50 @@
--- a/snapper/AsciiFile.cc.orig
+++ b/snapper/AsciiFile.cc
@@ -211,7 +211,7 @@
 
 	string line = key + "=\"" + value + "\"";
 
-	Regex rx('^' + Regex::ws + key + '=' + "(['\"]?)([^'\"]*)\\1" + Regex::ws + '$');
+	Regex rx('^' + Regex::ws + key + '=' + "(\"[^'\"]*\"|'[^'\"]*'|[^'\"]*)" + Regex::ws + '$');
 
 	vector<string>::iterator it = find_if(lines(), regex_matches(rx));
 	if (it == lines().end())
@@ -226,12 +226,15 @@
     bool
     SysconfigFile::getValue(const string& key, string& value) const
     {
-	Regex rx('^' + Regex::ws + key + '=' + "(['\"]?)([^'\"]*)\\1" + Regex::ws + '$');
+	Regex rx('^' + Regex::ws + key + '=' + "(\"[^'\"]*\"|'[^'\"]*'|[^'\"]*)" + Regex::ws + '$');
 
 	if (find_if(lines(), regex_matches(rx)) == lines().end())
 	    return false;
 
-	value = rx.cap(2);
+	value = rx.cap(1);
+	if (!value.empty() && (value.front() == '"' || value.front() == '\'')) {
+	    value = std::string(value.begin() + 1, value.end() - 1);
+	}
 	y2mil("key:" << key << " value:" << value);
 	return true;
     }
@@ -295,12 +298,18 @@
     {
 	map<string, string> ret;
 
-	Regex rx('^' + Regex::ws + "([0-9A-Z_]+)" + '=' + "(['\"]?)([^'\"]*)\\2" + Regex::ws + '$');
+	Regex rx('^' + Regex::ws + "([0-9A-Z_]+)" + '=' + "(\"[^'\"]*\"|'[^'\"]*'|[^'\"]*)" + Regex::ws + '$');
 
 	for (vector<string>::const_iterator it = Lines_C.begin(); it != Lines_C.end(); ++it)
 	{
 	    if (rx.match(*it))
-		ret[rx.cap(1)] = rx.cap(3);
+		{
+		string value = rx.cap(2);
+		if (!value.empty() && (value.front() == '"' || value.front() == '\'')) {
+		    value = std::string(value.begin() + 1, value.end() - 1);
+		}
+		ret[rx.cap(1)] = value;
+	    }
 	}
 
 	return ret;
diff --git a/testing/snapper/remove-systemd.patch b/testing/snapper/remove-systemd.patch
index 5f39a3a254..8f84cba64f 100644
--- a/testing/snapper/remove-systemd.patch
+++ b/testing/snapper/remove-systemd.patch
@@ -1,14 +1,9 @@
diff --git a/data/Makefile.am b/data/Makefile.am
index e2036ba..0af20ff 100644
--- a/data/Makefile.am
--- a/data/Makefile.am.orig
+++ b/data/Makefile.am
@@ -18,16 +18,6 @@ install-data-local:
 	install -D -m 644 lvm.txt $(DESTDIR)/etc/snapper/filters/lvm.txt
 	install -D -m 644 x11.txt $(DESTDIR)/etc/snapper/filters/x11.txt
@@ -21,13 +21,6 @@
 	install -D -m 644 org.opensuse.Snapper.conf $(DESTDIR)/etc/dbus-1/system.d/org.opensuse.Snapper.conf
 	install -D -m 644 org.opensuse.Snapper.service $(DESTDIR)/usr/share/dbus-1/system-services/org.opensuse.Snapper.service
 
-	install -D -m 644 org.opensuse.Snapper.conf $(DESTDIR)/etc/dbus-1/system.d/org.opensuse.Snapper.conf
-	install -D -m 644 org.opensuse.Snapper.service $(DESTDIR)/usr/share/dbus-1/system-services/org.opensuse.Snapper.service
--
-	install -D -m 644 timeline.service $(DESTDIR)/usr/lib/systemd/system/snapper-timeline.service
-	install -D -m 644 timeline.timer $(DESTDIR)/usr/lib/systemd/system/snapper-timeline.timer
-	install -D -m 644 cleanup.service $(DESTDIR)/usr/lib/systemd/system/snapper-cleanup.service
-- 
2.20.1



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)