From d65902fab1d13231632ceabd162e2b874776f7da Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Mon, 29 May 2017 12:28:58 +0200 Subject: [PATCH] Backport few fixes for bindings Signed-off-by: Igor Gnatenko --- ...indings-do-not-leak-Repo-in-__next__.patch | 28 +++++ ...-bindings-expose-sourcepkg-functions.patch | 116 ++++++++++++++++++ libsolv.spec | 10 +- 3 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 0001-bindings-do-not-leak-Repo-in-__next__.patch create mode 100644 0001-bindings-expose-sourcepkg-functions.patch diff --git a/0001-bindings-do-not-leak-Repo-in-__next__.patch b/0001-bindings-do-not-leak-Repo-in-__next__.patch new file mode 100644 index 0000000..6d4151d --- /dev/null +++ b/0001-bindings-do-not-leak-Repo-in-__next__.patch @@ -0,0 +1,28 @@ +From d8f58f77e7a595db4a4dabf1a1ec0cf4e5145167 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Sun, 21 May 2017 19:05:34 +0200 +Subject: [PATCH] bindings: do not leak Repo in __next__() + +We don't create new object in __getitem__, why should we do it in __next__? + +Closes: https://github.com/openSUSE/libsolv/issues/207 +Signed-off-by: Igor Gnatenko +--- + bindings/solv.i | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/bindings/solv.i b/bindings/solv.i +index 96e5d23..5736f20 100644 +--- a/bindings/solv.i ++++ b/bindings/solv.i +@@ -2609,7 +2609,6 @@ rb_eval_string( + #ifdef SWIGPERL + perliter(solv::Pool_repo_iterator) + #endif +- %newobject __next__; + Repo *__next__() { + Pool *pool = $self->pool; + if ($self->id >= pool->nrepos) +-- +2.13.0 + diff --git a/0001-bindings-expose-sourcepkg-functions.patch b/0001-bindings-expose-sourcepkg-functions.patch new file mode 100644 index 0000000..fb096bf --- /dev/null +++ b/0001-bindings-expose-sourcepkg-functions.patch @@ -0,0 +1,116 @@ +From 3b200475c1c3904e38a38f26c6ee24a0dcd6fcf2 Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Wed, 17 May 2017 22:06:21 +0200 +Subject: [PATCH] bindings: expose sourcepkg functions + +Closes: https://github.com/openSUSE/libsolv/issues/197 +Signed-off-by: Igor Gnatenko +--- + bindings/solv.i | 6 ++++++ + doc/libsolv-bindings.3 | 28 ++++++++++++++++++++++++++++ + doc/libsolv-bindings.txt | 12 ++++++++++++ + 3 files changed, 46 insertions(+) + +diff --git a/bindings/solv.i b/bindings/solv.i +index 7302d3a..96e5d23 100644 +--- a/bindings/solv.i ++++ b/bindings/solv.i +@@ -2830,6 +2830,9 @@ rb_eval_string( + const char *lookup_location(unsigned int *OUTPUT) { + return solvable_lookup_location($self->pool->solvables + $self->id, OUTPUT); + } ++ const char *lookup_sourcepkg() { ++ return solvable_lookup_sourcepkg($self->pool->solvables + $self->id); ++ } + %newobject Dataiterator; + Dataiterator *Dataiterator(Id key, const char *match = 0, int flags = 0) { + return new_Dataiterator($self->pool, 0, $self->id, key, match, flags); +@@ -3792,6 +3795,9 @@ rb_eval_string( + if (buf) + repodata_set_bin_checksum(repo_id2repodata($self->repo, $self->id), solvid, keyname, solv_chksum_get_type(chksum), buf); + } ++ void set_sourcepkg(Id solvid, const char *sourcepkg) { ++ repodata_set_sourcepkg(repo_id2repodata($self->repo, $self->id), solvid, sourcepkg); ++ } + const char *lookup_str(Id solvid, Id keyname) { + return repodata_lookup_str(repo_id2repodata($self->repo, $self->id), solvid, keyname); + } +diff --git a/doc/libsolv-bindings.3 b/doc/libsolv-bindings.3 +index 477a6e4..f2d8e8d 100644 +--- a/doc/libsolv-bindings.3 ++++ b/doc/libsolv-bindings.3 +@@ -2425,6 +2425,21 @@ Return a tuple containing the on\-media location and an optional media number fo + .RS 4 + .\} + .nf ++\fBconst char *lookup_sourcepkg()\fR; ++my \fR\fI$sourcepkg\fR\fB =\fR \fI$solvable\fR\fB\->lookup_sourcepkg()\fR; ++\fIsourcepkg\fR\fB \fB=\fR \fIsolvable\fR\fB\&.lookup_sourcepkg()\fR ++\fIsourcepkg\fR\fB \fB=\fR \fIsolvable\fR\fB\&.lookup_sourcepkg()\fR ++.fi ++.if n \{\ ++.RE ++.\} ++.sp ++Return a sourcepkg name associated with solvable\&. ++.sp ++.if n \{\ ++.RS 4 ++.\} ++.nf + \fBDataiterator Dataiterator(Id\fR \fIkeyname\fR\fB, const char *\fR\fImatch\fR \fB= 0, int\fR \fIflags\fR \fB= 0)\fR + my \fI$di\fR \fB=\fR \fI$solvable\fR\fB\->Dataiterator(\fR\fI$keyname\fR\fB,\fR \fI$match\fR\fB,\fR \fI$flags\fR\fB)\fR; + \fIdi\fR \fB=\fR \fIsolvable\fR\fB\&.Dataiterator(\fR\fIkeyname\fR\fB,\fR \fImatch\fR\fB,\fR \fIflags\fR\fB)\fR +@@ -5557,6 +5572,19 @@ Lookup functions\&. Return the data element stored in the specified solvable\&. + .RS 4 + .\} + .nf ++\fBvoid set_sourcepkg(Id\fR \fIsolvid\fR\fB, const char *\fR\fIsourcepkg\fR\fB)\fR; ++\fI$data\fR\fB\->set_sourcepkg(\fR\fI$solvid\fR\fB, \fI$sourcepkg\fR\fB)\fR; ++\fIdata\fR\fB\&.set_sourcepkg(\fR\fIsolvid\fR\fB,\fR \fIsourcepkg\fR\fB)\fR ++\fIdata\fR\fB\&.set_sourcepkg(\fR\fIsolvid\fR\fB,\fR \fIsourcepkg\fR\fB)\fR ++.fi ++.if n \{\ ++.RE ++.\} ++.sp ++.if n \{\ ++.RS 4 ++.\} ++.nf + \fBvoid add_idarray(Id\fR \fIsolvid\fR\fB, Id\fR \fIkeyname\fR\fB, DepId\fR \fIid\fR\fB)\fR; + \fI$data\fR\fB\->add_idarray(\fR\fI$solvid\fR\fB,\fR \fI$keyname\fR\fB,\fR \fI$id\fR\fB)\fR; + \fIdata\fR\fB\&.add_idarray(\fR\fIsolvid\fR\fB,\fR \fIkeyname\fR\fB,\fR \fIid\fR\fB)\fR +diff --git a/doc/libsolv-bindings.txt b/doc/libsolv-bindings.txt +index e44d53a..4de090f 100644 +--- a/doc/libsolv-bindings.txt ++++ b/doc/libsolv-bindings.txt +@@ -1357,6 +1357,13 @@ Return a tuple containing the on-media location and an optional + media number for multi-part repositories (e.g. repositories + spawning multiple DVDs). + ++ const char *lookup_sourcepkg(); ++ my $sourcepkg = $solvable->lookup_sourcepkg(); ++ sourcepkg = solvable.lookup_sourcepkg() ++ sourcepkg = solvable.lookup_sourcepkg() ++ ++Return a sourcepkg name associated with solvable. ++ + Dataiterator Dataiterator(Id keyname, const char *match = 0, int flags = 0) + my $di = $solvable->Dataiterator($keyname, $match, $flags); + di = solvable.Dataiterator(keyname, match, flags) +@@ -3412,6 +3419,11 @@ SOLVID_META solvid that stores repodata meta information. + data.set_checksum(solvid, keyname, chksum) + data.set_checksum(solvid, keyname, chksum) + ++ void set_sourcepkg(Id solvid, const char *sourcepkg); ++ $data.set_sourcepkg($solvid, $sourcepkg); ++ data.set_sourcepkg(solvid, sourcepkg) ++ data.set_sourcepkg(solvid, sourcepkg) ++ + void add_idarray(Id solvid, Id keyname, DepId id); + $data->add_idarray($solvid, $keyname, $id); + data.add_idarray(solvid, keyname, id) +-- +2.13.0 + diff --git a/libsolv.spec b/libsolv.spec index 35bf8c4..a591543 100644 --- a/libsolv.spec +++ b/libsolv.spec @@ -39,13 +39,18 @@ Name: lib%{libname} Version: 0.6.27 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Package dependency solver License: BSD URL: https://github.com/openSUSE/libsolv Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz +# https://github.com/openSUSE/libsolv/commit/3b200475c1c3904e38a38f26c6ee24a0dcd6fcf2 +Patch0001: 0001-bindings-expose-sourcepkg-functions.patch +# https://github.com/openSUSE/libsolv/commit/d8f58f77e7a595db4a4dabf1a1ec0cf4e5145167 +Patch0002: 0001-bindings-do-not-leak-Repo-in-__next__.patch + BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: pkgconfig(rpm) @@ -287,6 +292,9 @@ popd %endif %changelog +* Mon May 29 2017 Igor Gnatenko - 0.6.27-2 +- Backport few fixes for bindings + * Thu May 04 2017 Igor Gnatenko - 0.6.27-1 - Update to 0.6.27