Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Sep 2020 22:30:11 +0000 (UTC)
From:      Yuri Victorovich <yuri@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r550088 - in head/misc: . librepo librepo/files
Message-ID:  <202009252230.08PMUBmt053916@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yuri
Date: Fri Sep 25 22:30:11 2020
New Revision: 550088
URL: https://svnweb.freebsd.org/changeset/ports/550088

Log:
  New port: misc/librepo: Library downloading repository metadata

Added:
  head/misc/librepo/
  head/misc/librepo/Makefile   (contents, props changed)
  head/misc/librepo/distinfo   (contents, props changed)
  head/misc/librepo/files/
  head/misc/librepo/files/patch-CMakeLists.txt   (contents, props changed)
  head/misc/librepo/files/patch-librepo_CMakeLists.txt   (contents, props changed)
  head/misc/librepo/files/patch-librepo_checksum.c   (contents, props changed)
  head/misc/librepo/files/patch-librepo_downloader.c   (contents, props changed)
  head/misc/librepo/files/patch-librepo_librepo.pc.cmake   (contents, props changed)
  head/misc/librepo/files/patch-tests_test__checksum.c   (contents, props changed)
  head/misc/librepo/files/xattr.c   (contents, props changed)
  head/misc/librepo/files/xattr.h   (contents, props changed)
  head/misc/librepo/pkg-descr   (contents, props changed)
  head/misc/librepo/pkg-plist   (contents, props changed)
Modified:
  head/misc/Makefile

Modified: head/misc/Makefile
==============================================================================
--- head/misc/Makefile	Fri Sep 25 22:28:31 2020	(r550087)
+++ head/misc/Makefile	Fri Sep 25 22:30:11 2020	(r550088)
@@ -216,6 +216,7 @@
     SUBDIR += libpostal
     SUBDIR += libpredict
     SUBDIR += libpri
+    SUBDIR += librepo
     SUBDIR += libsolv
     SUBDIR += libsupertone
     SUBDIR += libsweep-lidar

Added: head/misc/librepo/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/Makefile	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,43 @@
+# $FreeBSD$
+
+PORTNAME=	librepo
+DISTVERSION=	1.12.1
+CATEGORIES=	misc
+
+MAINTAINER=	yuri@FreeBSD.org
+COMMENT=	Library downloading repository metadata
+
+LICENSE=	MIT
+LICENSE_FILE=	${WRKSRC}/COPYING
+
+LIB_DEPENDS=	libassuan.so:security/libassuan \
+		libcurl.so:ftp/curl \
+		libgpg-error.so:security/libgpg-error \
+		libgpgme.so:security/gpgme
+
+USES=		gettext-runtime gnome cmake localbase:ldflags pkgconfig
+USE_GNOME=	glib20 libxml2
+USE_LDCONFIG=	yes
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	rpm-software-management
+
+CMAKE_OFF=	ENABLE_DOCS ENABLE_TESTS
+
+OPTIONS_DEFINE=		PYTHON ZCHUNK
+OPTIONS_DEFAULT=	ZCHUNK
+OPTIONS_SUB=		yes
+
+PYTHON_USES=		python
+PYTHON_CMAKE_BOOL=	ENABLE_PYTHON
+PYTHON_CMAKE_ON=	-DPYTHON_DESIRED=${PYTHON_MAJOR_VER}
+
+ZCHUNK_DESC=		Build with zchunk support
+ZCHUNK_CMAKE_BOOL=	WITH_ZCHUNK
+ZCHUNK_LIB_DEPENDS=	libzck.so:archivers/zchunk
+
+post-patch:
+	@${RLN} ${FILESDIR}/xattr.c ${WRKSRC}/librepo/xattr.c
+	@${RLN} ${FILESDIR}/xattr.h ${WRKSRC}/librepo/xattr.h
+
+.include <bsd.port.mk>

Added: head/misc/librepo/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/distinfo	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,3 @@
+TIMESTAMP = 1600625196
+SHA256 (rpm-software-management-librepo-1.12.1_GH0.tar.gz) = b78113f3aeb0d562b034dbeb926609019b7bed27e05c9ab5a584a9938de8da9f
+SIZE (rpm-software-management-librepo-1.12.1_GH0.tar.gz) = 816206

