diff options
author | Yuri Victorovich <yuri@FreeBSD.org> | 2020-09-26 06:30:11 +0800 |
---|---|---|
committer | Yuri Victorovich <yuri@FreeBSD.org> | 2020-09-26 06:30:11 +0800 |
commit | 67f362deb11608426e6fd6b93a32052d63148b4b (patch) | |
tree | 677f89a6ada917367ffd751257ee7d979373649d /misc | |
parent | 87f1e62a93241efe26e2d0d961b46c6b7090b7ca (diff) | |
download | freebsd-ports-gnome-67f362deb11608426e6fd6b93a32052d63148b4b.tar.gz freebsd-ports-gnome-67f362deb11608426e6fd6b93a32052d63148b4b.tar.zst freebsd-ports-gnome-67f362deb11608426e6fd6b93a32052d63148b4b.zip |
New port: misc/librepo: Library downloading repository metadata
Diffstat (limited to 'misc')
-rw-r--r-- | misc/Makefile | 1 | ||||
-rw-r--r-- | misc/librepo/Makefile | 43 | ||||
-rw-r--r-- | misc/librepo/distinfo | 3 | ||||
-rw-r--r-- | misc/librepo/files/patch-CMakeLists.txt | 27 | ||||
-rw-r--r-- | misc/librepo/files/patch-librepo_CMakeLists.txt | 19 | ||||
-rw-r--r-- | misc/librepo/files/patch-librepo_checksum.c | 11 | ||||
-rw-r--r-- | misc/librepo/files/patch-librepo_downloader.c | 23 | ||||
-rw-r--r-- | misc/librepo/files/patch-librepo_librepo.pc.cmake | 11 | ||||
-rw-r--r-- | misc/librepo/files/patch-tests_test__checksum.c | 11 | ||||
-rw-r--r-- | misc/librepo/files/xattr.c | 32 | ||||
-rw-r--r-- | misc/librepo/files/xattr.h | 4 | ||||
-rw-r--r-- | misc/librepo/pkg-descr | 4 | ||||
-rw-r--r-- | misc/librepo/pkg-plist | 28 |
13 files changed, 217 insertions, 0 deletions
diff --git a/misc/Makefile b/misc/Makefile index bf2ae0bc41ef..238ca3a85535 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -216,6 +216,7 @@ SUBDIR += libpostal SUBDIR += libpredict SUBDIR += libpri + SUBDIR += librepo SUBDIR += libsolv SUBDIR += libsupertone SUBDIR += libsweep-lidar diff --git a/misc/librepo/Makefile b/misc/librepo/Makefile new file mode 100644 index 000000000000..5b68dc690602 --- /dev/null +++ b/misc/librepo/Makefile @@ -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> diff --git a/misc/librepo/distinfo b/misc/librepo/distinfo new file mode 100644 index 000000000000..2a4a20721f55 --- /dev/null +++ b/misc/librepo/distinfo @@ -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 diff --git a/misc/librepo/files/patch-CMakeLists.txt b/misc/librepo/files/patch-CMakeLists.txt new file mode 100644 index 000000000000..26182931ed88 --- /dev/null +++ b/misc/librepo/files/patch-CMakeLists.txt @@ -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 diff --git a/misc/librepo/files/patch-librepo_CMakeLists.txt b/misc/librepo/files/patch-librepo_CMakeLists.txt new file mode 100644 index 000000000000..d74cffee9c49 --- /dev/null +++ b/misc/librepo/files/patch-librepo_CMakeLists.txt @@ -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() diff --git a/misc/librepo/files/patch-librepo_checksum.c b/misc/librepo/files/patch-librepo_checksum.c new file mode 100644 index 000000000000..2cc409949df2 --- /dev/null +++ b/misc/librepo/files/patch-librepo_checksum.c @@ -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> + diff --git a/misc/librepo/files/patch-librepo_downloader.c b/misc/librepo/files/patch-librepo_downloader.c new file mode 100644 index 000000000000..ed1fdc00ada9 --- /dev/null +++ b/misc/librepo/files/patch-librepo_downloader.c @@ -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> + diff --git a/misc/librepo/files/patch-librepo_librepo.pc.cmake b/misc/librepo/files/patch-librepo_librepo.pc.cmake new file mode 100644 index 000000000000..cb50eb0bbde4 --- /dev/null +++ b/misc/librepo/files/patch-librepo_librepo.pc.cmake @@ -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 diff --git a/misc/librepo/files/patch-tests_test__checksum.c b/misc/librepo/files/patch-tests_test__checksum.c new file mode 100644 index 000000000000..6af6602ee9af --- /dev/null +++ b/misc/librepo/files/patch-tests_test__checksum.c @@ -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" diff --git a/misc/librepo/files/xattr.c b/misc/librepo/files/xattr.c new file mode 100644 index 000000000000..3797f2117080 --- /dev/null +++ b/misc/librepo/files/xattr.c @@ -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); +} diff --git a/misc/librepo/files/xattr.h b/misc/librepo/files/xattr.h new file mode 100644 index 000000000000..633417b953b3 --- /dev/null +++ b/misc/librepo/files/xattr.h @@ -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); diff --git a/misc/librepo/pkg-descr b/misc/librepo/pkg-descr new file mode 100644 index 000000000000..d7a4e879a8b2 --- /dev/null +++ b/misc/librepo/pkg-descr @@ -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 diff --git a/misc/librepo/pkg-plist b/misc/librepo/pkg-plist new file mode 100644 index 000000000000..40fb759d39be --- /dev/null +++ b/misc/librepo/pkg-plist @@ -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 |