[packages/zif] - updated to 0.2.3 - added rpm5 patch (initial rpm5 port) - added link patch (fixes linking with gpg

qboosh qboosh at pld-linux.org
Tue Nov 19 21:52:28 CET 2013


commit 8a9884f27244f589a12b5e054871d8993c105ec2
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Nov 19 21:53:11 2013 +0100

    - updated to 0.2.3
    - added rpm5 patch (initial rpm5 port)
    - added link patch (fixes linking with gpgme)

 zif-link.patch |  13 ++
 zif-rpm5.patch | 575 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 zif.spec       | 130 ++++++++++---
 3 files changed, 688 insertions(+), 30 deletions(-)
---
diff --git a/zif.spec b/zif.spec
index b5e6919..4f12dab 100644
--- a/zif.spec
+++ b/zif.spec
@@ -1,32 +1,34 @@
-# TODO
-# - "port" to jbj rpm, sigh
-#/usr/include/rpm/hdrinline.h:615:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'headerGetStartOff'
-#/usr/include/rpm/hdrinline.h:624:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'headerSetStartOff'
-#/usr/include/rpm/hdrinline.h:632:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'headerGetEndOff'
-#/usr/include/rpm/hdrinline.h:641:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'headerSetEndOff'
 Summary:	Simple wrapper for rpm and the Fedora package metadata
+Summary(pl.UTF-8):	Proste opakowanie dla rpm-a i metadanych pakietów Fedory
 Name:		zif
-Version:	0.1.5
+Version:	0.2.3
 Release:	0.1
 License:	GPL v2+
 Group:		Libraries
+Source0:	http://www.packagekit.org/releases/%{name}-%{version}.tar.xz
+# Source0-md5:	67822a86a12fd90961c02b80616fa909
+Patch0:		%{name}-rpm5.patch
+Patch1:		%{name}-link.patch
 URL:		http://github.com/hughsie/zif
-Source0:	http://www.packagekit.org/releases/%{name}-%{version}.tar.gz
-# Source0-md5:	7811aae553cb4d1f21648096a7e9a8d0
+BuildRequires:	autoconf >= 2.63
+BuildRequires:	automake >= 1:1.9
 BuildRequires:	bzip2-devel
 BuildRequires:	docbook-utils
-BuildRequires:	gettext
+BuildRequires:	gettext-devel
 BuildRequires:	glib2-devel >= 1:2.16.1
 BuildRequires:	gnome-doc-utils
 BuildRequires:	gpgme-devel
-BuildRequires:	gtk-doc
-BuildRequires:	intltool
+BuildRequires:	gtk-doc >= 1.9
+BuildRequires:	intltool >= 0.35.0
 BuildRequires:	libarchive-devel
-BuildRequires:	libsoup-devel
-BuildRequires:	libtool
-BuildRequires:	rpm-devel
-BuildRequires:	sqlite-devel
+BuildRequires:	libsoup-devel >= 2.4
+BuildRequires:	libtool >= 2:2
+BuildRequires:	rpm-devel >= 5
+BuildRequires:	sqlite3-devel >= 3
+BuildRequires:	tar >= 1:1.22
+BuildRequires:	xz
 BuildRequires:	zlib-devel
+Requires:	glib2 >= 1:2.16.1
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -36,33 +38,91 @@ to the rpm database and the Fedora metadata for PackageKit.
 Zif is not designed as a replacement to yum, nor to be used by end
 users.
 
+%description -l pl.UTF-8
+Zif to prosta biblioteka kompatybilna z yumem, dająca dostęp w trybie
+odczytu i zapisu do bazy danych rpm-a oraz metadanych Fedory dla
+PackageKita.
+
+Zif nie jest projektowany jako zamiennik yuma, ani nie jest
+przeznaczony dla użytkowników końcowych.
+
 %package devel
-Summary:	GLib Libraries and headers for zif
+Summary:	Header files for Zif library
+Summary(pl.UTF-8):	Pliki nagłówkowe biblioteki Zif
 Group:		Development/Libraries
 Requires:	%{name} = %{version}-%{release}
 Requires:	bzip2-devel
+Requires:	glib2-devel >= 1:2.16.1
 Requires:	gpgme-devel
 Requires:	zlib-devel
 
 %description devel
-GLib headers and libraries for zif.
+Header files for Zif library.
+
+%description devel -l pl.UTF-8
+Pliki nagłówkowe biblioteki Zif.
+
+%package static
+Summary:	Static Zif library
+Summary(pl.UTF-8):	Statyczna biblioteka Zif
+Group:		Development/Libraries
+Requires:	%{name}-devel = %{version}-%{release}
+
+%description static
+Static Zif library.
+
+%description static -l pl.UTF-8
+Statyczna biblioteka Zif.
+
+%package apidocs
+Summary:	Zif API documentation
+Summary(pl.UTF-8):	Dokumentacja API biblioteki Zif
+Group:		Documentation
+
+%description apidocs
+Zif API documentation.
+
+%description apidocs -l pl.UTF-8
+Dokumentacja API biblioteki Zif.
+
+%package -n bash-completion-zif
+Summary:	Bash completion for zif command
+Summary(pl.UTF-8):	Bashowe dopełnianie parametrów dla polecenia zif
+Group:		Applications/Shells
+Requires:	%{name} = %{version}-%{release}
+Requires:	bash-completion
+
+%description -n bash-completion-zif
+Bash completion for zif command.
+
+%description -n bash-completion-zif -l pl.UTF-8
+Bashowe dopełnianie parametrów dla polecenia zif.
 
 %prep
 %setup -q
+%patch0 -p1
+%patch1 -p1
 
 %build
+%{__libtoolize}
+%{__aclocal} -I m4
+%{__autoconf}
+%{__autoheader}
+%{__automake}
 %configure \
-	--enable-gtk-doc \
-	--disable-static \
-	--disable-dependency-tracking
+	--disable-silent-rules
+#	--enable-gtk-doc is broken (as of 0.2.3)
+
 %{__make}
 
 %install
 rm -rf $RPM_BUILD_ROOT
+
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
-rm -f $RPM_BUILD_ROOT%{_libdir}/libzif*.la
+# obsoleted by pkg-config
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libzif.la
 
 %find_lang Zif
 
@@ -75,17 +135,27 @@ rm -rf $RPM_BUILD_ROOT
 %files -f Zif.lang
 %defattr(644,root,root,755)
 %doc README AUTHORS NEWS
-%{_sysconfdir}/bash_completion.d/*-completion.bash
-%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zif/zif.conf
 %attr(755,root,root) %{_bindir}/zif
-%{_libdir}/*libzif*.so.*
-%{_mandir}/man1/*.1*
+%attr(755,root,root) %{_libdir}/libzif.so.*.*.*
+%attr(755,root,root) %ghost %{_libdir}/libzif.so.3
 %dir %{_sysconfdir}/zif
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/zif/zif.conf
+%{_mandir}/man1/zif.1*
 
 %files devel
 %defattr(644,root,root,755)
-%{_libdir}/libzif*.so
+%attr(755,root,root) %{_libdir}/libzif.so
+%{_includedir}/libzif
 %{_pkgconfigdir}/zif.pc
-%dir %{_includedir}/libzif
-%{_includedir}/libzif/*.h
-%{_datadir}/gtk-doc
+
+%files static
+%defattr(644,root,root,755)
+%{_libdir}/libzif.a
+
+%files apidocs
+%defattr(644,root,root,755)
+%{_gtkdocdir}/zif
+
+%files -n bash-completion-zif
+%defattr(644,root,root,755)
+/etc/bash_completion.d/zif-completion.bash
diff --git a/zif-link.patch b/zif-link.patch
new file mode 100644
index 0000000..0c72cf3
--- /dev/null
+++ b/zif-link.patch
@@ -0,0 +1,13 @@
+--- zif-0.2.3/configure.ac.orig	2011-09-05 12:53:07.000000000 +0200
++++ zif-0.2.3/configure.ac	2013-11-19 21:28:52.879994191 +0100
+@@ -82,8 +82,8 @@
+ 		AC_MSG_ERROR([Cannot locate gpgme])
+ 	else
+ 		AC_MSG_RESULT([yes])
+-		GPGME_CFLAGS="`\"/usr/bin/gpgme-config\" --cflags`"
+-		GPGME_LIBS="`\"/usr/bin/gpgme-config\" --libs`"
++		GPGME_CFLAGS="$(/usr/bin/gpgme-config --cflags)"
++		GPGME_LIBS="$(/usr/bin/gpgme-config --libs)"
+ 		AC_SUBST([GPGME_CFLAGS])
+ 		AC_SUBST([GPGME_LIBS])
+ 		AC_DEFINE(USE_GPGME, 1, [if we should use gpgme])
diff --git a/zif-rpm5.patch b/zif-rpm5.patch
new file mode 100644
index 0000000..e37168c
--- /dev/null
+++ b/zif-rpm5.patch
@@ -0,0 +1,575 @@
+--- zif-0.2.3/libzif/zif-package-local.c.orig	2011-09-05 12:56:28.000000000 +0200
++++ zif-0.2.3/libzif/zif-package-local.c	2013-11-17 20:25:11.580739617 +0100
+@@ -31,7 +31,7 @@
+ #endif
+ 
+ #include <glib.h>
+-#include <rpm/rpmlib.h>
++#include "rpmorg-compat.h"
+ #include <rpm/rpmdb.h>
+ #include <rpm/rpmts.h>
+ 
+@@ -70,7 +70,7 @@ zif_get_header_string (Header header, rp
+ 	ZifString *data = NULL;
+ 	rpmtd td;
+ 
+-	td = rpmtdNew ();
++	td = malloc (sizeof (rpmtd));
+ 	retval = headerGet (header, tag, td, HEADERGET_MINMEM);
+ 
+ 	if (retval != 1)
+@@ -78,7 +78,7 @@ zif_get_header_string (Header header, rp
+ 	data = zif_string_new (rpmtdGetString (td));
+ out:
+ 	rpmtdFreeData (td);
+-	rpmtdFree (td);
++	free (td);
+ 	return data;
+ }
+ 
+@@ -90,24 +90,25 @@ zif_get_header_key_id (Header header, rp
+ {
+ 	gint retval;
+ 	char *format;
++	const char * errstr = "(unkown error)";
+ 	gchar *data = NULL;
+ 	rpmtd td;
+ 
+-	td = rpmtdNew ();
++	td = malloc (sizeof (rpmtd));
+ 	retval = headerGet (header, tag, td, HEADERGET_MINMEM);
+ 	if (retval != 1)
+ 		goto out;
+ 
+ 	/* format the signature as a text id */
+-	format = rpmtdFormat (td, RPMTD_FORMAT_PGPSIG, NULL);
++	format = headerSprintf(header, "%|DSAHEADER?{%{DSAHEADER:pgpsig}}:{%|RSAHEADER?{%{RSAHEADER:pgpsig}}:{%|SIGGPG?{%{SIGGPG:pgpsig}}:{%|SIGPGP?{%{SIGPGP:pgpsig}}:{(none)}|}|}|}|", NULL, rpmHeaderFormats, &errstr);
+ 	if (format != NULL) {
+ 		/* copy this, so we can free with g_free() */
+ 		data = g_strdup (format);
+-		free (format);
++		format = _free (format);
+ 	}
+ out:
+ 	rpmtdFreeData (td);
+-	rpmtdFree (td);
++	free (td);
+ 	return data;
+ }
+ 
+@@ -122,7 +123,7 @@ zif_get_header_u32 (Header header, rpmTa
+ 	guint data = 0;
+ 	rpmtd td;
+ 
+-	td = rpmtdNew ();
++	td = malloc (sizeof (rpmtd));
+ 	retval = headerGet (header, RPMTAG_SIZE, td, HEADERGET_MINMEM);
+ 	if (retval != 1)
+ 		goto out;
+@@ -131,7 +132,7 @@ zif_get_header_u32 (Header header, rpmTa
+ 		data = *data_p;
+ out:
+ 	rpmtdFreeData (td);
+-	rpmtdFree (td);
++	free (td);
+ 	return data;
+ }
+ 
+@@ -147,7 +148,7 @@ zif_get_header_uint32_index (Header head
+ 	rpmtd td;
+ 	guint i;
+ 
+-	td = rpmtdNew ();
++	td = malloc (sizeof (rpmtd));
+ 	retval = headerGet (header, tag, td, HEADERGET_MINMEM);
+ 	if (retval != 1)
+ 		goto out;
+@@ -157,7 +158,7 @@ zif_get_header_uint32_index (Header head
+ 		g_ptr_array_add (array, GUINT_TO_POINTER (*(data+i)));
+ out:
+ 	rpmtdFreeData (td);
+-	rpmtdFree (td);
++	free (td);
+ 	return array;
+ }
+ 
+@@ -172,7 +173,7 @@ zif_get_header_string_array (Header head
+ 	GPtrArray *array = NULL;
+ 	rpmtd td;
+ 
+-	td = rpmtdNew ();
++	td = malloc (sizeof (rpmtd));
+ 	retval = headerGet (header, tag, td, HEADERGET_DEFAULT);
+ 	if (retval != 1)
+ 		goto out;
+@@ -184,7 +185,7 @@ zif_get_header_string_array (Header head
+ 	}
+ out:
+ 	rpmtdFreeData (td);
+-	rpmtdFree (td);
++	free (td);
+ 	return array;
+ }
+ 
+@@ -713,7 +714,7 @@ zif_package_local_set_from_filename (Zif
+ 	}
+ 
+ 	/* convert and upscale */
+-	headerConvert (hdr, HEADERCONV_RETROFIT_V3);
++	/* headerConvert (hdr, HEADERCONV_RETROFIT_V3); */
+ 
+ 	/* set from header */
+ 	ret = zif_package_local_set_from_header (pkg,
+--- zif-0.2.3/libzif/zif-package-local.h.orig	2011-01-27 12:40:48.000000000 +0100
++++ zif-0.2.3/libzif/zif-package-local.h	2013-10-01 20:56:40.255196845 +0200
+@@ -27,7 +27,7 @@
+ #define __ZIF_PACKAGE_LOCAL_H
+ 
+ #include <glib-object.h>
+-#include <rpm/rpmlib.h>
++#include <rpm/rpm46compat.h>
+ #include <rpm/rpmdb.h>
+ 
+ #include "zif-package.h"
+--- zif-0.2.3/libzif/rpmorg-compat.h.orig	1970-01-01 01:00:00.000000000 +0100
++++ zif-0.2.3/libzif/rpmorg-compat.h	2013-11-17 20:47:24.434017016 +0100
+@@ -0,0 +1,64 @@
++#ifndef RPMORG_COMPAT_H
++#define RPMORG_COMPAT_H
++
++#include <rpm/rpm46compat.h>
++
++#define _RPMVSF_NOSIGNATURES (RPMVSF_NODSAHEADER | RPMVSF_NORSAHEADER | RPMVSF_NODSA | RPMVSF_NORSA)
++#define	_RPMVSF_NODIGESTS (RPMVSF_NOSHA1HEADER | RPMVSF_NOMD5HEADER | RPMVSF_NOSHA1 | RPMVSF_NOMD5)
++
++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;
++}
++
++#endif /* RPMORG_COMPAT_H */
+--- zif-0.2.3/libzif/zif-store-local.c.orig	2011-09-05 12:53:07.000000000 +0200
++++ zif-0.2.3/libzif/zif-store-local.c	2013-11-17 20:36:08.047378734 +0100
+@@ -34,7 +34,7 @@
+ #include <string.h>
+ 
+ #include <glib.h>
+-#include <rpm/rpmlib.h>
++#include "rpmorg-compat.h"
+ #include <rpm/rpmdb.h>
+ #include <rpm/rpmts.h>
+ #include <fcntl.h>
+@@ -244,16 +244,7 @@ zif_store_local_load (ZifStore *store, Z
+ 
+ 	/* get list */
+ 	ts = rpmtsCreate ();
+-	rc = rpmtsSetRootDir (ts, local->priv->prefix);
+-	if (rc < 0) {
+-		ret = FALSE;
+-		g_set_error (error,
+-			     ZIF_STORE_ERROR,
+-			     ZIF_STORE_ERROR_FAILED,
+-			     "failed to set root (%s)",
+-			     local->priv->prefix);
+-		goto out;
+-	}
++	rpmtsSetRootDir (ts, local->priv->prefix);
+ 	g_debug ("using rpmdb at %s", local->priv->prefix);
+ 	mi = rpmtsInitIterator (ts, RPMDBI_PACKAGES, NULL, 0);
+ 	if (mi == NULL)
+--- zif-0.2.3/libzif/zif-transaction.c.orig	2011-09-05 12:53:07.000000000 +0200
++++ zif-0.2.3/libzif/zif-transaction.c	2013-11-19 19:24:28.350307447 +0100
+@@ -51,12 +51,12 @@
+ #include <glib/gstdio.h>
+ #include <fcntl.h>
+ 
++#include "rpmorg-compat.h"
+ #include <rpm/rpmdb.h>
+-#include <rpm/rpmlib.h>
+ #include <rpm/rpmlog.h>
+ #include <rpm/rpmps.h>
+ #include <rpm/rpmts.h>
+-#include <rpm/rpmkeyring.h>
++#include <rpm/rpmpgp.h>
+ 
+ #include "zif-array.h"
+ #include "zif-config.h"
+@@ -3052,15 +3052,12 @@ out:
+  * zif_transaction_add_public_key_to_rpmdb:
+  **/
+ static gboolean
+-zif_transaction_add_public_key_to_rpmdb (rpmKeyring keyring, const gchar *filename, GError **error)
++zif_transaction_add_public_key_to_rpmdb (const rpmts ts, const gchar *filename, GError **error)
+ {
+ 	gboolean ret = TRUE;
+-	gchar *data = NULL;
+ 	gint rc;
+ 	gsize len;
+ 	pgpArmor armor;
+-	pgpDig dig = NULL;
+-	rpmPubkey pubkey = NULL;
+ 	uint8_t *pkt = NULL;
+ 
+ 	/* ignore symlinks and directories */
+@@ -3070,12 +3067,8 @@ zif_transaction_add_public_key_to_rpmdb
+ 		goto out;
+ 
+ 	/* get data */
+-	ret = g_file_get_contents (filename, &data, &len, error);
+-	if (!ret)
+-		goto out;
+-
+ 	/* rip off the ASCII armor and parse it */
+-	armor = pgpParsePkts (data, &pkt, &len);
++	armor = pgpReadPkts (filename, &pkt, &len);
+ 	if (armor < 0) {
+ 		ret = FALSE;
+ 		g_set_error (error,
+@@ -3098,7 +3091,7 @@ zif_transaction_add_public_key_to_rpmdb
+ 	}
+ 
+ 	/* test each one */
+-	pubkey = rpmPubkeyNew (pkt, len);
++/*	pubkey = rpmPubkeyNew (pkt, len);
+ 	if (pubkey == NULL) {
+ 		ret = FALSE;
+ 		g_set_error (error,
+@@ -3107,19 +3100,19 @@ zif_transaction_add_public_key_to_rpmdb
+ 			     "failed to parse public key for %s",
+ 			     filename);
+ 		goto out;
+-	}
++	}*/
+ 
+ 	/* does the key exist in the keyring */
+-	dig = rpmPubkeyDig (pubkey);
++/*	dig = rpmPubkeyDig (pubkey);
+ 	rc = rpmKeyringLookup (keyring, dig);
+ 	if (rc == RPMRC_OK) {
+ 		ret = TRUE;
+ 		g_debug ("%s is already present", filename);
+ 		goto out;
+-	}
++	}*/
+ 
+ 	/* add to rpmdb automatically, without a prompt */
+-	rc = rpmKeyringAddKey (keyring, pubkey);
++	rc = rpmcliImportPubkey(ts, pkt, len);
+ 	if (rc != 0) {
+ 		ret = FALSE;
+ 		g_set_error (error,
+@@ -3137,11 +3130,10 @@ zif_transaction_add_public_key_to_rpmdb
+ out:
+ 	if (pkt != NULL)
+ 		free (pkt); /* yes, free() */
+-	if (pubkey != NULL)
++/*	if (pubkey != NULL)
+ 		rpmPubkeyFree (pubkey);
+ 	if (dig != NULL)
+-		pgpFreeDig (dig);
+-	g_free (data);
++		pgpFreeDig (dig); */
+ 	return ret;
+ }
+ 
+@@ -3149,7 +3141,7 @@ out:
+  * zif_transaction_add_public_keys_to_rpmdb:
+  **/
+ static gboolean
+-zif_transaction_add_public_keys_to_rpmdb (rpmKeyring keyring, GError **error)
++zif_transaction_add_public_keys_to_rpmdb (rpmts ts, GError **error)
+ {
+ 	GDir *dir;
+ 	const gchar *filename;
+@@ -3168,7 +3160,7 @@ zif_transaction_add_public_keys_to_rpmdb
+ 		if (filename == NULL)
+ 			break;
+ 		path_tmp = g_build_filename (gpg_dir, filename, NULL);
+-		ret = zif_transaction_add_public_key_to_rpmdb (keyring,
++		ret = zif_transaction_add_public_key_to_rpmdb (ts,
+ 							       path_tmp,
+ 							       error);
+ 		g_free (path_tmp);
+@@ -3184,7 +3176,7 @@ out:
+  **/
+ static gboolean
+ zif_transaction_prepare_ensure_trusted (ZifTransaction *transaction,
+-					rpmKeyring keyring,
++					rpmts ts,
+ 					ZifPackage *package,
+ 					GError **error)
+ {
+@@ -3226,7 +3218,7 @@ zif_transaction_prepare_ensure_trusted (
+ 	zif_package_set_compare_mode (package_tmp, compare_mode);
+ 
+ 	/* get RSA key */
+-	td = rpmtdNew ();
++	td = malloc (sizeof (rpmtd));
+ 	h = zif_package_local_get_header (ZIF_PACKAGE_LOCAL (package_tmp));
+ 	rc = headerGet (h,
+ 			RPMTAG_RSAHEADER,
+@@ -3248,7 +3240,7 @@ zif_transaction_prepare_ensure_trusted (
+ 	}
+ 
+ 	/* make it into a digest */
+-	dig = pgpNewDig ();
++	dig = rpmtsDig(ts);
+ 	rc = pgpPrtPkts (td->data, td->count, dig, 0);
+ 	if (rc != 0) {
+ 		g_set_error (error,
+@@ -3260,7 +3252,7 @@ zif_transaction_prepare_ensure_trusted (
+ 	}
+ 
+ 	/* does the key exist in the keyring */
+-	rc = rpmKeyringLookup (keyring, dig);
++	rc = rpmtsFindPubkey(ts, dig);
+ 	if (rc == RPMRC_FAIL) {
+ 		g_set_error_literal (error,
+ 				     ZIF_TRANSACTION_ERROR,
+@@ -3275,12 +3267,12 @@ zif_transaction_prepare_ensure_trusted (
+ 
+ 		/* only do this once, even if it fails */
+ 		transaction->priv->auto_added_pubkeys = TRUE;
+-		ret = zif_transaction_add_public_keys_to_rpmdb (keyring, error);
++		ret = zif_transaction_add_public_keys_to_rpmdb (ts, error);
+ 		if (!ret)
+ 			goto out;
+ 
+ 		/* try again, as we might have the key now */
+-		rc = rpmKeyringLookup (keyring, dig);
++		rc = rpmtsFindPubkey(ts, dig);
+ 	}
+ 
+ 	/* set trusted */
+@@ -3297,10 +3289,10 @@ out:
+ 	if (package_tmp != NULL)
+ 		g_object_unref (package_tmp);
+ 	if (dig != NULL)
+-		pgpFreeDig (dig);
++		dig = pgpDigFree (dig);
+ 	if (td != NULL) {
+ 		rpmtdFreeData (td);
+-		rpmtdFree (td);
++		free (td);
+ 	}
+ 	return ret;
+ }
+@@ -3327,7 +3319,6 @@ zif_transaction_prepare (ZifTransaction
+ 	GError *error_local = NULL;
+ 	GPtrArray *download = NULL;
+ 	guint i;
+-	rpmKeyring keyring = NULL;
+ 	ZifPackage *package;
+ 	ZifPackage *package_tmp;
+ 	ZifState *state_local;
+@@ -3476,7 +3467,6 @@ skip:
+ 					   "gpgcheck", NULL);
+ 	localpkg_gpgcheck = zif_config_get_boolean (priv->config,
+ 						    "localpkg_gpgcheck", NULL);
+-	keyring = rpmtsGetKeyring (transaction->priv->ts, 1);
+ 	for (i=0; i<priv->install->len; i++) {
+ 		package_tmp = g_ptr_array_index (priv->install, i);
+ 
+@@ -3492,7 +3482,7 @@ skip:
+ 
+ 		/* do the check */
+ 		ret = zif_transaction_prepare_ensure_trusted (transaction,
+-							      keyring,
++							      transaction->priv->ts,
+ 							      package_tmp,
+ 							      error);
+ 		if (!ret)
+@@ -3509,8 +3499,6 @@ skip_self_check:
+ 	/* success */
+ 	priv->state = ZIF_TRANSACTION_STATE_PREPARED;
+ out:
+-	if (keyring != NULL)
+-		rpmKeyringFree (keyring);
+ 	if (download != NULL)
+ 		g_ptr_array_unref (download);
+ 	return ret;
+@@ -4267,6 +4255,18 @@ zif_transaction_get_problem_str (rpmProb
+ 				       pkg_nevr_alt);
+ 		break;
+ #endif
++	case RPMPROB_RDONLY:
++		str = g_strdup_printf ("tried to install package on read-only filesystem");
++		break;
++	case RPMPROB_BADPRETRANS:
++		str = g_strdup_printf ("bad %%pretrans?"); // unimplemented acc. to rpmps.h
++		break;
++	case RPMPROB_BADPLATFORM:
++		str = g_strdup_printf ("package %s is for a different platform", pkg_nevr);
++		break;
++	case RPMPROB_NOREPACKAGE:
++		str = g_strdup_printf ("re-packaged package %s is missing", pkg_nevr);
++		break;
+ 	}
+ 	return str;
+ }
+@@ -4323,10 +4323,13 @@ zif_transaction_look_for_problems (ZifTr
+ out:
+ 	if (string != NULL)
+ 		g_string_free (string, TRUE);
+-	rpmpsFree (probs);
++	probs = rpmpsFree (probs);
+ 	return ret;
+ }
+ 
++/* available in rpmts.h only if _RPMTS_INTERNAL */
++void rpmtsSetScriptFd(rpmts ts, /*@null@*/ FD_t scriptFd);
++
+ /**
+  * zif_transaction_commit:
+  * @transaction: A #ZifTransaction
+@@ -4409,16 +4412,7 @@ zif_transaction_commit (ZifTransaction *
+ 	commit->transaction = transaction;
+ 	commit->timer = g_timer_new ();
+ 	prefix = zif_store_local_get_prefix (ZIF_STORE_LOCAL (priv->store_local));
+-	rc = rpmtsSetRootDir (transaction->priv->ts, prefix);
+-	if (rc < 0) {
+-		ret = FALSE;
+-		g_set_error (error,
+-			     ZIF_TRANSACTION_ERROR,
+-			     ZIF_TRANSACTION_ERROR_FAILED,
+-			     "failed to set root (%s)",
+-			     prefix);
+-		goto out;
+-	}
++	rpmtsSetRootDir (transaction->priv->ts, prefix);
+ 	rpmtsSetNotifyCallback (transaction->priv->ts,
+ 				zif_transaction_ts_progress_cb,
+ 				commit);
+@@ -4757,7 +4751,7 @@ zif_transaction_finalize (GObject *objec
+ 	transaction = ZIF_TRANSACTION (object);
+ 
+ 	if (transaction->priv->ts != NULL)
+-		rpmtsFree (transaction->priv->ts);
++		transaction->priv->ts = rpmtsFree (transaction->priv->ts);
+ 	g_object_unref (transaction->priv->db);
+ 	g_object_unref (transaction->priv->config);
+ 	g_ptr_array_unref (transaction->priv->install);
+--- zif-0.2.3/libzif/zif-utils.c.orig	2011-06-29 10:46:17.000000000 +0200
++++ zif-0.2.3/libzif/zif-utils.c	2013-11-19 19:47:55.886915045 +0100
+@@ -30,8 +30,10 @@
+ #  include <config.h>
+ #endif
+ 
++#include <string.h>
+ #include <glib.h>
+-#include <rpm/rpmlib.h>
++#include <rpm/rpmevr.h>
++#include <rpm/rpmrc.h>
+ #include <rpm/rpmdb.h>
+ #include <archive.h>
+ #include <archive_entry.h>
+--- zif-0.2.3/libzif/zif-config.c.orig	2011-09-05 12:53:07.000000000 +0200
++++ zif-0.2.3/libzif/zif-config.c	2013-11-19 20:23:49.663491326 +0100
+@@ -41,7 +41,7 @@
+ #include <string.h>
+ 
+ #include <glib.h>
+-#include <rpm/rpmlib.h>
++#include <rpm/rpm46compat.h>
+ 
+ #include "zif-config.h"
+ #include "zif-utils.h"
+@@ -876,7 +876,7 @@ zif_config_class_init (ZifConfigClass *k
+ static void
+ zif_config_init (ZifConfig *config)
+ {
+-	const gchar *value;
++	const char *value;
+ 
+ 	config->priv = ZIF_CONFIG_GET_PRIVATE (config);
+ 	config->priv->file_override = g_key_file_new ();
+@@ -893,15 +893,14 @@ zif_config_init (ZifConfig *config)
+ 				  G_CALLBACK (zif_config_file_monitor_cb), config);
+ 
+ 	/* get info from RPM */
+-	rpmGetOsInfo (&value, NULL);
++	value = rpmExpand ("%{_target_os}", NULL);
+ 	zif_config_set_default (config, "osinfo", value);
+-	rpmGetArchInfo (&value, NULL);
++	value = rpmExpand ("%{_target_cpu}", NULL);
+ 	zif_config_set_default (config, "archinfo", value);
+-	rpmGetArchInfo (&value, NULL);
+-	if (g_strcmp0 (value, "i486") == 0 ||
+-	    g_strcmp0 (value, "i586") == 0 ||
+-	    g_strcmp0 (value, "i686") == 0)
+-		value = "i386";
++	if (strcmp (value, "i486") == 0 ||
++	    strcmp (value, "i586") == 0 ||
++	    strcmp (value, "i686") == 0)
++		value= "i386";
+ 	zif_config_set_default (config, "basearch", value);
+ }
+ 
+--- zif-0.2.3/examples/Makefile.am.orig	2011-06-25 18:29:24.000000000 +0200
++++ zif-0.2.3/examples/Makefile.am	2013-11-19 21:08:44.966711548 +0100
+@@ -1,5 +1,6 @@
+ INCLUDES =						\
+ 	$(GLIB_CFLAGS)					\
++	$(RPM_CFLAGS)					\
+ 	-DBINDIR=\"$(bindir)\"			 	\
+ 	-DDATADIR=\"$(datadir)\"			\
+ 	-DPREFIX=\""$(prefix)"\" 			\
+--- zif-0.2.3/tools/Makefile.am.orig	2011-06-25 18:29:24.000000000 +0200
++++ zif-0.2.3/tools/Makefile.am	2013-11-19 21:34:56.059978950 +0100
+@@ -1,5 +1,6 @@
+ INCLUDES =						\
+ 	$(GLIB_CFLAGS)					\
++	$(RPM_CFLAGS)					\
+ 	$(SQLITE_CFLAGS)				\
+ 	-DBINDIR=\"$(bindir)\"			 	\
+ 	-DDATADIR=\"$(datadir)\"			\
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/zif.git/commitdiff/8a9884f27244f589a12b5e054871d8993c105ec2



More information about the pld-cvs-commit mailing list