Added: head/misc/librepo/files/patch-CMakeLists.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/files/patch-CMakeLists.txt	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,27 @@
+--- CMakeLists.txt.orig	2020-08-22 20:15:59 UTC
++++ CMakeLists.txt
+@@ -28,7 +28,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SO
+ 
+ FIND_PACKAGE(PkgConfig)
+ PKG_CHECK_MODULES(GLIB2 glib-2.0 REQUIRED)
+-PKG_SEARCH_MODULE(LIBCRYPTO REQUIRED libcrypto openssl)
++#PKG_SEARCH_MODULE(LIBCRYPTO REQUIRED libcrypto openssl)
+ PKG_CHECK_MODULES(LIBXML2 libxml-2.0 REQUIRED)
+ FIND_PACKAGE(CURL REQUIRED)
+ FIND_PACKAGE(Gpgme REQUIRED)
+@@ -66,6 +66,7 @@ INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
+ include (GNUInstallDirs)
+ # Python stuff
+ 
++if (ENABLE_PYTHON)
+ IF (NOT PYTHON_DESIRED)
+     FIND_PACKAGE (PythonInterp REQUIRED)
+ ELSEIF (${PYTHON_DESIRED} STREQUAL "2")
+@@ -79,6 +80,7 @@ ELSE ()
+     MESSAGE (FATAL_ERROR "Invalid PYTHON_DESIRED value: " ${PYTHON_DESIRED})
+ ENDIF()
+ FIND_PACKAGE (PythonLibs REQUIRED)
++endif()
+ 
+ 
+ # Subdirs

