[packages/drpm] - initial; does not build with rpm5

qboosh qboosh at pld-linux.org
Sat May 26 22:10:10 CEST 2018


commit d149f882517bb8c6a3954bac41bf45b0b2b27675
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sat May 26 22:10:56 2018 +0200

    - initial; does not build with rpm5

 drpm-cmake.patch |  40 ++++++++++++++++++
 drpm-rpm5.patch  |  76 ++++++++++++++++++++++++++++++++++
 drpm.spec        | 121 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 237 insertions(+)
---
diff --git a/drpm.spec b/drpm.spec
new file mode 100644
index 0000000..c3cd721
--- /dev/null
+++ b/drpm.spec
@@ -0,0 +1,121 @@
+# TODO: more rpm5 porting or use rpm.org
+#
+# Conditional build:
+%bcond_without	apidocs		# API documentation
+%bcond_without	tests		# tests
+#
+Summary:	Library for making, reading and applying deltarpm packages
+Summary(pl.UTF-8):	Biblioteka do tworzenia, odczytu i aplikowania pakietów deltarpm
+Name:		drpm
+Version:	0.3.0
+Release:	0.1
+# drpm_{diff,search}.c are BSD; the rest LGPL v3+
+License:	LGPL v3+ with BSD parts
+Group:		Libraries
+#Source0Download: https://github.com/rpm-software-management/drpm/releases
+Source0:	https://github.com/rpm-software-management/drpm/releases/download/%{version}/%{name}-%{version}.tar.bz2
+# Source0-md5:	e1ca38e14f52d0f5229bba45ba8b8904
+Patch0:		%{name}-cmake.patch
+# not enough, drpm uses too many rpm4.6+ APIs
+Patch1:		%{name}-rpm5.patch
+URL:		https://github.com/rpm-software-management/drpm
+BuildRequires:	bzip2-devel
+BuildRequires:	cmake >= 2.8
+BuildRequires:	doxygen
+#BuildRequires:	lzlib-devel
+BuildRequires:	openssl-devel
+BuildRequires:	pkgconfig
+BuildRequires:	rpm-devel
+BuildRequires:	xz-devel
+BuildRequires:	zlib-devel
+%if %{with tests}
+BuildRequires:	cmocka-devel
+BuildRequires:	deltarpm
+BuildRequires:	valgrind
+%endif
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Library for making, reading and applying deltarpm packages.
+
+%description -l pl.UTF-8
+Biblioteka do tworzenia, odczytu i aplikowania pakietów deltarpm.
+
+%package devel
+Summary:	Header files for drpm library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki drpm
+Group:		Development/Libraries
+Requires:	%{name} = %{version}-%{release}
+
+%description devel
+Header files for drpm library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki drpm.
+
+%package apidocs
+Summary:	API documentation for drpm library
+Summary(pl.UTF-8):	Dokumentacja API biblioteki drpm
+Group:		Documentation
+%if "%{_rpmversion}" >= "5"
+BuildArch:	noarch
+%endif
+
+%description apidocs
+API documentation for drpm library.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API biblioteki drpm.
+
+%prep
+%setup -q
+%patch0 -p1
+%patch1 -p1
+
+%build
+install -d build
+cd build
+CFLAGS="%{rpmcflags} %{rpmcppflags} -I/usr/include/rpm"
+%cmake .. \
+	-DINCLUDE_INSTALL_DIR=%{_includedir} \
+	-DLIB_INSTALL_DIR=%{_lib}
+
+%{__make}
+
+%if %{with tests}
+ctest
+%endif
+
+%if %{with apidocs}
+%{__make} -C doc doc
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	-p /sbin/ldconfig
+%postun	-p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSE.BSD
+%attr(755,root,root) %{_libdir}/libdrpm.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libdrpm.so.0
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libdrpm.so
+%{_includedir}/drpm.h
+%{_pkgconfigdir}/drpm.pc
+
+%if %{with apidocs}
+%files apidocs
+%defattr(644,root,root,755)
+%doc build/doc/html/*
+%endif
diff --git a/drpm-cmake.patch b/drpm-cmake.patch
new file mode 100644
index 0000000..257f67b
--- /dev/null
+++ b/drpm-cmake.patch
@@ -0,0 +1,40 @@
+--- drpm-0.3.0/src/CMakeLists.txt.orig	2016-05-04 10:53:56.000000000 +0200
++++ drpm-0.3.0/src/CMakeLists.txt	2018-05-12 21:55:55.404743698 +0200
+@@ -5,8 +5,6 @@
+ set(DRPM_VERSION ${DRPM_VERSION_MAJOR}.${DRPM_VERSION_MINOR}.${DRPM_VERSION_PATCH})
+ set(DRPM_SOVERSION ${DRPM_VERSION_MAJOR})
+ 
+-set(CMAKE_BUILD_TYPE RelWithDebInfo)
+-
+ if (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
+    set(ARCH_LESS_64BIT 1)
+ endif()
+#@@ -14,7 +14,7 @@
+# add_library(drpm SHARED ${DRPM_SOURCES})
+# 
+# set_source_files_properties(${DRPM_SOURCES} PROPERTIES
+#-   COMPILE_FLAGS "-std=c99 -pedantic -Wall -Wextra -DHAVE_CONFIG_H -I${CMAKE_BINARY_DIR}"
+#+   COMPILE_FLAGS "${CFLAGS} ${CPPFLAGS} -std=c99 -pedantic -Wall -Wextra -DHAVE_CONFIG_H -I${CMAKE_BINARY_DIR}"
+# )
+# 
+# target_link_libraries(drpm ${DRPM_LINK_LIBRARIES})
+--- drpm-0.3.0/test/CMakeLists.txt.orig	2016-05-12 17:12:05.000000000 +0200
++++ drpm-0.3.0/test/CMakeLists.txt	2018-05-12 22:06:03.454736755 +0200
+@@ -12,8 +12,6 @@
+ set(DRPM_TEST_ARGS_CMP_FILES -d ${CMAKE_CURRENT_BINARY_DIR})
+ set(DRPM_TEST_ARGS_VALGRIND --error-exitcode=1 --read-var-info=yes --leak-check=full --show-leak-kinds=all --track-origins=yes --suppressions=${CMAKE_CURRENT_SOURCE_DIR}/lzma.supp)
+ 
+-set(CMAKE_BUILD_TYPE RelWithDebInfo)
+-
+ file(
+    COPY ${DRPM_TEST_FILES}
+    DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
+#@@ -33,7 +31,7 @@
+# add_executable(drpm_api_tests ${DRPM_TEST_SOURCES})
+# 
+# set_source_files_properties(${DRPM_TEST_SOURCES} PROPERTIES
+#-   COMPILE_FLAGS "-std=c99 -pedantic -Wall -Wextra -DHAVE_CONFIG_H -I${CMAKE_BINARY_DIR}"
+#+   COMPILE_FLAGS "${CFLAGS} ${CPPFLAGS} -std=c99 -pedantic -Wall -Wextra -DHAVE_CONFIG_H -I${CMAKE_BINARY_DIR}"
+# )
+# 
+# target_link_libraries(drpm_api_tests ${DRPM_LINK_LIBRARIES} ${CMOCKA_LIBRARIES})
diff --git a/drpm-rpm5.patch b/drpm-rpm5.patch
new file mode 100644
index 0000000..9cd897e
--- /dev/null
+++ b/drpm-rpm5.patch
@@ -0,0 +1,76 @@
+--- drpm-0.3.0/src/drpm_make.c.orig	2016-05-09 16:20:20.000000000 +0200
++++ drpm-0.3.0/src/drpm_make.c	2018-05-12 22:40:19.794713274 +0200
+@@ -33,8 +33,7 @@
+ #include <openssl/md5.h>
+ #include <openssl/sha.h>
+ #include <rpm/rpmfi.h>
+-#include <rpm/rpmvf.h>
+-#include <rpm/rpmfc.h>
++#include <rpm/rpmcli.h>
+ #include <linux/kdev_t.h>
+ 
+ #define BUFFER_SIZE 4096
+@@ -47,6 +46,12 @@
+ 
+ #define MAGIC_RPML 0x52504D4C
+ 
++#ifndef RPMFC_ELF32
++#define RPMFC_ELF32 1
++#define RPMFC_ELF64 2
++#define RPMFC_ELFX32 4
++#endif
++
+ #ifndef RPMFILE_UNPATCHED
+ #define RPMFILE_UNPATCHED (1 << 10)
+ #endif
+@@ -406,10 +411,10 @@
+             } else if (S_ISREG(file.mode)) {
+                 skip = (c_filesize != file.size) ||
+                        ((file.flags & (RPMFILE_CONFIG | RPMFILE_MISSINGOK | RPMFILE_GHOST)) != 0) ||
+-                       ((file.verify & VERIFY_MD5) == 0 ||
++                       ((file.verify & VERIFY_FDIGEST) == 0 ||
+                         (file.verify & VERIFY_SIZE) == 0) ||
+                        (file_colors &&
+-                        (file.color & (RPMFC_ELF32 | RPMFC_ELF64)) != 0 &&
++                        (file.color & (RPMFC_ELF32 | RPMFC_ELF64 | RPMFC_ELFX32)) != 0 &&
+                         !IN_MULTILIB_DIR(name));
+                 cpio_hdr.filesize = file.size;
+             } else if (S_ISLNK(file.mode)) {
+--- drpm-0.3.0/src/drpm_rpm.c.orig	2018-05-26 21:00:46.384303338 +0200
++++ drpm-0.3.0/src/drpm_rpm.c	2018-05-26 21:00:49.630969967 +0200
+@@ -18,6 +18,7 @@
+     along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+ 
++#define _DEFAULT_SOURCE /* for u_* types in db.h */
+ #include "drpm.h"
+ #include "drpm_private.h"
+ 
+@@ -25,7 +26,8 @@
+ #include <string.h>
+ #include <limits.h>
+ #include <fcntl.h>
+-#include <rpm/rpmlib.h>
++#include <rpm/rpm46compat.h>
++#include <rpm/rpmio.h>
+ #include <rpm/rpmts.h>
+ #include <rpm/rpmdb.h>
+ #include <openssl/md5.h>
+@@ -54,7 +56,7 @@
+ static void rpm_free(struct rpm *);
+ static int rpm_export_header(struct rpm *, unsigned char **, size_t *);
+ static int rpm_export_signature(struct rpm *, unsigned char **, size_t *);
+-static void rpm_header_unload_region(struct rpm *, rpmTagVal);
++static void rpm_header_unload_region(struct rpm *, rpmTag);
+ static int rpm_read_archive(struct rpm *, const char *, off_t, bool,
+                             unsigned short *, MD5_CTX *, MD5_CTX *);
+ 
+@@ -144,7 +146,7 @@
+     return DRPM_ERR_OK;
+ }
+ 
+-void rpm_header_unload_region(struct rpm *rpmst, rpmTagVal rpmtag)
++void rpm_header_unload_region(struct rpm *rpmst, rpmTag rpmtag)
+ {
+     Header hdr;
+     HeaderIterator hdr_iter;
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/drpm.git/commitdiff/d149f882517bb8c6a3954bac41bf45b0b2b27675



More information about the pld-cvs-commit mailing list