Subject: [alpine-aports] [PATCH] main/dovecot: Integrate pigeonhole plugin 0.4.13 as a subpackage

From: Olivier Mauras <[email-masked]>
Date: Mon, 4 Apr 2016 02:56:25 +0200

Sieve support in dovecot requires the pigeonhole plugin.
The plugin requires to be rebuilded each time dovecot minor version changes,
so having it as a subpackage will make it easier.
---
 main/dovecot/APKBUILD | 50 ++++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 48 insertions(+), 2 deletions(-)

diff --git a/main/dovecot/APKBUILD b/main/dovecot/APKBUILD
index 2ba4986..c6c0392 100644
--- a/main/dovecot/APKBUILD
+++ b/main/dovecot/APKBUILD
@@ -4,7 +4,8 @@
 # Maintainer: Natanael Copa <[email-masked]>
 pkgname=dovecot
 pkgver=2.2.22
-pkgrel=0
+pigeonholever=0.4.13
+pkgrel=1
 pkgdesc="IMAP and POP3 server"
 url="http://www.dovecot.org/"
 arch="all"
@@ -17,9 +18,10 @@ makedepends="libcap-dev zlib-dev openssl-dev bzip2-dev postgresql-dev
 install="dovecot.pre-install dovecot.post-install"
 subpackages="$pkgname-doc $pkgname-dev
 	$pkgname-sql $pkgname-pgsql $pkgname-mysql $pkgname-sqlite
-	$pkgname-gssapi $pkgname-ldap
+	$pkgname-gssapi $pkgname-ldap $pkgname-pigeonhole
 	"
 source="http://www.dovecot.org/releases/${pkgver%.*}/$pkgname-$pkgver.tar.gz
+	http://pigeonhole.dovecot.org/releases/2.2/$pkgname-2.2-pigeonhole-$pigeonholever.tar.gz
 	hide-dl-errors.patch
 	dovecot.logrotate
 	dovecot.initd
@@ -27,6 +29,7 @@ source="http://www.dovecot.org/releases/${pkgver%.*}/$pkgname-$pkgver.tar.gz
 options="libtool"
 
 _builddir="$srcdir"/$pkgname-$pkgver
