From 0b065cd1bef7d50de0f78520a6d4f7808af63243 Mon Sep 17 00:00:00 2001 From: Noel Kuntze Date: Wed, 15 May 2024 04:32:47 +0200 Subject: [PATCH] testing/piler: upgrade to 1.4.5 Also use libcolumnar from manticore (required for fast secondary indices) --- ...e-conf.patch => 0001-manticore-conf.patch} | 11 +-- testing/piler/0001-utf8_encode_char.patch | 10 -- testing/piler/0002-inline-compiler-fix.patch | 51 +++++++++++ .../0003-fix_pilerpurge_for_rt_index.patch | 91 ------------------- testing/piler/APKBUILD | 28 +++--- testing/piler/piler-smtp.initd | 6 +- testing/piler/piler.initd | 9 +- 7 files changed, 78 insertions(+), 128 deletions(-) rename testing/piler/{0002-manticore-conf.patch => 0001-manticore-conf.patch} (68%) delete mode 100644 testing/piler/0001-utf8_encode_char.patch create mode 100644 testing/piler/0002-inline-compiler-fix.patch delete mode 100644 testing/piler/0003-fix_pilerpurge_for_rt_index.patch diff --git a/testing/piler/0002-manticore-conf.patch b/testing/piler/0001-manticore-conf.patch similarity index 68% rename from testing/piler/0002-manticore-conf.patch rename to testing/piler/0001-manticore-conf.patch index 8721644ffcb..83f2931b851 100644 --- a/testing/piler/0002-manticore-conf.patch +++ b/testing/piler/0001-manticore-conf.patch @@ -1,10 +1,9 @@ -diff -ruN a/etc/manticore.conf.in b/etc/manticore.conf.in ---- a/etc/manticore.conf.in 2024-03-13 09:38:42.847170715 +0100 -+++ b/etc/manticore.conf.in 2024-03-13 09:41:24.847111111 +0100 -@@ -248,11 +248,11 @@ - { +--- a/etc/manticore.conf.in ++++ b/etc/manticore.conf.in +@@ -250,11 +250,11 @@ listen = 127.0.0.1:9312 - listen = 127.0.0.1:9306:mysql41 + listen = 127.0.0.1:9306:mysql + listen = 127.0.0.1:9307:mysql_readonly - log = /var/piler/manticore/manticore.log + log = /var/log/piler/manticore.log binlog_max_log_size = 256M diff --git a/testing/piler/0001-utf8_encode_char.patch b/testing/piler/0001-utf8_encode_char.patch deleted file mode 100644 index c6b52188ee5..00000000000 --- a/testing/piler/0001-utf8_encode_char.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff -ruN a/src/decoder.h b/src/decoder.h ---- a/src/decoder.h 2021-02-23 07:26:47.000000000 +0100 -+++ b/src/decoder.h 2022-03-28 18:35:10.706474194 +0200 -@@ -11,5 +11,6 @@ - void decodeHTML(char *p, int utf8); - void decodeURL(char *p); - int utf8_encode(char *inbuf, int inbuflen, char *outbuf, int outbuflen, char *encoding); -+void utf8_encode_char(unsigned char c, unsigned char *buf, int buflen, int *len); - - #endif /* _DECODER_H */ diff --git a/testing/piler/0002-inline-compiler-fix.patch b/testing/piler/0002-inline-compiler-fix.patch new file mode 100644 index 00000000000..653a8114d22 --- /dev/null +++ b/testing/piler/0002-inline-compiler-fix.patch @@ -0,0 +1,51 @@ +From 4e2be5dda6429e253f60c9b1fe4a7831f7b009e1 Mon Sep 17 00:00:00 2001 +From: jsuto +Date: Tue, 23 Apr 2024 17:33:10 +0200 +Subject: [PATCH] Inline compiler fix (#18) + +Signed-off-by: Janos SUTO +--- + src/decoder.c | 2 +- + src/hash.c | 2 +- + src/session.c | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/decoder.c b/src/decoder.c +index fc034ff1..a22bd1b0 100644 +--- a/src/decoder.c ++++ b/src/decoder.c +@@ -67,7 +67,7 @@ static int compmi(const void *m1, const void *m2){ + } + + +-inline void utf8_encode_char(unsigned char c, unsigned char *buf, int buflen, int *len){ ++static inline void utf8_encode_char(unsigned char c, unsigned char *buf, int buflen, int *len){ + int count=0; + + memset(buf, 0, buflen); +diff --git a/src/hash.c b/src/hash.c +index bb131cbf..35947fee 100644 +--- a/src/hash.c ++++ b/src/hash.c +@@ -9,7 +9,7 @@ + #include + + +-inline int hash(unsigned int key){ ++static inline int hash(unsigned int key){ + return key % MAXHASH; + } + +diff --git a/src/session.c b/src/session.c +index a7ca4094..932caa0f 100644 +--- a/src/session.c ++++ b/src/session.c +@@ -199,7 +199,7 @@ void tear_down_session(struct smtp_session **sessions, int slot, int *num_connec + } + + +-inline int get_last_newline_position(char *buf, int buflen){ ++static inline int get_last_newline_position(char *buf, int buflen){ + int i; + + for(i=buflen; i>0; i--){ diff --git a/testing/piler/0003-fix_pilerpurge_for_rt_index.patch b/testing/piler/0003-fix_pilerpurge_for_rt_index.patch deleted file mode 100644 index 66dd1912157..00000000000 --- a/testing/piler/0003-fix_pilerpurge_for_rt_index.patch +++ /dev/null @@ -1,91 +0,0 @@ -From e2f6a718272585dd99737087b9c63fa7a734461c Mon Sep 17 00:00:00 2001 -From: Janos SUTO -Date: Wed, 1 Nov 2023 08:25:56 +0100 -Subject: [PATCH] Updated pilerpurge to remove data from manticore in case of - RT index - -Signed-off-by: Janos SUTO ---- - util/pilerpurge.py | 26 ++++++++++++++++++++++---- - 1 file changed, 22 insertions(+), 4 deletions(-) - -diff --git a/util/pilerpurge.py b/util/pilerpurge.py -index e2e2d61f..dc87916e 100755 ---- a/util/pilerpurge.py -+++ b/util/pilerpurge.py -@@ -9,7 +9,7 @@ import sys - import syslog - import time - --SQL_PURGE_SELECT_QUERY = "SELECT piler_id, size FROM " +\ -+SQL_PURGE_SELECT_QUERY = "SELECT id, piler_id, size FROM " +\ - "metadata WHERE deleted=0 AND retained < UNIX_TIMESTAMP(NOW()) " +\ - "AND id NOT IN (SELECT id FROM rcpt WHERE `to` IN " +\ - "(SELECT email FROM legal_hold)) AND id NOT IN (SELECT " +\ -@@ -33,7 +33,9 @@ def read_options(filename="", opts={}): - opts['password'] = config.get('piler', 'mysqlpwd') - opts['database'] = config.get('piler', 'mysqldb') - opts['storedir'] = config.get('piler', 'queuedir') -- -+ opts['rtindex'] = config.getint('piler', 'rtindex', fallback=0) -+ opts['sphxhost'] = config.get('piler', 'sphxhost', fallback='127.0.0.1') -+ opts['sphxport'] = config.getint('piler', 'sphxport', fallback=9306) - opts['server_id'] = "%02x" % config.getint('piler', 'server_id') - - -@@ -184,6 +186,17 @@ def get_attachment_file_path(piler_id='', attachment_id=0, opts={}): - str(attachment_id)]) - - -+def purge_index_data(ids=[], opts={}): -+ ''' -+ Delete from index data in case of RT index -+ ''' -+ -+ if opts['rtindex'] == 1 and opts['dry_run'] is False: -+ cursor = opts['sphx'].cursor() -+ a = "," . join([str(x) for x in ids]) -+ cursor.execute("DELETE FROM piler WHERE id IN (%s)" % (a)) -+ -+ - def main(): - parser = argparse.ArgumentParser() - parser.add_argument("-c", "--config", type=str, help="piler.conf path", -@@ -203,6 +216,7 @@ def main(): - opts['dry_run'] = args.dry_run - opts['verbose'] = args.verbose - opts['db'] = None -+ opts['sphx'] = None - opts['messages'] = 0 - opts['files'] = 0 - opts['size'] = 0 -@@ -217,6 +231,8 @@ def main(): - opts['db'] = dbapi.connect(opts['dbhost'], opts['username'], - opts['password'], opts['database']) - -+ opts['sphx'] = dbapi.connect(host=opts['sphxhost'], port=opts['sphxport']) -+ - if is_purge_enabled(opts) is False: - syslog.syslog("Purging emails is disabled") - sys.exit(1) -@@ -229,13 +245,15 @@ def main(): - if rows == (): - break - -- piler_id = [x[0] for x in rows] -- size = [x[1] for x in rows] -+ id = [x[0] for x in rows] -+ piler_id = [x[1] for x in rows] -+ size = [x[2] for x in rows] - - opts['purged_size'] = opts['purged_size'] + sum(size) - - purge_m_files(piler_id, opts) - purge_attachments_by_piler_id(piler_id, opts) -+ purge_index_data(id, opts) - - # It's possible that there's attachment duplication, thus - # refcount > 0, even though after deleting the duplicates --- -2.42.0 - diff --git a/testing/piler/APKBUILD b/testing/piler/APKBUILD index 62b95da727d..9e2fa67a7cf 100644 --- a/testing/piler/APKBUILD +++ b/testing/piler/APKBUILD @@ -1,17 +1,18 @@ # Contributor: Noel Kuntze # Maintainer: Noel Kuntze pkgname=piler -pkgver=1.4.4 +pkgver=1.4.5 pkgrel=0 pkgdesc="Open source email archiving solution with all the necessary features for your enterprise" url="https://www.mailpiler.org/" -arch="all !ppc64le !s390x !x86 !armhf !armv7" # exclusions because manticore is not built for these architectures +arch="x86_64 aarch64" # libmanticore-columnar is only supported on x86_64 and aarch64 license="GPL-3.0-only" depends=" bash catdoc coreutils findutils + libmanticore-columnar libzip manticore memcached @@ -34,16 +35,16 @@ options="!check" subpackages="$pkgname-openrc" pkgusers="piler" pkggroups="piler" -source="https://bitbucket.org/jsuto/piler/downloads/piler-$pkgver.tar.gz - 0001-utf8_encode_char.patch - 0002-manticore-conf.patch - 0003-fix_pilerpurge_for_rt_index.patch - +source="https://github.com/jsuto/piler/archive/refs/tags/piler-$pkgver.tar.gz + 0001-manticore-conf.patch + 0002-inline-compiler-fix.patch + piler.initd piler-smtp.initd searchd.initd searchd.confd -" + " +builddir="$srcdir/piler-piler-$pkgver" build() { ./configure \ @@ -103,12 +104,11 @@ package() { } sha512sums=" -bd53fa14d01fe50c7fa6ccded4404d4ceb6b19ff4484cc2c4f8fde05cc9a66937c701a4378535afc939707d4c27955ec3f31337674506488b10672fc41ba7b4b piler-1.4.4.tar.gz -017f3c6241a0368efb6d1b1b734c38b52af67753f5245dad42e265f44961c90bd218d947824a02e7ff02aa11edd642a2947aeff64033f4757670948f88478f4a 0001-utf8_encode_char.patch -6bbf4c70dd51413b6568f2866a28524eb2986fee35fc4921166baa702fbf466ded7c3357ef7987403c3ad694bbd62aad9abfc90ac8313613e31b7b65784c9b08 0002-manticore-conf.patch -aefef3ff8101c62524f3cd866e3243d4e0cfb2acfd98627db29d9e2d8c12647962bf1b7b62dbd8d0f8b8b20f7719da134dde5d903b4adcf589f5494576ee3e58 0003-fix_pilerpurge_for_rt_index.patch -f3895913350ffb252455c50bb276cc9fff0603804507d2a3f6ab6167a1b8b357ca8039ccb8725849ffa99fe04673d510dfcdc09f099631a8f0dd148494def615 piler.initd -3aa8e661c1c806311abecdc76dcbd12a167e64de11785d2a3c63416cd1e5a445eb021ff4882de5fe1a145fc78483b3691262a07fc0168bbfc03b88812cc1ad17 piler-smtp.initd +65510b60797e2b3a70c5bdc513306b6848ed08312b1bc5f25c199bfc7e8690e5256c528324aa4546ffb32229f5bd2b2103fb163cc644d015c7d53c71a06fc07f piler-1.4.5.tar.gz +918c2809db685f676cf3319d687568d380eba3dd43e8c36b00648abb420fe35d036aa1b21d51fe43497aa297546341c1fbdd79ab643bfed4a9f80874a027c446 0001-manticore-conf.patch +90169f9c9b6bc3c592e28a055cf52df6551d3b7516de5b17c9eaefef51ff93d177a78841d6264d569e7b359fbc080db78b9c3a7df29bd5099e28aa2ca23e0990 0002-inline-compiler-fix.patch +89f4f2136fbe5a7d5106f79533d4b3487ef67d7f8c1added31193114bf4471cff63d1c99bfde23aafb4915e5c00292907b7fd568964ceb8b32da7009f3d4e59b piler.initd +3cf50479a0a8b79c1d41f4c4eaa7393630a03f6b007cd8d62b3538bd85d44bc68b949134ad671600073a35428aa0fef7ea2b03ff881f9dc5fdcf444f5e282a01 piler-smtp.initd c4ad4742c3bd899d8f8004f16252b4862e19683cba6d3d4a7c86d9ed90942c7b3878fc713915aa299b28852f798fedee5ae73e28844d653383d6c7a07698fde4 searchd.initd d6a57f4f972786898d39e94666daa36ba6265dbb577d97e4a9586d4e7b2f3f7b4e69537b316529123186df30f530dc54c03af10c88c8e205192d2b8568571bb3 searchd.confd " diff --git a/testing/piler/piler-smtp.initd b/testing/piler/piler-smtp.initd index 8070d2d35f7..17e0a68b4cb 100644 --- a/testing/piler/piler-smtp.initd +++ b/testing/piler/piler-smtp.initd @@ -3,10 +3,10 @@ description="Piler SMTP server" command="/usr/bin/$SVCNAME" -command_background=yes +command_args_background="-d" depend() { - need net - after firewall + need net + after firewall } diff --git a/testing/piler/piler.initd b/testing/piler/piler.initd index 3e69b9272b3..61f19dddbdf 100644 --- a/testing/piler/piler.initd +++ b/testing/piler/piler.initd @@ -3,14 +3,15 @@ description="Piler daemon" command="/usr/bin/$SVCNAME" -command_background=yes +command_args_background="-d" +pidfile="/run/piler/piler.pid" depend() { - need net - after firewall mariadb + need net + after firewall mariadb } start_pre() { - checkpath -d -m 750 -o piler:piler /run/piler + checkpath -d -m 750 -o piler:piler /run/piler }