net-mail/mboxgrep: add 0.7.13

update HOMEPAGE with the new website
move SRC_URI repo to github

make libpcre(2 with this release) optional

remove custom install phase, prefix/mandir/infodir are set by default

add a test

patches :
fix c23
don't use bundled getopt instead of trying workarounds (bug 945513)

bug 919199 fixed in 0.7.10

Closes: https://bugs.gentoo.org/919199
Closes: https://bugs.gentoo.org/945513
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Part-of: https://github.com/gentoo/gentoo/pull/43240
Closes: https://github.com/gentoo/gentoo/pull/43240
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Nicolas PARLANT
2025-07-28 22:01:24 +02:00
committed by Sam James
parent 3823ea763e
commit 8570e39f90
5 changed files with 234 additions and 1 deletions

View File

@@ -1 +1,2 @@
DIST mboxgrep-0.7.13.tar.gz 154779 BLAKE2B b9d92a0953228647331aad64950fa5b88c135f242a075255cb700b7ecb4dd8f00ed9002ff0ebfd03be1a9b8f88a0f8e0a5422b3277ea7a843ed5c748273e446e SHA512 2211a5251905d3e5ac68f159fd58f667e09a7b142d2d34456ad777a46dd34f7ac71a9562f8639a64848e51de1db71afdd9f61481815050e7ec4b1ab1d71e32fa
DIST mboxgrep-0.7.9.tar.gz 76067 BLAKE2B e808f71c730fcf7edcefadcc579ede559a90db1f1a335fcf08a2002903cdaeac36080235450b6bc802b7cb100afd37a831fe6c57b40711aa70334633891d4330 SHA512 d7e768a0ad11bc3df8619f2a888d2943c68ef72dd036c2fe58268686efb50cb1f62ba379571b6cd6efa8493c5ea0d7c09a29520eae6c68f66d9453710eeeba11

View File

