aboutsummaryrefslogtreecommitdiffstats
path: root/testing/bees
diff options
context:
space:
mode:
authorBradley Saulteaux <bradsoto@gmail.com>2019-02-03 11:21:56 -0700
committerLeonardo Arena <rnalrd@alpinelinux.org>2019-02-05 14:14:27 +0000
commit42422ba7568176741ff18e7de66baca5ca97306a (patch)
tree457ec5627783f5b589f2b5d5e5f358bad038f082 /testing/bees
parent07bc5de4b672ec1d745b077b2d445032def14e8a (diff)
downloadaports-42422ba7568176741ff18e7de66baca5ca97306a.tar.bz2
aports-42422ba7568176741ff18e7de66baca5ca97306a.tar.xz
testing/bees: new aport
https://github.com/Zygo/bees Best-Effort Extent-Same, a btrfs dedup agent
Diffstat (limited to 'testing/bees')
-rw-r--r--testing/bees/10-pthread_getname1.patch23
-rw-r--r--testing/bees/APKBUILD34
-rwxr-xr-xtesting/bees/bees.initd27
3 files changed, 84 insertions, 0 deletions
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
@@ -0,0 +1,23 @@
+--- bees-0.6.1/lib/task.cc
++++ bees-0.6.1/lib/task.cc
+@@ -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
+@@ -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..de1aef40eb
--- /dev/null
+++ b/testing/bees/APKBUILD
@@ -0,0 +1,34 @@
+# Maintainer: Bradley Saulteaux <bradsoto@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="$pkgname-openrc"
+source="${pkgname}-${pkgver}.tar.gz::${url}/archive/v${pkgver}.tar.gz
+ 10-pthread_getname1.patch
+ bees.initd"
+
+build() {
+ make all
+}
+
+check() {
+ make test
+}
+
+package() {
+ 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
@@ -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
+}