+_builddirpigeonhole="$srcdir"/$pkgname-2.2-pigeonhole-$pigeonholever
 
 prepare() {
 	cd "$_builddir"
@@ -105,6 +108,46 @@ dev() {
 		"$subpkgdir"/usr/lib/dovecot/
 }
 
+pigeonhole() {
+	pkgdesc="Sieve plugin for dovecot"
+	depends="$pkgname"
+
+	cd "$_builddirpigeonhole"
+	./configure \
+		--build=$CBUILD \
+		--host=$CHOST \
+		--prefix=/usr \
+		--localstatedir=/var \
+		--sysconfdir=/etc \
+		--mandir=/usr/share/man \
+		--infodir=/usr/share/info \
+		--with-dovecot="$_builddir" \
+		--disable-static \
+		|| return 1
+	make || return 1
+	make install DESTDIR="$pkgdir" || return 1
+
+	# Moving stuff before running _mv
+	mv "$pkgdir"/usr/share/doc/dovecot/example-config/conf.d/* \
+		"$pkgdir"/etc/dovecot/conf.d \
+	|| return 1
+
+	# We keep includes, man and doc in main package
+	_mv $(cd "$pkgdir" && find usr -name '*sieve*' -prune \
+		-a -not -regex ".*/include/.*" \
+		-a -not -regex ".*/man/.*" \
+		-a -not -regex ".*/doc/.*" \
+		) || return 1
+	_mv $(cd "$pkgdir" && find usr -name '*pigeonhole*' \
+		-a -not -regex ".*/include/.*" \
+		-a -not -regex ".*/man/.*" \
+		) || return 1
+	_mv $(cd "$pkgdir" && find etc/dovecot -name '*sieve*') || return 1
+
+	# Compress man pages
+	find "$pkgdir"/usr/share/man/ -name "*.1" -o -name "*.7" | xargs gzip -9
+}
+
 pgsql() {
 	pkgdesc="postgresql driver for dovecot"
 	depends="$pkgname-sql"
@@ -144,14 +187,17 @@ sql() {
 }
 
 md5sums="bc8057bd5bdfa0f8e80e2fef1082a241  dovecot-2.2.22.tar.gz
+5009b133096724aa2cb7fe1056d88125  dovecot-2.2-pigeonhole-0.4.13.tar.gz
 49f7a03284cc657857fe2ae22b8c82a0  hide-dl-errors.patch
 1a88280b65efb6cb7f70bc5a88bf264c  dovecot.logrotate
 ddd77573827e0662be21303fb795eef3  dovecot.initd"
 sha256sums="c7a9db3c4ae9d9b4da920d2c82669700a0d407934501b405f37f89cc0b706ec7  dovecot-2.2.22.tar.gz
+7fd187b8393a5048b302f90ad84adc7bf6e73bf79fd8d22a1c1aaa71f836a910  dovecot-2.2-pigeonhole-0.4.13.tar.gz
 d6accdd6e271647c01ab8fa0a9491ee822486484961e2d5c252bf70e816d2bfa  hide-dl-errors.patch
 2ac04bb7b5c503cd87ba044482e651dbe5c9d84a4268891fb2aa9ba26e62f833  dovecot.logrotate
 3f74548051297cedc7f8d203f1d1d9dc904fe89004b54b52921d2050520daa6f  dovecot.initd"
 sha512sums="ea02ae491e90c0b9de7c7320901c8f7235193303fb194805564582d30e630002f21f7195e5c5b99ff3ea1fadf95ddd43c2f7bb4d24067e0e5f40a66e9eb90012  dovecot-2.2.22.tar.gz
+4e25a406b888fd8cbc9a4f4f7a7364f10ab47e932550970cede34c964d50a6fe697c4b6d61cc83846b97901368ac63d1e22aa4d1d2002f24540766c5fbbebbf5  dovecot-2.2-pigeonhole-0.4.13.tar.gz
 1e9a1f2990019236546c7be581a4d6d0b430110d27a00bc3298f5c154ef9a4aadefa193d02a017912f826d771058fd5c6ef6cb454e14f0d15749fa8f3a68c64a  hide-dl-errors.patch
 58756fa06a063777ef7c4d1e67b63adbde5462264e14bd7a3187a318f498fff21ac2a8d53bb216f56fef4588206e14112da79542b6dfdf503988786f27bb6544  dovecot.logrotate
 d7f67991e11979da91162eb64a0b924655d0ac155d97bcc42a40c758003d60b7c096945544e6b321aa8ecb3416fe17b14b5898f1dba5e5a4b3e4c9c21295c8cb  dovecot.initd"
-- 
2.7.4

---

From: Olivier Mauras <[email-masked]>
Date: Wed, 6 Apr 2016 20:55:16 +0200

Sieve support in dovecot requires the pigeonhole plugin.
The plugin requires to be rebuilded each time dovecot minor version changes,
so having it as a subpackage will make it easier.
---
 main/dovecot/APKBUILD | 42 ++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 40 insertions(+), 2 deletions(-)

index 2ba4986..95602a5 100644

 prepare() {
 	cd "$_builddir"
@@ -58,6 +61,21 @@ build() {
 		--with-rundir=/run/dovecot \
 		|| return 1
 	make || return 1
+
+	# Build pigeonhole plugin
+	cd "$_builddirpigeonhole"
+	./configure \
+		--build=$CBUILD \
+		--host=$CHOST \
+		--prefix=/usr \
+		--localstatedir=/var \
+		--sysconfdir=/etc \
+		--mandir=/usr/share/man \
+		--infodir=/usr/share/info \
+		--with-dovecot="$_builddir" \
+		--disable-static \
+		|| return 1
+	make || return 1
 }
 
 package() {
@@ -86,6 +104,15 @@ package() {
 	sed -i -e 's,!include auth-system.conf.ext,!include auth-passwdfile.conf.ext,' \
 		-e 's,#!include auth-passwdfile.conf.ext,#!include auth-system.conf.ext,' \
 		"$pkgdir"/etc/dovecot/conf.d/10-auth.conf || return 1
+
+
+	# Installing pigeonhole plugin
+	cd "$_builddirpigeonhole"
+	make install DESTDIR="$pkgdir" || return 1
+
+	# Moving config in the correct place
+	mv "$pkgdir"/usr/share/doc/dovecot/example-config/conf.d/* \
+		"$pkgdir"/etc/dovecot/conf.d || return 1
 }
 
 _mv() {
@@ -105,6 +132,14 @@ dev() {
 		"$subpkgdir"/usr/lib/dovecot/
 }
 
+pigeonhole() {
+	pkgdesc="Sieve plugin for dovecot"
+	depends="$pkgname"
+	_mv $(cd "$pkgdir" && find usr -name '*sieve*')
+	_mv $(cd "$pkgdir" && find usr -name '*pigeonhole*')
+	_mv $(cd "$pkgdir" && find etc/dovecot -name '*sieve*')
+}
+
 pgsql() {
 	pkgdesc="postgresql driver for dovecot"
 	depends="$pkgname-sql"
@@ -144,14 +179,17 @@ sql() {
 }

Here's the patch including requested modifications.