[packages/createrepo_c] - new; ported to rpm5, but tests fail

qboosh qboosh at pld-linux.org
Wed Dec 4 19:37:31 CET 2013


commit eb85e3be7bcf6a1ad088e6edb9f7460060a8a406
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Wed Dec 4 19:38:40 2013 +0100

    - new; ported to rpm5, but tests fail

 createrepo_c-rpm5.patch | 152 ++++++++++++++++++++++++++++++++++++++
 createrepo_c.spec       | 189 ++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 341 insertions(+)
---
diff --git a/createrepo_c.spec b/createrepo_c.spec
new file mode 100644
index 0000000..ab50e8e
--- /dev/null
+++ b/createrepo_c.spec
@@ -0,0 +1,189 @@
+# TODO: tests fail (rpm.org vs rpm5 compat problems?)
+#
+# Conditional build:
+%bcond_without	tests	# make tests
+#
+Summary:	Creates a common metadata repository
+Summary(pl.UTF-8):	Tworzenie wspólnego repozytorium metadanych
+Name:		createrepo_c
+Version:	0.2.1
+%define	snap	20131129
+Release:	0.%{snap}.1
+License:	GPL v2+
+Group:		Applications/System
+# git clone https://github.com/Tojaj/createrepo_c
+Source0:	createrepo_c.tar.xz
+# Source0-md5:	afc0dabd7f75f2ad2d34a07966ee87ce
+Patch0:		%{name}-rpm5.patch
+URL:		https://github.com/Tojaj/createrepo_c
+BuildRequires:	bzip2-devel
+BuildRequires:	check-devel
+BuildRequires:	cmake >= 2.6
+BuildRequires:	curl-devel
+BuildRequires:	doxygen
+BuildRequires:	expat-devel
+BuildRequires:	glib2-devel >= 1:2.22.0
+BuildRequires:	libmagic-devel
+BuildRequires:	libxml2-devel >= 2
+BuildRequires:	openssl-devel
+BuildRequires:	python-devel >= 2
+%{?with_tests:BuildRequires:	python-nose}
+BuildRequires:	rpm-devel >= 5
+BuildRequires:	rpm-pythonprov
+BuildRequires:	rpmbuild(macros) >= 1.219
+BuildRequires:	sqlite3-devel >= 3
+BuildRequires:	tar >= 1:1.22
+BuildRequires:	xz
+BuildRequires:	xz-devel
+BuildRequires:	zlib-devel
+Requires:	%{name}-libs = %{version}-%{release}
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+C implementation of Createrepo. This utility will generate a common
+metadata repository from a directory of RPM packages.
+
+%description -l pl.UTF-8
+Implementacja w C programu Createrepo. To narzędzie generuje wspólne
+repozytorium metadanych z katalogu pakietów RPM.
+
+%package libs
+Summary:	Library for repodata manipulation
+Summary(pl.UTF-8):	Biblioteka do operacji na danych repozytorium
+Group:		Libraries
+Requires:	glib2 >= 1:2.22.0
+
+%description libs
+This package contains the createrepo_c library for applications to
+easy manipulate with a repodata.
+
+%description libs -l pl.UTF-8
+Ten pakiet zawiera bibliotekę createrepo_c, pozwalającą aplikacjom na
+łatwe operowanie na danych repozytorium (repodata).
+
+%package devel
+Summary:	Header files for createrepo_c library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki createrepo_c
+Group:		Development/Libraries
+Requires:	%{name}-libs = %{version}-%{release}
+Requires:	bzip2-devel
+Requires:	curl-devel
+Requires:	expat-devel
+Requires:	glib2-devel >= 1:2.22.0
+Requires:	libmagic-devel
+Requires:	libxml2-devel >= 2
+Requires:	rpm-devel >= 5
+Requires:	sqlite3-devel >= 3
+Requires:	xz-devel
+Requires:	zlib-devel
+
+%description devel
+This package contains the createrepo_c C header files. These
+development files are for easy manipulation with a repodata.
+
+%description devel -l pl.UTF-8
+Ten pakiet zawiera pliki nagłówkowe C biblioteki createrepo_c. Mają
+na celu łatwe operowanie na danych repozytorium (repodata).
+
+%package apidocs
+Summary:	API documentation for createrepo_c library
+Summary(pl.UTF-8):	Dokumentacja API biblioteki createrepo_c
+Group:		Documentation
+
+%description apidocs
+API documentation for createrepo_c library.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API biblioteki createrepo_c.
+
+%package -n python-createrepo_c
+Summary:	Python bindings for the createrepo_c library
+Summary(pl.UTF-8):	Wiązania Pythona do biblioteki createrepo_c
+Group:		Development/Languages/Python
+Requires:	%{name}-libs = %{version}-%{release}
+
+%description -n python-createrepo_c
+Python bindings for the createrepo_c library.
+
+%description -n python-createrepo_c -l pl.UTF-8
+Wiązania Pythona do biblioteki createrepo_c.
+
+%package -n bash-completion-createrepo_c
+Summary:	Bash completion for createrepo_c commands
+Summary(pl.UTF-8):	Bashowe uzupełnianie dla poleceń createrepo_c
+Group:		Applications/Shells
+Requires:	%{name} = %{version}-%{release}
+Requires:	bash-completion
+
+%description -n bash-completion-createrepo_c
+Bash completion for createrepo_c commands (createrepo_c, mergerepo_c,
+modifyrepo_c).
+
+%description -n bash-completion-createrepo_c -l pl.UTF-8
+Bashowe uzupełnianie dla poleceń createrepo_c (createrepo_c,
+mergerepo_c, modifyrepo_c).
+
+%prep
+%setup -q -n %{name}
+%patch0 -p1
+
+%build
+%cmake .
+%{__make}
+%{__make} doc
+
+%if %{with tests}
+%{__make} tests
+%{__make} test \
+	ARGS="-V"
+%endif
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%{__make} install \
+	DESTDIR=$RPM_BUILD_ROOT
+
+%py_comp $RPM_BUILD_ROOT%{py_sitedir}/createrepo_c
+%py_ocomp $RPM_BUILD_ROOT%{py_sitedir}/createrepo_c
+%py_postclean
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%post	libs -p /sbin/ldconfig
+%postun	libs -p /sbin/ldconfig
+
+%files
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/createrepo_c
+%attr(755,root,root) %{_bindir}/mergerepo_c
+%attr(755,root,root) %{_bindir}/modifyrepo_c
+%{_mandir}/man8/createrepo_c.8*
+%{_mandir}/man8/mergerepo_c.8*
+
+%files libs
+%defattr(644,root,root,755)
+%doc AUTHORS README.md
+%attr(755,root,root) %{_libdir}/libcreaterepo_c.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libcreaterepo_c.so.0
+
+%files devel
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libdir}/libcreaterepo_c.so
+%{_pkgconfigdir}/createrepo_c.pc
+%{_includedir}/createrepo_c
+
+%files apidocs
+%defattr(644,root,root,755)
+%doc doc/html
+
+%files -n python-createrepo_c
+%defattr(644,root,root,755)
+%dir %{py_sitedir}/createrepo_c
+%attr(755,root,root) %{py_sitedir}/createrepo_c/_createrepo_cmodule.so
+%{py_sitedir}/createrepo_c/__init__.py[co]
+
+%files -n bash-completion-createrepo_c
+%defattr(644,root,root,755)
+/etc/bash_completion.d/createrepo_c.bash
diff --git a/createrepo_c-rpm5.patch b/createrepo_c-rpm5.patch
new file mode 100644
index 0000000..16a3f94
--- /dev/null
+++ b/createrepo_c-rpm5.patch
@@ -0,0 +1,152 @@
+--- createrepo_c/src/misc.c.orig	2013-12-01 15:00:42.000000000 +0100
++++ createrepo_c/src/misc.c	2013-12-01 16:18:48.713931227 +0100
+@@ -30,7 +30,7 @@
+ #include <ftw.h>
+ #include <time.h>
+ #include <curl/curl.h>
+-#include <rpm/rpmlib.h>
++#include <rpm/rpmevr.h>
+ #include "error.h"
+ #include "misc.h"
+ 
+--- createrepo_c/CMakeLists.txt.orig	2013-12-01 15:00:42.000000000 +0100
++++ createrepo_c/CMakeLists.txt	2013-12-01 16:21:27.510591230 +0100
+@@ -39,7 +39,7 @@
+ 
+ include_directories(${GLIB2_INCLUDE_DIRS})
+ include_directories(${LIBXML2_INCLUDE_DIR})
+-
++include_directories("/usr/include/rpm")
+ 
+ # rpm:
+ 
+--- createrepo_c/src/parsehdr.h.orig	2013-12-01 15:00:42.000000000 +0100
++++ createrepo_c/src/parsehdr.h	2013-12-01 16:55:23.000505810 +0100
+@@ -24,7 +24,7 @@
+ extern "C" {
+ #endif
+ 
+-#include <rpm/rpmlib.h>
++#include <rpm/rpmtag.h>
+ #include <glib.h>
+ #include "package.h"
+ #include "xml_dump.h"
+--- createrepo_c/src/parsehdr.c.orig	2013-12-01 15:00:42.000000000 +0100
++++ createrepo_c/src/parsehdr.c	2013-12-01 16:33:26.753894379 +0100
+@@ -19,6 +19,7 @@
+ 
+ #include <glib.h>
+ #include <assert.h>
++#include <rpm/rpm46compat.h>
+ #include <rpm/rpmfi.h>
+ #include <stdlib.h>
+ #include "parsehdr.h"
+@@ -26,6 +27,76 @@
+ #include "misc.h"
+ 
+ 
++static inline void* rpmtdNew(void)
++{
++    return malloc(sizeof(struct rpmtd_s));
++}
++
++static inline void rpmtdFree(rpmtd td)
++{
++    return free(td);
++}
++
++static inline void rpmtdInit(rpmtd td)
++{
++    rpmtdReset(td);
++}
++
++static inline const char * headerGetString(Header h, int32_t tag)
++{
++    const char *res = NULL;
++    struct rpmtd_s td;
++
++    if (headerGet(h, tag, &td, HEADERGET_MINMEM)) {
++	if (rpmtdCount(&td) == 1) {
++	    res = rpmtdGetString(&td);
++	}
++	rpmtdFreeData(&td);
++    }
++    return res;
++}
++
++static inline uint64_t rpmtdGetNumber(rpmtd td)
++{
++    uint64_t val = 0;
++    int ix;
++    assert(td != NULL);
++    ix = (td->ix >= 0 ? td->ix : 0);
++
++    switch (td->type) {
++    case RPM_INT64_TYPE:
++	val = *((uint64_t *) td->data + ix);
++	break;
++    case RPM_INT32_TYPE:
++	val = *((uint32_t *) td->data + ix);
++	break;
++    case RPM_INT16_TYPE:
++	val = *((uint16_t *) td->data + ix);
++	break;
++    case RPM_INT8_TYPE:
++    case RPM_CHAR_TYPE:
++	val = *((uint8_t *) td->data + ix);
++	break;
++    default:
++	break;
++    }
++    return val;
++}
++
++static inline uint64_t headerGetNumber(Header h, int32_t tag)
++{
++    uint64_t res = 0;
++    struct rpmtd_s td;
++
++    if (headerGet(h, tag, &td, HEADERGET_EXT)) {
++	if (rpmtdCount(&td) == 1) {
++	    res = rpmtdGetNumber(&td);
++	}
++	rpmtdFreeData(&td);
++    }
++    return res;
++}
++
+ static inline int
+ cr_compare_dependency(const char *dep1, const char *dep2)
+ {
+--- createrepo_c/src/parsepkg.c.orig	2013-12-01 15:00:42.000000000 +0100
++++ createrepo_c/src/parsepkg.c	2013-12-01 16:52:24.660513293 +0100
+@@ -26,14 +26,17 @@
+ #include <unistd.h>
+ #include <rpm/rpmts.h>
+ #include <rpm/rpmfi.h>
+-#include <rpm/rpmlib.h>
+ #include <rpm/rpmmacro.h>
+-#include <rpm/rpmkeyring.h>
++#include <rpm/rpmrc.h>
++#include <rpm/pkgio.h>
+ #include "error.h"
+ #include "parsehdr.h"
+ #include "misc.h"
+ #include "checksum.h"
+ 
++#define _RPMVSF_NOSIGNATURES (RPMVSF_NODSAHEADER | RPMVSF_NORSAHEADER | RPMVSF_NODSA | RPMVSF_NORSA)
++#define	_RPMVSF_NODIGESTS (RPMVSF_NOSHA1HEADER | RPMVSF_NOMD5HEADER | RPMVSF_NOSHA1 | RPMVSF_NOMD5)
++
+ volatile short cr_initialized = 0;
+ rpmts cr_ts = NULL;
+ 
+--- createrepo_c/src/CMakeLists.txt.orig	2013-12-01 15:00:42.000000000 +0100
++++ createrepo_c/src/CMakeLists.txt	2013-12-01 16:53:42.373843363 +0100
+@@ -55,6 +55,7 @@
+ TARGET_LINK_LIBRARIES(libcreaterepo_c ${LZMA_LIBRARIES})
+ TARGET_LINK_LIBRARIES(libcreaterepo_c ${OPENSSL_LIBRARIES})
+ TARGET_LINK_LIBRARIES(libcreaterepo_c ${RPMDB_LIBRARY})
++TARGET_LINK_LIBRARIES(libcreaterepo_c rpm)
+ TARGET_LINK_LIBRARIES(libcreaterepo_c ${SQLITE3_LIBRARIES})
+ TARGET_LINK_LIBRARIES(libcreaterepo_c ${ZLIB_LIBRARY})
+ 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/createrepo_c.git/commitdiff/eb85e3be7bcf6a1ad088e6edb9f7460060a8a406



More information about the pld-cvs-commit mailing list