Added: head/misc/librepo/files/patch-librepo_CMakeLists.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/files/patch-librepo_CMakeLists.txt	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,19 @@
+--- librepo/CMakeLists.txt.orig	2020-08-22 20:15:59 UTC
++++ librepo/CMakeLists.txt
+@@ -18,7 +18,8 @@ SET (librepo_SRCS
+      url_substitution.c
+      util.c
+      xmlparser.c
+-     yum.c)
++     yum.c
++     xattr.c)
+ 
+ SET(librepo_HEADERS
+     checksum.h
+@@ -73,4 +74,6 @@ INSTALL(TARGETS librepo LIBRARY DESTINATION ${CMAKE_IN
+ INSTALL(FILES "${CMAKE_BINARY_DIR}/librepo.pc"
+ 	DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
+ 
++if (ENABLE_PYTHON)
+ ADD_SUBDIRECTORY(python)
++endif()

Added: head/misc/librepo/files/patch-librepo_checksum.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/files/patch-librepo_checksum.c	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,11 @@
+--- librepo/checksum.c.orig	2020-09-20 18:54:37 UTC
++++ librepo/checksum.c
+@@ -26,7 +26,7 @@
+ #include <errno.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+-#include <sys/xattr.h>
++#include "xattr.h"
+ #include <unistd.h>
+ #include <openssl/evp.h>
+ 

Added: head/misc/librepo/files/patch-librepo_downloader.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/files/patch-librepo_downloader.c	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,23 @@
+--- librepo/downloader.c.orig	2020-08-22 20:15:59 UTC
++++ librepo/downloader.c
+@@ -18,9 +18,11 @@
+  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+  */
+ 
++#if __FreeBSD__
+ #define _XOPEN_SOURCE   500 // Because of fdopen() and ftruncate()
+ #define _DEFAULT_SOURCE     // Because of futimes()
+ #define _BSD_SOURCE         // Because of futimes()
++#endif
+ 
+ #include <glib.h>
+ #include <assert.h>
+@@ -31,7 +33,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/time.h>
+-#include <sys/xattr.h>
++#include "xattr.h"
+ #include <fcntl.h>
+ #include <curl/curl.h>
+ 

Added: head/misc/librepo/files/patch-librepo_librepo.pc.cmake
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/files/patch-librepo_librepo.pc.cmake	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,11 @@
+--- librepo/librepo.pc.cmake.orig	2020-09-20 19:51:54 UTC
++++ librepo/librepo.pc.cmake
+@@ -6,7 +6,7 @@ Name: librepo
+ Description: Repodata downloading library.
+ Version: @VERSION@
+ Requires: glib-2.0
+-Requires.private: libcurl openssl libxml-2.0
++Requires.private: libcurl libxml-2.0
+ Libs: -L${libdir} -lrepo
+ Libs.private: -lgpgme -lgpg-error
+ Cflags: -I${includedir} -D_FILE_OFFSET_BITS=64

Added: head/misc/librepo/files/patch-tests_test__checksum.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/files/patch-tests_test__checksum.c	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,11 @@
+--- tests/test_checksum.c.orig	2020-09-20 19:02:27 UTC
++++ tests/test_checksum.c
+@@ -6,7 +6,7 @@
+ #include <string.h>
+ #include <sys/types.h>
+ #include <sys/stat.h>
+-#include <sys/xattr.h>
++#include "xattr.h"
+ #include <fcntl.h>
+ 
+ #include "librepo/util.h"

Added: head/misc/librepo/files/xattr.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/files/xattr.c	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,32 @@
+
+#include <sys/types.h>
+#include <sys/extattr.h>
+
+
+///
+/// xattr is a Linux kernel API that has to be mapped to the FreeBSD API
+///
+
+// code below is adopted and simplified from the 'xattr' python module https://github.com/xattr/xattr/blob/master/xattr/lib_build.c
+
+int fsetxattr(int fd, const char *name, const void *value, size_t size, int flags) {
+	int rv = 0;
+
+	assert(flags == 0); // we do not handle flags here and the project currently doesn't use flags!=0
+
+	rv = extattr_set_fd(fd, EXTATTR_NAMESPACE_USER, name, value, size);
+
+	/* freebsd returns the written length on success, not zero. */
+	if (rv >= 0)
+		return 0;
+	else
+		return rv;
+}
+
+ssize_t fgetxattr(int fd, const char *name, void *value, size_t size) {
+	return extattr_get_fd(fd, EXTATTR_NAMESPACE_USER, name, value, size);
+}
+
+int fremovexattr(int fd, const char *name) {
+	return extattr_delete_fd(fd, EXTATTR_NAMESPACE_USER, name);
+}

Added: head/misc/librepo/files/xattr.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/files/xattr.h	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,4 @@
+
+int fsetxattr(int fd, const char *name, const void *value, size_t size, int flags);
+ssize_t fgetxattr(int fd, const char *name, void *value, size_t size);
+int fremovexattr(int fd, const char *name);

Added: head/misc/librepo/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/pkg-descr	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,4 @@
+A library providing C and Python (libcURL like) API for downloading linux
+repository metadata and packages.
+
+WWW: https://github.com/rpm-software-management/librepo

Added: head/misc/librepo/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/misc/librepo/pkg-plist	Fri Sep 25 22:30:11 2020	(r550088)
@@ -0,0 +1,28 @@
+include/librepo/checksum.h
+include/librepo/downloader.h
+include/librepo/downloader_internal.h
+include/librepo/downloadtarget.h
+include/librepo/fastestmirror.h
+include/librepo/gpg.h
+include/librepo/handle.h
+include/librepo/librepo.h
+include/librepo/metadata_downloader.h
+include/librepo/metalink.h
+include/librepo/mirrorlist.h
+include/librepo/package_downloader.h
+include/librepo/rcodes.h
+include/librepo/repoconf.h
+include/librepo/repomd.h
+include/librepo/repoutil_yum.h
+include/librepo/result.h
+include/librepo/types.h
+include/librepo/url_substitution.h
+include/librepo/util.h
+include/librepo/version.h
+include/librepo/xmlparser.h
+include/librepo/yum.h
+lib/librepo.so
+lib/librepo.so.0
+%%PYTHON%%%%PYTHON_SITELIBDIR%%/librepo/__init__.py
+%%PYTHON%%%%PYTHON_SITELIBDIR%%/librepo/_librepo.so
+libdata/pkgconfig/librepo.pc



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009252230.08PMUBmt053916>