app-backup/casync: add initial ebuild

This is a fairly boring meson ebuild. I had to apply a patch to make it
build.

This is included in the sdk for the torcx packaging work, where we'd
like to get a digest of a given torcx pkg. `casync digest` works well
for that and can be pointed at a directory easily enough.
This commit is contained in:
Euan Kemp 2017-09-01 18:21:21 -07:00
parent 59a7befbbf
commit ed7a4a8ef2
3 changed files with 160 additions and 0 deletions

View File

@ -0,0 +1 @@
DIST v2.tar.gz 1250776 SHA256 a5f79ee3ccae2df42cce662c36edc7047aebacd3a9c029ee9a859adfa7a68d00 SHA512 d3f27a8af75c07030cbd465bc716f74b1389234ff03c4043f76e898a2c2633ca6352618c89330aca6b83ff8d09082ff7d7a3d835035665c4f9eab9dc643fd3cf WHIRLPOOL 19ecfeac16c2f519a8e2abf4aed65d4331b57e7fbf58386ea0fd0441f58a1306d67103885dd662e5f1e8320add995625687830f4cbdb6535a917979e682b6121

View File

@ -0,0 +1,33 @@
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
DESCRIPTION="casync - Content-Addressable Data Synchronization Tool - is a tool similar to rsync for backing up and updating directory trees"
HOMEPAGE="https://github.com/systemd/casync"
SRC_URI="https://github.com/systemd/casync/archive/v${PV}.tar.gz"
inherit meson eutils
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="amd64"
IUSE="fuse selinux doc"
DEPEND="app-arch/zstd
fuse? ( sys-fs/fuse )
"
RDEPEND="${DEPEND}"
PATCHES=(
"${FILESDIR}/fix-selinux-build.patch"
)
src_configure() {
local emesonargs=(
-Dfuse=$(usex fuse true false)
-Dselinux=$(usex selinux true false)
-Dman=$(usex doc true false)
)
meson_src_configure
}

View File

@ -0,0 +1,126 @@
From ab7ef83b5aef07af6e8628eeab353a3fb043fadd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 26 Jul 2017 09:52:40 -0400
Subject: [PATCH 1/2] Fix build without selinux and refuse --with=selinux when
compiled without
Fixes #73.
The output is pretty crappy:
$ build/casync --with=selinux make ...
Failed to run synchronizer: Operation not supported
but that's being tracked as #44.
---
src/cadecoder.c | 2 +-
src/caencoder.c | 13 ++++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/cadecoder.c b/src/cadecoder.c
index 5deca52..aad8e31 100644
--- a/src/cadecoder.c
+++ b/src/cadecoder.c
@@ -13,7 +13,7 @@
#include <linux/msdos_fs.h>
#if HAVE_SELINUX
-#include <selinux/selinux.h>
+# include <selinux/selinux.h>
#endif
#include "cadecoder.h"
diff --git a/src/caencoder.c b/src/caencoder.c
index eb58bbb..63fd4e2 100644
--- a/src/caencoder.c
+++ b/src/caencoder.c
@@ -21,7 +21,7 @@
#include <linux/msdos_fs.h>
#if HAVE_SELINUX
-#include <selinux/selinux.h>
+# include <selinux/selinux.h>
#endif
#include "caencoder.h"
@@ -264,10 +264,12 @@ static void ca_encoder_node_free(CaEncoderNode *n) {
n->fcaps = mfree(n->fcaps);
+#if HAVE_SELINUX
if (n->selinux_label) {
freecon(n->selinux_label);
n->selinux_label = NULL;
}
+#endif
n->device_size = UINT64_MAX;
@@ -658,18 +660,20 @@ static int ca_encoder_node_read_selinux_label(
CaEncoder *e,
CaEncoderNode *n) {
+#if HAVE_SELINUX
char *label;
int r;
+#endif
assert(e);
assert(n);
if ((e->feature_flags & CA_FORMAT_WITH_SELINUX) == 0)
return 0;
+#if HAVE_SELINUX
if (n->selinux_label_valid)
return 0;
-#if HAVE_SELINUX
if (n->fd >= 0)
r = fgetfilecon(n->fd, &label) < 0 ? -errno : 0;
else {
@@ -706,10 +710,13 @@ static int ca_encoder_node_read_selinux_label(
n->selinux_label = label;
}
-#endif
n->selinux_label_valid = true;
return 0;
+
+#else
+ return -EOPNOTSUPP;
+#endif
}
static int compare_xattr(const void *a, const void *b) {
From 42b8c68addc8aed0a829b7678ef0ceefd47dc113 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 26 Jul 2017 10:34:03 -0400
Subject: [PATCH 2/2] Fix segv in ca_remote_forget_chunk
With gcc-7.1.1-6.fc27:
In file included from ../src/caformat-util.h:7:0,
from ../src/caremote.c:8:
../src/caremote.c: In function 'ca_remote_forget_chunk':
../src/util.h:471:13: error: argument 1 null where non-null expected [-Werror=nonnull]
if (strncmp(s, prefix, l) == 0)
^~~~~~~~~~~~~~~~~~~~~
---
src/caremote.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/caremote.c b/src/caremote.c
index 7d49923..755c3a6 100644
--- a/src/caremote.c
+++ b/src/caremote.c
@@ -2729,7 +2729,7 @@ int ca_remote_forget_chunk(CaRemote *rr, const CaChunkID *id) {
p = startswith(qpos, "low-priority/");
if (!p) {
- p = startswith(p, "high-priority/");
+ p = startswith(qpos, "high-priority/");
if (!p) {
r = -EBADMSG;
goto finish;