git: 2ba4ed91621e - main - sysutils/createrepo_c: new port

From: Pietro Cerutti <gahr_at_FreeBSD.org>
Date: Tue, 01 Oct 2024 12:23:56 UTC
The branch main has been updated by gahr:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2ba4ed91621e5f7054224acda61afed58cb380b1

commit 2ba4ed91621e5f7054224acda61afed58cb380b1
Author:     Pietro Cerutti <gahr@FreeBSD.org>
AuthorDate: 2024-10-01 12:22:30 +0000
Commit:     Pietro Cerutti <gahr@FreeBSD.org>
CommitDate: 2024-10-01 12:23:54 +0000

    sysutils/createrepo_c: new port
    
    createrepo_c is a C implementation of the createrepo tool, which generates
    metadata for RPM package repositories. It is optimized for performance and
    provides new features compared to the original createrepo written in Python.
---
 sysutils/Makefile                                  |  1 +
 sysutils/createrepo_c/Makefile                     | 46 ++++++++++++++++++++++
 sysutils/createrepo_c/distinfo                     |  3 ++
 .../files/patch-src_compression__wrapper.c         | 10 +++++
 sysutils/createrepo_c/pkg-descr                    |  3 ++
 sysutils/createrepo_c/pkg-plist                    | 37 +++++++++++++++++
 6 files changed, 100 insertions(+)

diff --git a/sysutils/Makefile b/sysutils/Makefile
index b0310dda35fd..6df31a304e66 100644
--- a/sysutils/Makefile
+++ b/sysutils/Makefile
@@ -254,6 +254,7 @@
     SUBDIR += cramfs
     SUBDIR += crashme
     SUBDIR += crate
+    SUBDIR += createrepo_c
     SUBDIR += cronic
     SUBDIR += cronolog
     SUBDIR += cronolog-devel
diff --git a/sysutils/createrepo_c/Makefile b/sysutils/createrepo_c/Makefile
new file mode 100644
index 000000000000..780a297dbf5d
--- /dev/null
+++ b/sysutils/createrepo_c/Makefile
@@ -0,0 +1,46 @@
+PORTNAME=	createrepo_c
+PORTVERSION=	1.1.4     # Replace with the correct version
+CATEGORIES=	sysutils
+
+MAINTAINER=	ktk@netlabs.org
+COMMENT=	C implementation of createrepo
+WWW=		http://rpm-software-management.github.io/createrepo_c/
+
+LICENSE=	GPLv2+
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+LIB_DEPENDS=	libxml2.so:textproc/libxml2 \
+		librpm.so:archivers/rpm4 \
+		libsqlite3.so:databases/sqlite3 \
+		libcurl.so:ftp/curl \
+		libmodulemd.so:misc/libmodulemd \
+		libzck.so:archivers/zchunk \
+		libzstd.so:archivers/zstd
+TEST_DEPENDS=	bash:shells/bash
+
+USES=		cmake pkgconfig shebangfix
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	rpm-software-management
+
+CMAKE_ARGS=	-DENABLE_PYTHON:BOOL=false
+
+SHEBANG_FILES=	tests/run_tests.sh.in
+
+USE_LDCONFIG=	yes
+
+post-patch:
+	${REINPLACE_CMD} \
+		'/pkg_check_modules/s|REQUIRED|REQUIRED IMPORTED_TARGET|' \
+		${WRKSRC}/CMakeLists.txt
+	for m in GLIB2 GIO GTHREAD2 LIBMODULEMD LZMA SQLITE3 RPM ZCK ZSTD; do \
+		${REINPLACE_CMD} \
+			"s/\$${$${m}_LIBRARIES}/PkgConfig::$${m}/" \
+			${WRKSRC}/src/CMakeLists.txt \
+			${WRKSRC}/tests/CMakeLists.txt; \
+	done
+
+do-test:
+	cd ${CONFIGURE_WRKSRC} && ${MAKE_CMD} tests && ${MAKE_CMD} test
+
+.include <bsd.port.mk>
diff --git a/sysutils/createrepo_c/distinfo b/sysutils/createrepo_c/distinfo
new file mode 100644
index 000000000000..a6910eb10c12
--- /dev/null
+++ b/sysutils/createrepo_c/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1727704540
+SHA256 (rpm-software-management-createrepo_c-1.1.4_GH0.tar.gz) = b4f020ef0400e3f9840d37d16238bda2b529b47749dcea6f43c9038056c64669
+SIZE (rpm-software-management-createrepo_c-1.1.4_GH0.tar.gz) = 638216
diff --git a/sysutils/createrepo_c/files/patch-src_compression__wrapper.c b/sysutils/createrepo_c/files/patch-src_compression__wrapper.c
new file mode 100644
index 000000000000..89906a22ce47
--- /dev/null
+++ b/sysutils/createrepo_c/files/patch-src_compression__wrapper.c
@@ -0,0 +1,10 @@
+--- src/compression_wrapper.c.orig	2024-08-14 21:41:31 UTC
++++ src/compression_wrapper.c
+@@ -35,6 +35,7 @@
+ #include "error.h"
+ #include "compression_wrapper.h"
+ #include <zstd.h>
++#include <unistd.h>  // FreeBSD: Add STDOUT_FILENO
+ 
+ 
+ #define ERR_DOMAIN                      CREATEREPO_C_ERROR
diff --git a/sysutils/createrepo_c/pkg-descr b/sysutils/createrepo_c/pkg-descr
new file mode 100644
index 000000000000..4048b645426c
--- /dev/null
+++ b/sysutils/createrepo_c/pkg-descr
@@ -0,0 +1,3 @@
+createrepo_c is a C implementation of the createrepo tool, which generates
+metadata for RPM package repositories. It is optimized for performance and
+provides new features compared to the original createrepo written in Python.
diff --git a/sysutils/createrepo_c/pkg-plist b/sysutils/createrepo_c/pkg-plist
new file mode 100644
index 000000000000..6ff8accebe4b
--- /dev/null
+++ b/sysutils/createrepo_c/pkg-plist
@@ -0,0 +1,37 @@
+bin/createrepo_c
+bin/mergerepo_c
+bin/modifyrepo_c
+bin/sqliterepo_c
+include/createrepo_c/checksum.h
+include/createrepo_c/compression_wrapper.h
+include/createrepo_c/constants.h
+include/createrepo_c/createrepo_c.h
+include/createrepo_c/createrepo_shared.h
+include/createrepo_c/deltarpms.h
+include/createrepo_c/error.h
+include/createrepo_c/helpers.h
+include/createrepo_c/koji.h
+include/createrepo_c/load_metadata.h
+include/createrepo_c/locate_metadata.h
+include/createrepo_c/mergerepo_c.h
+include/createrepo_c/misc.h
+include/createrepo_c/modifyrepo_shared.h
+include/createrepo_c/package.h
+include/createrepo_c/parsehdr.h
+include/createrepo_c/parsepkg.h
+include/createrepo_c/repomd.h
+include/createrepo_c/sqlite.h
+include/createrepo_c/threads.h
+include/createrepo_c/updateinfo.h
+include/createrepo_c/version.h
+include/createrepo_c/xml_dump.h
+include/createrepo_c/xml_file.h
+include/createrepo_c/xml_parser.h
+lib/libcreaterepo_c.so
+lib/libcreaterepo_c.so.1
+lib/libcreaterepo_c.so.1.1.4
+libdata/pkgconfig/createrepo_c.pc
+share/man/man8/createrepo_c.8.gz
+share/man/man8/mergerepo_c.8.gz
+share/man/man8/modifyrepo_c.8.gz
+share/man/man8/sqliterepo_c.8.gz