Mail archive
alpine-aports

[alpine-aports] [PATCH] testing/bees: new aport

From: Bradley Saulteaux <bradsoto_at_gmail.com>
Date: Sun, 3 Feb 2019 11:21:56 -0700

https://github.com/Zygo/bees
Best-Effort Extent-Same, a btrfs dedup agent
---
 testing/bees/10-pthread_getname1.patch | 23 ++++++++++++++++++
 testing/bees/APKBUILD                  | 33 ++++++++++++++++++++++++++
 testing/bees/bees.initd                | 27 +++++++++++++++++++++
 3 files changed, 83 insertions(+)
 create mode 100644 testing/bees/10-pthread_getname1.patch
 create mode 100644 testing/bees/APKBUILD
 create mode 100755 testing/bees/bees.initd
diff --git a/testing/bees/10-pthread_getname1.patch b/testing/bees/10-pthread_getname1.patch
new file mode 100644
index 0000000000..2a5d88c56a
--- /dev/null
+++ b/testing/bees/10-pthread_getname1.patch
_at_@ -0,0 +1,23 @@
+--- bees-0.6.1/lib/task.cc
++++ bees-0.6.1/lib/task.cc
+_at_@ -104,7 +104,6 @@
+ 
+ 		char buf[24];
+ 		memset(buf, '\0', sizeof(buf));
+-		DIE_IF_MINUS_ERRNO(pthread_getname_np(pthread_self(), buf, sizeof(buf)));
+ 		Cleanup pthread_name_cleaner([&]() {
+ 			pthread_setname_np(pthread_self(), buf);
+ 		});
+--- bees-0.6.1/src/bees.cc
++++ bees-0.6.1/src/bees.cc
+_at_@ -160,10 +160,6 @@
+ 	// OK try the pthread name next.
+ 	char buf[24];
+ 	memset(buf, '\0', sizeof(buf));
+-	int err = pthread_getname_np(pthread_self(), buf, sizeof(buf));
+-	if (err) {
+-		return string("pthread_getname_np: ") + strerror(err);
+-	}
+ 	buf[sizeof(buf) - 1] = '\0';
+ 
+ 	// thread_getname_np returns process name
diff --git a/testing/bees/APKBUILD b/testing/bees/APKBUILD
new file mode 100644
index 0000000000..e1665962d4
--- /dev/null
+++ b/testing/bees/APKBUILD
_at_@ -0,0 +1,33 @@
+# Maintainer: Bradley Saulteaux <bradsoto_at_gmail.com>
+pkgname=bees
+pkgver=0.6.1
+pkgrel=0
+pkgdesc="Best-Effort Extent-Same, a btrfs dedup agent"
+url="https://github.com/Zygo/bees"
+arch="all"
+license="GPL-3.0-or-later"
+depends="btrfs-progs"
+makedepends="btrfs-progs-dev util-linux-dev"
+install=""
+subpackages=""
+source="${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz
+	10-pthread_getname1.patch
+	bees.initd"
+build() {
+	cd "$srcdir"/${pkgname}-${pkgver}	
+	make all
+}
+check() {
+	cd "$srcdir"/${pkgname}-${pkgver}
+	make test
+}
+package() {
+	cd "$srcdir"/${pkgname}-${pkgver}
+	make DESTDIR="$pkgdir" install
+	mv bin "$pkgdir"/
+	install -m755 -D "$srcdir"/$pkgname.initd \
+		"$pkgdir"/etc/init.d/$pkgname
+}
+sha512sums="cd44d21959d3ab4dda255f0a4a57bd3aeecfb9fee6ea26d68a1b5f84d407f75bd0b442ecf4fefc5ac856dcd9af035f44ceeff77a8926b164f97a15350efcee33  bees-0.6.1.tar.gz
+50c9cc16f094a0a69f31cf6e42601b9114344ea23a1455d6b5a3f18829ad03426ebdc37187af747bb74f51f75866c3a6da8805d0537af8e729a2f53819d52efb  10-pthread_getname1.patch
+093bc4c9604a0b28b39069e447d83800c91d0974fe4618ce5e5063e5c816b2d63c1b633710c592d76e8f6367d696283d6fa4a3a9561b09ce62fa28cabf8e55d0  bees.initd"
diff --git a/testing/bees/bees.initd b/testing/bees/bees.initd
new file mode 100755
index 0000000000..f8717dbed9
--- /dev/null
+++ b/testing/bees/bees.initd
_at_@ -0,0 +1,27 @@
+#!/sbin/openrc-run
+
+WORK_DIR="/" # btrfs filesytem root directory
+DB_SIZE=8 # this default setting uses about 140M of memory
+
+BEESSTATUS=/run/$SVCNAME/$SVCNAME.status
+BEESHOME="$WORK_DIR/.beeshome"
+DB_PATH="$BEESHOME/beeshash.dat"
+NEW_SIZE=$(expr $DB_SIZE \* 16777216)
+name=$SVCNAME
+command=/bin/$SVCNAME
+command_args="$WORK_DIR"
+command_background=yes
+pidfile=/run/$SVCNAME/$SVCNAME.pid
+export BEESSTATUS
+
+start_pre() {
+	checkpath -d /run/$SVCNAME
+	if [ ! -d "$BEESHOME" ]; then
+		btrfs sub cre "$BEESHOME"
+	fi	
+	touch "$DB_PATH"
+	OLD_SIZE="$(wc -c < "$DB_PATH" | sed 's/\t/ /g' | cut -d' ' -f1)"
+	if [ "$OLD_SIZE" != "$NEW_SIZE" ]; then
+		truncate -s $NEW_SIZE $DB_PATH
+	fi
+}
-- 
2.20.1
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Sun Feb 03 2019 - 11:21:56 UTC