From 00007ce8cecd281a981e9c6c80b64f5f3cb8a6e9 Mon Sep 17 00:00:00 2001
From: Paul Morgan <jumanjiman@gmail.com>
Date: Tue, 22 Aug 2017 22:07:45 +0000
Subject: [PATCH] testing/createrepo_c: new aport

This is a C implementation of createrepo and
is smaller and faster than (the python-based) createrepo.

The base package provides utilities to manipulate yum repositories:

- createrepo_c
- mergerepo_c
- modifyrepo_c
- sqliterepo_c

Subpackages provide additional features.
---
 testing/createrepo_c/10-libdir.patch |   8 ++
 testing/createrepo_c/APKBUILD        | 108 +++++++++++++++++++++++++++
 2 files changed, 116 insertions(+)
 create mode 100644 testing/createrepo_c/10-libdir.patch
 create mode 100644 testing/createrepo_c/APKBUILD

diff --git a/testing/createrepo_c/10-libdir.patch b/testing/createrepo_c/10-libdir.patch
new file mode 100644
index 000000000000..82848b403035
--- /dev/null
+++ b/testing/createrepo_c/10-libdir.patch
@@ -0,0 +1,8 @@
+--- ./src/CMakeLists.txt.orig
++++ ./src/CMakeLists.txt
+@@ -110,4 +110 @@
+-IF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+-    SET (LIB_SUFFIX "64")
+-ENDIF (CMAKE_SIZEOF_VOID_P MATCHES "8")
+-SET (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}")
++SET (LIB_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
diff --git a/testing/createrepo_c/APKBUILD b/testing/createrepo_c/APKBUILD
new file mode 100644
index 000000000000..54325b6f900e
--- /dev/null
+++ b/testing/createrepo_c/APKBUILD
@@ -0,0 +1,108 @@
+# Contributor:
+# Maintainer: Paul Morgan <jumanjiman@gmail.com>
+pkgname=createrepo_c
+
+# This is awful, but it allows to create package with recent commits.
+# Upstream has not tagged a release in nearly two years, but
+# they have commits in master that we want to use.
+# Follow the lead of 'git-describe' and
+# append a number that represents the number of commits since last tag.
+# After upstream releases a new tag, go back to normal alpine versioning.
+# git_describe="0.10.0-48-g0cac54d"
+treeish="0cac54d09b5a2140b625cabad95dc48898e25cdd"
+upstream_tag=0.10.0
+commits_since=48
+
+pkgver=${upstream_tag}.${commits_since}
+pkgrel=0
+pkgdesc="C implementation of createrepo"
+url="https://github.com/rpm-software-management/createrepo_c/"
+arch="all"
+license="GPL2"
+makedepends="
+	bash-completion
+	bzip2-dev
+	cmake
+	curl-dev
+	expat-dev
+	file-dev
+	glib-dev
+	libressl-dev
+	libxml2-dev
+	python2-dev
+	rpm-dev
+	scanelf
+	sqlite-dev
+	xz-dev
+	zlib-dev
+	"
+checkdepends="
+	${makedepends}
+	check
+	check-dev
+	py-nose
+	xz
+	"
+subpackages="
+	${pkgname}-bash-completion:bashcomp:noarch
+	${pkgname}-dev
+	${pkgname}-doc
+	${pkgname}-libs
+	py2-${pkgname}:py2
+	"
+source="
+	${pkgname}-${treeish}.tar.gz::https://github.com/rpm-software-management/createrepo_c/archive/${treeish}.tar.gz
+	10-libdir.patch
+	"
+builddir="${srcdir}/${pkgname}-${treeish}/"
+
+build() {
+	mkdir "${builddir}"/build
+	cd "${builddir}"/build
+
+	# Pass cmake variables so
+	# end user does not need to set LD_LIBRARY_PATH.
+	# https://cmake.org/Wiki/CMake_RPATH_handling#Always_full_RPATH
+	cmake .. \
+		-DCMAKE_BUILD_TYPE=Release \
+		-DCMAKE_INSTALL_PREFIX=/usr \
+		-DCMAKE_INSTALL_LIBDIR=lib \
+		-DCMAKE_SKIP_BUILD_RPATH=false \
+		-DCMAKE_BUILD_WITH_INSTALL_RPATH=false \
+		-DCMAKE_INSTALL_RPATH=/usr/lib \
+		-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=true \
+		-DPYTHON_DESIRED=2
+	make
+}
+
+check() {
+	cd "${builddir}"/build
+	make tests
+	tests/run_gtester.sh
+}
+
+package() {
+	cd "${builddir}"/build
+	make install/strip DESTDIR=${pkgdir}
+}
+
+py2() {
+	pkgdesc="Python2 bindings for createrepo_c"
+	depends="python2 ${pkgname}-libs"
+
+	# This is architecture-specific and provides a *.so file.
+	mkdir -p "${subpkgdir}"/usr/lib
+	mv "${pkgdir}"/usr/lib/python* "${subpkgdir}"/usr/lib/
+}
+
+bashcomp() {
+	depends=""
+	pkgdesc="Bash completions for ${pkgname}"
+	install_if="${pkgname}=${pkgver}-r${pkgrel} bash-completion"
+
+	mkdir -p "${subpkgdir}"/usr/share/
+	mv "${pkgdir}"/usr/share/bash-completion "${subpkgdir}"/usr/share/
+}
+
+sha512sums="e1e76d4a7c27af812d2ccf48512491377baeaa2506617ef6a6070dd04327a48b7f16e07bf8e84f8793db3fb5c8d0b79cd88cee4f013f86be2244a5750ccf08c0  createrepo_c-0cac54d09b5a2140b625cabad95dc48898e25cdd.tar.gz
+df861d341d2acf5aba85d2bf0b959a7b22a29315efb0efeeada3871d7f1c4be035d27ff2408f55f3df24e6e11a8e5d7c4c88fd0ce25e4377b5452e861b40e188  10-libdir.patch"
-- 
GitLab