[rpmreaper] call rpmcliFini() only on exit (#709421)

Miroslav Lichvar mlichvar at fedoraproject.org
Wed Jun 1 10:21:20 UTC 2011


commit d44ed99ea486927086ef8148926a042973945f4f
Author: Miroslav Lichvar <mlichvar at redhat.com>
Date:   Wed Jun 1 12:19:51 2011 +0200

    call rpmcliFini() only on exit (#709421)

 rpmreaper-0.1.6-rpmclifini.patch |   53 ++++++++++++++++++++++++++++++++++++++
 rpmreaper.spec                   |    7 ++++-
 2 files changed, 59 insertions(+), 1 deletions(-)
---
diff --git a/rpmreaper-0.1.6-rpmclifini.patch b/rpmreaper-0.1.6-rpmclifini.patch
new file mode 100644
index 0000000..a834298
--- /dev/null
+++ b/rpmreaper-0.1.6-rpmclifini.patch
@@ -0,0 +1,53 @@
+commit 0ae72914bec9f385555e4a0827c37f7a6c927506
+Author: Miroslav Lichvar <mlichvar at redhat.com>
+Date:   Wed Jun 1 12:10:26 2011 +0200
+
+    call rpmcliFini() only on exit (rhbz#709421)
+
+diff --git a/rpm.c b/rpm.c
+index 230818b..374ebcd 100644
+--- a/rpm.c
++++ b/rpm.c
+@@ -86,13 +86,11 @@ static int rpm_read(const struct repo *repo, struct pkgs *p, uint firstpid) {
+ 	rpmdbMatchIterator iter;
+ 	Header header;
+ 	uint pid;
+-	char *argv[] = {""};
+ #ifndef _RPM_4_4_COMPAT
+ 	rpmtd sizetd;
+ 
+ 	sizetd = rpmtdNew();
+ #endif
+-	rd->context = rpmcliInit(1, argv, NULL);
+ 	rd->ts = rpmtsCreate();
+ 	rpmtsSetRootDir(rd->ts, ((struct rpmrepodata *)repo->data)->root);
+ 	rpmtsSetVSFlags(rd->ts, _RPMVSF_NOSIGNATURES | _RPMVSF_NODIGESTS);
+@@ -299,7 +297,6 @@ static int rpm_read_provs(const struct repo *repo, struct pkgs *p, uint firstpid
+ 	iter = rpmdbFreeIterator(iter);
+ 
+ 	rd->ts = rpmtsFree(ts);
+-	rd->context = rpmcliFini(rd->context);
+ 
+ 	return 0;
+ }
+@@ -406,11 +403,14 @@ static int rpm_remove_pkgs(const struct repo *repo, const struct pkgs *p, int fo
+ }
+ 
+ static void rpm_repo_clean(struct repo *r) {
++	rpmcliFini(((struct rpmrepodata *)r->data)->context);
+ 	free(r->data);
+ 	r->data = NULL;
+ }
+ 
+ void rpm_fillrepo(struct repo *r, const char *root) {
++	char *argv[] = {""};
++
+ 	r->repo_read = rpm_read;
+ 	r->repo_read_provs = rpm_read_provs;
+ 	r->repo_pkg_info = rpm_pkg_info;
+@@ -419,4 +419,5 @@ void rpm_fillrepo(struct repo *r, const char *root) {
+ 
+ 	r->data = malloc(sizeof (struct rpmrepodata));
+ 	((struct rpmrepodata *)r->data)->root = root;
++	((struct rpmrepodata *)r->data)->context = rpmcliInit(1, argv, NULL);
+ }
diff --git a/rpmreaper.spec b/rpmreaper.spec
index 52d1b37..6dbd587 100644
--- a/rpmreaper.spec
+++ b/rpmreaper.spec
@@ -1,6 +1,6 @@
 Name:           rpmreaper
 Version:        0.1.6
-Release:        7%{?dist}
+Release:        8%{?dist}
 Summary:        A tool for removing packages from system
 
 Group:          Applications/System
@@ -10,6 +10,7 @@ Source0:        https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar
 Patch0:         rpmreaper-0.1.6-librpm.patch
 Patch1:         rpmreaper-0.1.6-f2help.patch
 Patch2:         rpmreaper-0.1.6-rpmdbiter.patch
+Patch3:         rpmreaper-0.1.6-rpmclifini.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  ncurses-devel rpm-devel
@@ -24,6 +25,7 @@ allows removing unnecessary packages and their dependencies from the system.
 %patch0 -p1 -b .librpm
 %patch1 -p1 -b .f2help
 %patch2 -p1 -b .rpmdbiter
+%patch3 -p1 -b .rpmclifini
 
 %build
 make %{?_smp_mflags} CFLAGS="$RPM_OPT_FLAGS"
@@ -42,6 +44,9 @@ rm -rf $RPM_BUILD_ROOT
 %{_mandir}/man1/%{name}.1*
 
 %changelog
+* Wed Jun 01 2011 Miroslav Lichvar <mlichvar at redhat.com> 0.1.6-8
+- call rpmcliFini() only on exit (#709421)
+
 * Wed Feb 09 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.1.6-7
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
 


More information about the scm-commits mailing list