@@ -0,0 +1,159 @@
PR merged
https://github.com/dspiljar/mboxgrep/pull/6.patch
Except the commit for getopt, not used for our purpose
From ad597390055bc7982c618a6b0be36301a7a2cbfa Mon Sep 17 00:00:00 2001
From: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
Date: Mon, 28 Jul 2025 19:04:57 +0200
Subject: [PATCH 2/2] drop really old ifdef and fix C23
Signed-off-by: Nicolas PARLANT <nicolas.parlant@parhuet.fr>
---
src/md5.c | 45 +++++++++++----------------------------------
src/md5.h | 20 ++------------------
2 files changed, 13 insertions(+), 52 deletions(-)
diff --git a/src/md5.c b/src/md5.c
index d6b8013..e20c053 100644
--- a/src/md5.c
+++ b/src/md5.c
@@ -24,19 +24,12 @@
# include <config.h>
#endif
-#include <sys/types.h>
-
-#if STDC_HEADERS || defined _LIBC
-# include <stdlib.h>
-# include <string.h>
-#else
-# ifndef HAVE_MEMCPY
-# define memcpy(d, s, n) bcopy ((s), (d), (n))
-# endif
-#endif
-
#include "md5.h"
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+
#ifdef _LIBC
# include <endian.h>
# if __BYTE_ORDER == __BIG_ENDIAN
@@ -69,8 +62,7 @@ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ };
/* Initialize structure containing state of computation.
(RFC 1321, 3.3: Step 3) */
void
-md5_init_ctx (ctx)
- struct md5_ctx *ctx;
+md5_init_ctx (struct md5_ctx *ctx)
{
ctx->A = 0x67452301;
ctx->B = 0xefcdab89;
@@ -87,9 +79,7 @@ md5_init_ctx (ctx)
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
void *
-md5_read_ctx (ctx, resbuf)
- const struct md5_ctx *ctx;
- void *resbuf;
+md5_read_ctx (const struct md5_ctx *ctx, void *resbuf)
{
((md5_uint32 *) resbuf)[0] = SWAP (ctx->A);
((md5_uint32 *) resbuf)[1] = SWAP (ctx->B);
@@ -105,9 +95,7 @@ md5_read_ctx (ctx, resbuf)
IMPORTANT: On some systems it is required that RESBUF is correctly
aligned for a 32 bits value. */
void *
-md5_finish_ctx (ctx, resbuf)
- struct md5_ctx *ctx;
- void *resbuf;
+md5_finish_ctx (struct md5_ctx *ctx, void *resbuf)
{
/* Take yet unprocessed bytes into account. */
md5_uint32 bytes = ctx->buflen;
@@ -136,9 +124,7 @@ md5_finish_ctx (ctx, resbuf)
resulting message digest number will be written into the 16 bytes
beginning at RESBLOCK. */
int
-md5_stream (stream, resblock)
- FILE *stream;
- void *resblock;
+md5_stream (FILE *stream, void *resblock)
{
/* Important: BLOCKSIZE must be a multiple of 64. */
#define BLOCKSIZE 4096
@@ -193,10 +179,7 @@ md5_stream (stream, resblock)
output yields to the wanted ASCII representation of the message
digest. */
void *
-md5_buffer (buffer, len, resblock)
- const char *buffer;
- size_t len;
- void *resblock;
+md5_buffer (const char *buffer, size_t len, void *resblock)
{
struct md5_ctx ctx;
@@ -212,10 +195,7 @@ md5_buffer (buffer, len, resblock)
void
-md5_process_bytes (buffer, len, ctx)
- const void *buffer;
- size_t len;
- struct md5_ctx *ctx;
+md5_process_bytes (const void *buffer, size_t len, struct md5_ctx *ctx)
{
//const void aligned_buffer = buffer;
@@ -285,10 +265,7 @@ md5_process_bytes (buffer, len, ctx)
It is assumed that LEN % 64 == 0. */
void
-md5_process_block (buffer, len, ctx)
- const void *buffer;
- size_t len;
- struct md5_ctx *ctx;
+md5_process_block (const void *buffer, size_t len, struct md5_ctx *ctx)
{
md5_uint32 correct_words[16];
const md5_uint32 *words = buffer;
diff --git a/src/md5.h b/src/md5.h
index 6febd4a..3ff0378 100644
--- a/src/md5.h
+++ b/src/md5.h
@@ -22,10 +22,7 @@
#define _MD5_H 1
#include <stdio.h>
-
-#if defined HAVE_LIMITS_H || _LIBC
-# include <limits.h>
-#endif
+#include <limits.h>
/* The following contortions are an attempt to use the C preprocessor
to determine an unsigned integral type that is 32 bits wide. An
@@ -38,20 +35,7 @@
# include <sys/types.h>
typedef u_int32_t md5_uint32;
#else
-# if defined __STDC__ && __STDC__
-# define UINT_MAX_32_BITS 4294967295U
-# else
-# define UINT_MAX_32_BITS 0xFFFFFFFF
-# endif
-
-/* If UINT_MAX isn't defined, assume it's a 32-bit type.
- This should be valid for all systems GNU cares about because
- that doesn't include 16-bit systems, and only modern systems
- (that certainly have <limits.h>) have 64+-bit integral types. */
-
-# ifndef UINT_MAX
-# define UINT_MAX UINT_MAX_32_BITS
-# endif
+#define UINT_MAX_32_BITS 4294967295U
# if UINT_MAX == UINT_MAX_32_BITS
typedef unsigned int md5_uint32;

View File

@@ -0,0 +1,11 @@
remove bundled getopt and use libs from glibc/musl instead
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,6 +1,6 @@
bin_PROGRAMS = mboxgrep
mboxgrep_SOURCES = info.c info.h maildir.c maildir.h main.c mbox.c mbox.h \
mboxgrep.h md5.c md5.h message.h misc.c misc.h mh.c mh.h \
- getopt.c getopt1.c getopt.h re.c re.h scan.c scan.h wrap.c wrap.h
+ re.c re.h scan.c scan.h wrap.c wrap.h
mboxgrep_LDADD = $(LIBOBJS)

View File

@@ -0,0 +1,61 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit autotools edo
DESCRIPTION="Grep for mbox files"
HOMEPAGE="https://mboxgrep.org/"
SRC_URI="https://github.com/dspiljar/mboxgrep/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="+pcre"
RDEPEND="
app-arch/bzip2
sys-libs/zlib
pcre? ( dev-libs/libpcre2:=[pcre32] )
"
DEPEND="${RDEPEND}"
PATCHES=(
"${FILESDIR}"/${PN}-0.7.13-rm_getopt.patch
# PR merged https://github.com/dspiljar/mboxgrep/pull/6.patch
# (except commit for getopt)
"${FILESDIR}"/${P}-fix_c23.patch
)
DOCS=( AUTHORS.md NEWS.md README.md TODO.md )
src_prepare() {
default
# Remove old getopt part. It just works with getopt.h from glibc or musl.
rm src/getopt.h || die
eautoreconf
}
src_configure() {
econf $(usev !pcre --without-pcre2)
}
src_test() {
# create a mail
cat > "${T}"/mailtest <<-_EOF_ || die
From fake@example.com Mon Sep 17 00:00:00 2001
From: FAKE USER <fake@example.com>
Date: Mon, 28 Jul 2025 00:00:00 +0200
Subject: [TEST] Basic
To: test@example.com
Bla
_EOF_
# delete the content if it matches
edo ./src/mboxgrep --debug --mailbox-format=mbox --delete \
'^To:\s([a-z]{4})\@\w+\.([a-z]{3})$' "${T}"/mailtest
[[ -s "${T}"/mailtest ]] && die "Test failed. ${T}/mailtest should be empty."
}

View File

@@ -3,6 +3,7 @@
<pkgmetadata>
<!-- maintainer-needed -->
<upstream>
<remote-id type="sourceforge">mboxgrep</remote-id>
<remote-id type="sourceforge">mboxgrep</remote-id><!-- old -->
<remote-id type="github">dspiljar/mboxgrep</remote-id>
</upstream>
</pkgmetadata>