Backport few fixes and enhancements from upstream
Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
parent
a65dc2a259
commit
4b2f5c72d6
@ -0,0 +1,42 @@
|
||||
From c182d762c3160a9a2fdde600d39cfbb2eca4d831 Mon Sep 17 00:00:00 2001
|
||||
From: Marek Blaha <marek.blaha@gmail.com>
|
||||
Date: Fri, 4 May 2018 16:30:41 +0200
|
||||
Subject: [PATCH 1/6] source/binary rpm detection heuristic when
|
||||
ENABLE_RPMPKG_LIBRPM used
|
||||
|
||||
The headerIsSource() simply checks a presence of the RPMTAG_SOURCERPM
|
||||
tag in package header, which is not really useful in this context.
|
||||
This patch provides the same "heuristic" as the librpm uses for
|
||||
detecting source/binary rpm.
|
||||
|
||||
Relevant bug: https://bugzilla.redhat.com/show_bug.cgi?id=1572338
|
||||
|
||||
(cherry picked from commit 8e1dcb6e23a4ee7ea329609d3a05d17aa0201b87)
|
||||
---
|
||||
ext/repo_rpmdb.c | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
|
||||
index cd14a9b4..d5f3bf8e 100644
|
||||
--- a/ext/repo_rpmdb.c
|
||||
+++ b/ext/repo_rpmdb.c
|
||||
@@ -457,7 +457,15 @@ headbinary(RpmHead *h, int tag, unsigned int *sizep)
|
||||
static int
|
||||
headissourceheuristic(RpmHead *h)
|
||||
{
|
||||
- return headerIsSource(h);
|
||||
+ int issource = 0;
|
||||
+ char **dn;
|
||||
+ int dcnt;
|
||||
+ dn = headstringarray(h, TAG_DIRNAMES, &dcnt);
|
||||
+ if (dn) {
|
||||
+ issource = dcnt == 1 && dn[0] && !*dn[0];
|
||||
+ solv_free(dn);
|
||||
+ }
|
||||
+ return issource;
|
||||
}
|
||||
|
||||
static inline void
|
||||
--
|
||||
2.18.0.rc2
|
||||
|
@ -0,0 +1,77 @@
|
||||
From ce65215016fdccf6bef493016c137f64162859c0 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Schroeder <mls@suse.de>
|
||||
Date: Mon, 7 May 2018 11:54:28 +0200
|
||||
Subject: [PATCH 2/6] Tweak source heuristic in ENABLE_RPMPKG_LIBRPM case
|
||||
|
||||
Use HEADERGET_MINMEM to make the code faster and save some memory.
|
||||
|
||||
(cherry picked from commit 545fd9a10fc8579d40a0a4d9838d49937582c3fb)
|
||||
---
|
||||
ext/repo_rpmdb.c | 23 +++++++++--------------
|
||||
1 file changed, 9 insertions(+), 14 deletions(-)
|
||||
|
||||
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
|
||||
index d5f3bf8e..ad221c32 100644
|
||||
--- a/ext/repo_rpmdb.c
|
||||
+++ b/ext/repo_rpmdb.c
|
||||
@@ -457,14 +457,12 @@ headbinary(RpmHead *h, int tag, unsigned int *sizep)
|
||||
static int
|
||||
headissourceheuristic(RpmHead *h)
|
||||
{
|
||||
- int issource = 0;
|
||||
- char **dn;
|
||||
- int dcnt;
|
||||
- dn = headstringarray(h, TAG_DIRNAMES, &dcnt);
|
||||
- if (dn) {
|
||||
- issource = dcnt == 1 && dn[0] && !*dn[0];
|
||||
- solv_free(dn);
|
||||
- }
|
||||
+ struct rpmtd_s td;
|
||||
+ int issource;
|
||||
+ if (!headerGet(h, TAG_DIRNAMES, &td, HEADERGET_MINMEM))
|
||||
+ return 0;
|
||||
+ issource = td.count == 1 && td.data && ((char **)td.data)[0] && !((char **)td.data)[0][0];
|
||||
+ rpmtdFreeData(&td);
|
||||
return issource;
|
||||
}
|
||||
|
||||
@@ -488,10 +486,7 @@ static char *headtoevr(RpmHead *h)
|
||||
release = headstring(h, TAG_RELEASE);
|
||||
epoch = headint32(h, TAG_EPOCH);
|
||||
if (!version || !release)
|
||||
- {
|
||||
- fprintf(stderr, "headtoevr: bad rpm header\n");
|
||||
- return 0;
|
||||
- }
|
||||
+ return 0;
|
||||
for (v = version; *v >= '0' && *v <= '9'; v++)
|
||||
;
|
||||
if (epoch || (v != version && *v == ':'))
|
||||
@@ -1114,6 +1109,7 @@ rpmhead2solv(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhe
|
||||
s->arch = ARCH_NOARCH;
|
||||
evr = headtoevr(rpmhead);
|
||||
s->evr = pool_str2id(pool, evr, 1);
|
||||
+ solv_free(evr);
|
||||
s->vendor = pool_str2id(pool, headstring(rpmhead, TAG_VENDOR), 1);
|
||||
|
||||
queue_init_buffer(&ignq, ignqbuf, sizeof(ignqbuf)/sizeof(*ignqbuf));
|
||||
@@ -1211,7 +1207,6 @@ rpmhead2solv(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhe
|
||||
if ((flags & RPM_ADD_WITH_CHANGELOG) != 0)
|
||||
addchangelog(data, handle, rpmhead);
|
||||
}
|
||||
- solv_free(evr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -2367,7 +2362,7 @@ rpm_query(void *rpmhandle, Id what)
|
||||
r = 0;
|
||||
switch (what)
|
||||
{
|
||||
- case 0:
|
||||
+ case 0: /* return canonical name of rpm */
|
||||
name = headstring(rpmhead, TAG_NAME);
|
||||
if (!name)
|
||||
name = "";
|
||||
--
|
||||
2.18.0.rc2
|
||||
|
@ -0,0 +1,28 @@
|
||||
From 16663c9ed6b8bd0c065f28cd34434a4939267bdc Mon Sep 17 00:00:00 2001
|
||||
From: Michael Schroeder <mls@suse.de>
|
||||
Date: Thu, 7 Jun 2018 14:18:25 +0200
|
||||
Subject: [PATCH 3/6] Remove wrong solv_free(data->vincore) in
|
||||
repodata_internalize
|
||||
|
||||
We're extending the old buffer, so the free is always wrong.
|
||||
|
||||
(cherry picked from commit 241566effa2cda6e9445dc596447c43ea4f0719f)
|
||||
---
|
||||
src/repodata.c | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/src/repodata.c b/src/repodata.c
|
||||
index 06b2ea3e..9af4bdf3 100644
|
||||
--- a/src/repodata.c
|
||||
+++ b/src/repodata.c
|
||||
@@ -3512,7 +3512,6 @@ entrydone:
|
||||
data->incoredatalen = newincore.len;
|
||||
data->incoredatafree = 0;
|
||||
|
||||
- solv_free(data->vincore);
|
||||
data->vincore = newvincore.buf;
|
||||
data->vincorelen = newvincore.len;
|
||||
|
||||
--
|
||||
2.18.0.rc2
|
||||
|
140
0004-bindings-expose-repodata_str2dir-repodata_dir2str-an.patch
Normal file
140
0004-bindings-expose-repodata_str2dir-repodata_dir2str-an.patch
Normal file
@ -0,0 +1,140 @@
|
||||
From b69b77539089ce0759e64ae4de7ff9a10a3166db Mon Sep 17 00:00:00 2001
|
||||
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
||||
Date: Fri, 15 Jun 2018 15:40:11 +0200
|
||||
Subject: [PATCH 4/6] bindings: expose repodata_str2dir, repodata_dir2str and
|
||||
repodata_add_dirstr
|
||||
|
||||
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
|
||||
(cherry picked from commit 316c436de3b57e1c22d8368b366ef62a66d72e8e)
|
||||
---
|
||||
bindings/solv.i | 12 ++++++++++
|
||||
doc/gen/libsolv-bindings.3 | 47 ++++++++++++++++++++++++++++++++++++--
|
||||
doc/libsolv-bindings.txt | 20 ++++++++++++++++
|
||||
3 files changed, 77 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/bindings/solv.i b/bindings/solv.i
|
||||
index acd01ac4..6f702803 100644
|
||||
--- a/bindings/solv.i
|
||||
+++ b/bindings/solv.i
|
||||
@@ -3916,6 +3916,18 @@ rb_eval_string(
|
||||
bool write(FILE *fp) {
|
||||
return repodata_write(repo_id2repodata($self->repo, $self->id), fp) == 0;
|
||||
}
|
||||
+ Id str2dir(const char *dir, bool create=1) {
|
||||
+ Repodata *data = repo_id2repodata($self->repo, $self->id);
|
||||
+ return repodata_str2dir(data, dir, create);
|
||||
+ }
|
||||
+ const char dir2str(Id did, const char *suf = 0) {
|
||||
+ Repodata *data = repo_id2repodata($self->repo, $self->id);
|
||||
+ return repodata_dir2str(data, did, suf);
|
||||
+ }
|
||||
+ void add_dirstr(Id solvid, Id keyname, Id dir, const char *str) {
|
||||
+ Repodata *data = repo_id2repodata($self->repo, $self->id);
|
||||
+ repodata_add_dirstr(data, solvid, keyname, dir, str);
|
||||
+ }
|
||||
bool add_solv(FILE *fp, int flags = 0) {
|
||||
Repodata *data = repo_id2repodata($self->repo, $self->id);
|
||||
int r, oldstate = data->state;
|
||||
diff --git a/doc/gen/libsolv-bindings.3 b/doc/gen/libsolv-bindings.3
|
||||
index a6534aa2..38beb1c0 100644
|
||||
--- a/doc/gen/libsolv-bindings.3
|
||||
+++ b/doc/gen/libsolv-bindings.3
|
||||
@@ -2,12 +2,12 @@
|
||||
.\" Title: Libsolv-Bindings
|
||||
.\" Author: [see the "Author" section]
|
||||
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
||||
-.\" Date: 02/28/2018
|
||||
+.\" Date: 06/15/2018
|
||||
.\" Manual: LIBSOLV
|
||||
.\" Source: libsolv
|
||||
.\" Language: English
|
||||
.\"
|
||||
-.TH "LIBSOLV\-BINDINGS" "3" "02/28/2018" "libsolv" "LIBSOLV"
|
||||
+.TH "LIBSOLV\-BINDINGS" "3" "06/15/2018" "libsolv" "LIBSOLV"
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * Define some portability stuff
|
||||
.\" -----------------------------------------------------------------
|
||||
@@ -5622,6 +5622,49 @@ Write the contents of the repodata area as solv file\&.
|
||||
.RS 4
|
||||
.\}
|
||||
.nf
|
||||
+\fBId str2dir(const char *\fR\fIdir\fR\fB, bool\fR \fIcreate\fR \fB= 1)\fR
|
||||
+my \fI$did\fR \fB=\fR \fIdata\fR\fB\->str2dir(\fR\fI$dir\fR\fB)\fR;
|
||||
+\fIdid\fR \fB=\fR \fIdata\fR\fB\&.str2dir(\fR\fIdir\fR\fB)\fR
|
||||
+\fIdid\fR \fB=\fR \fIdata\fR\fB\&.str2dir(\fR\fIdir\fR\fB)\fR
|
||||
+.fi
|
||||
+.if n \{\
|
||||
+.RE
|
||||
+.\}
|
||||
+.sp
|
||||
+.if n \{\
|
||||
+.RS 4
|
||||
+.\}
|
||||
+.nf
|
||||
+\fBconst char *dir2str(Id\fR \fIdid\fR\fB, const char *\fR\fIsuffix\fR \fB= 0)\fR
|
||||
+\fI$dir\fR \fB=\fR \fIpool\fR\fB\->dir2str(\fR\fI$did\fR\fB)\fR;
|
||||
+\fIdir\fR \fB=\fR \fIpool\fR\fB\&.dir2str(\fR\fIdid\fR\fB)\fR
|
||||
+\fIdir\fR \fB=\fR \fIpool\fR\fB\&.dir2str(\fR\fIdid\fR\fB)\fR
|
||||
+.fi
|
||||
+.if n \{\
|
||||
+.RE
|
||||
+.\}
|
||||
+.sp
|
||||
+Convert a string (directory) into an Id and back\&. If the string is currently not in the pool and \fIcreate\fR is false, zero is returned\&.
|
||||
+.sp
|
||||
+.if n \{\
|
||||
+.RS 4
|
||||
+.\}
|
||||
+.nf
|
||||
+\fBvoid add_dirstr(Id\fR \fIsolvid\fR\fB, Id\fR \fIkeyname\fR\fB, Id\fR \fIdir\fR\fB, const char *\fR\fIstr\fR\fB)\fR
|
||||
+\fI$data\fR\fB\->add_dirstr(\fR\fI$solvid\fR\fB,\fR \fI$keyname\fR\fB,\fR \fI$dir\fR\fB,\fR \fI$string\fR\fB)\fR
|
||||
+\fIdata\fR\fB\&.add_dirstr(\fR\fIsolvid\fR\fB,\fR \fIkeyname\fR\fB,\fR \fIdir\fR\fB,\fR \fIstring\fR\fB)\fR
|
||||
+\fIdata\fR\fB\&.add_dirstr(\fR\fIsolvid\fR\fB,\fR \fIkeyname\fR\fB,\fR \fIdir\fR\fB,\fR \fIstring\fR\fB)\fR
|
||||
+.fi
|
||||
+.if n \{\
|
||||
+.RE
|
||||
+.\}
|
||||
+.sp
|
||||
+Add a file provide\&.
|
||||
+.sp
|
||||
+.if n \{\
|
||||
+.RS 4
|
||||
+.\}
|
||||
+.nf
|
||||
\fBbool add_solv(FILE *\fR\fIfp\fR\fB, int\fR \fIflags\fR \fB= 0)\fR;
|
||||
\fI$data\fR\fB\->add_solv(\fR\fI$fp\fR\fB)\fR;
|
||||
\fIdata\fR\fB\&.add_solv(\fR\fIfp\fR\fB)\fR
|
||||
diff --git a/doc/libsolv-bindings.txt b/doc/libsolv-bindings.txt
|
||||
index 1f6422f1..572ed92b 100644
|
||||
--- a/doc/libsolv-bindings.txt
|
||||
+++ b/doc/libsolv-bindings.txt
|
||||
@@ -3457,6 +3457,26 @@ after it has been internalized.
|
||||
|
||||
Write the contents of the repodata area as solv file.
|
||||
|
||||
+ Id str2dir(const char *dir, bool create = 1)
|
||||
+ my $did = data->str2dir($dir);
|
||||
+ did = data.str2dir(dir)
|
||||
+ did = data.str2dir(dir)
|
||||
+
|
||||
+ const char *dir2str(Id did, const char *suffix = 0)
|
||||
+ $dir = pool->dir2str($did);
|
||||
+ dir = pool.dir2str(did)
|
||||
+ dir = pool.dir2str(did)
|
||||
+
|
||||
+Convert a string (directory) into an Id and back. If the string is currently not in the
|
||||
+pool and _create_ is false, zero is returned.
|
||||
+
|
||||
+ void add_dirstr(Id solvid, Id keyname, Id dir, const char *str)
|
||||
+ $data->add_dirstr($solvid, $keyname, $dir, $string)
|
||||
+ data.add_dirstr(solvid, keyname, dir, string)
|
||||
+ data.add_dirstr(solvid, keyname, dir, string)
|
||||
+
|
||||
+Add a file provide.
|
||||
+
|
||||
bool add_solv(FILE *fp, int flags = 0);
|
||||
$data->add_solv($fp);
|
||||
data.add_solv(fp)
|
||||
--
|
||||
2.18.0.rc2
|
||||
|
40
0005-Tweak-documentation-of-add_dirstr-method.patch
Normal file
40
0005-Tweak-documentation-of-add_dirstr-method.patch
Normal file
@ -0,0 +1,40 @@
|
||||
From 9179020e6b3a4941f5c56fa8b99bed186c7c4c3e Mon Sep 17 00:00:00 2001
|
||||
From: Michael Schroeder <mls@suse.de>
|
||||
Date: Fri, 15 Jun 2018 15:49:40 +0200
|
||||
Subject: [PATCH 5/6] Tweak documentation of add_dirstr method
|
||||
|
||||
(cherry picked from commit b79876042aee1aeffeaa9c0680a150cbe1c9ca4a)
|
||||
---
|
||||
doc/gen/libsolv-bindings.3 | 2 +-
|
||||
doc/libsolv-bindings.txt | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/doc/gen/libsolv-bindings.3 b/doc/gen/libsolv-bindings.3
|
||||
index 38beb1c0..8dcc041b 100644
|
||||
--- a/doc/gen/libsolv-bindings.3
|
||||
+++ b/doc/gen/libsolv-bindings.3
|
||||
@@ -5659,7 +5659,7 @@ Convert a string (directory) into an Id and back\&. If the string is currently n
|
||||
.RE
|
||||
.\}
|
||||
.sp
|
||||
-Add a file provide\&.
|
||||
+Add a file path consisting of a dirname Id and a basename string\&.
|
||||
.sp
|
||||
.if n \{\
|
||||
.RS 4
|
||||
diff --git a/doc/libsolv-bindings.txt b/doc/libsolv-bindings.txt
|
||||
index 572ed92b..e7c6b9d3 100644
|
||||
--- a/doc/libsolv-bindings.txt
|
||||
+++ b/doc/libsolv-bindings.txt
|
||||
@@ -3475,7 +3475,7 @@ pool and _create_ is false, zero is returned.
|
||||
data.add_dirstr(solvid, keyname, dir, string)
|
||||
data.add_dirstr(solvid, keyname, dir, string)
|
||||
|
||||
-Add a file provide.
|
||||
+Add a file path consisting of a dirname Id and a basename string.
|
||||
|
||||
bool add_solv(FILE *fp, int flags = 0);
|
||||
$data->add_solv($fp);
|
||||
--
|
||||
2.18.0.rc2
|
||||
|
@ -0,0 +1,58 @@
|
||||
From 3c29a0763b9e94eaad59972795c500ce07485929 Mon Sep 17 00:00:00 2001
|
||||
From: Michael Schroeder <mls@suse.de>
|
||||
Date: Wed, 27 Jun 2018 17:27:44 +0200
|
||||
Subject: [PATCH 6/6] Fix fp double close, work around some false positives
|
||||
from covscan
|
||||
|
||||
(cherry picked from commit 2f95fad5220b4d39a610a45d92b0067588a91db8)
|
||||
---
|
||||
ext/repo_rpmdb.c | 5 +----
|
||||
src/repo_solv.c | 2 +-
|
||||
src/selection.c | 2 ++
|
||||
3 files changed, 4 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c
|
||||
index ad221c32..ff1e32a1 100644
|
||||
--- a/ext/repo_rpmdb.c
|
||||
+++ b/ext/repo_rpmdb.c
|
||||
@@ -1260,10 +1260,7 @@ headfromfp(struct rpmdbstate *state, const char *name, FILE *fp, unsigned char *
|
||||
}
|
||||
rpmhead = state->rpmhead;
|
||||
if (fread(rpmhead->data, len, 1, fp) != 1)
|
||||
- {
|
||||
- fclose(fp);
|
||||
- return pool_error(state->pool, 0, "%s: unexpected EOF", name);
|
||||
- }
|
||||
+ return pool_error(state->pool, 0, "%s: unexpected EOF", name);
|
||||
if (chk1)
|
||||
solv_chksum_add(chk1, rpmhead->data, len);
|
||||
if (chk2)
|
||||
diff --git a/src/repo_solv.c b/src/repo_solv.c
|
||||
index 2460e30a..034d2fab 100644
|
||||
--- a/src/repo_solv.c
|
||||
+++ b/src/repo_solv.c
|
||||
@@ -612,7 +612,7 @@ repo_add_solv(Repo *repo, FILE *fp, int flags)
|
||||
unsigned int pfsize = read_u32(&data);
|
||||
char *prefix = solv_malloc(pfsize);
|
||||
char *pp = prefix;
|
||||
- char *old_str = 0;
|
||||
+ char *old_str = strsp;
|
||||
char *dest = strsp;
|
||||
int freesp = sizeid;
|
||||
|
||||
diff --git a/src/selection.c b/src/selection.c
|
||||
index 6ca72e5d..d9d35e38 100644
|
||||
--- a/src/selection.c
|
||||
+++ b/src/selection.c
|
||||
@@ -1444,6 +1444,8 @@ selection_make_matchdeps_common_limited(Pool *pool, Queue *selection, const char
|
||||
return 0;
|
||||
if (!name && !dep)
|
||||
return 0;
|
||||
+ if (name && dep)
|
||||
+ return 0;
|
||||
|
||||
if ((flags & SELECTION_MATCH_DEPSTR) != 0)
|
||||
flags &= ~SELECTION_REL;
|
||||
--
|
||||
2.18.0.rc2
|
||||
|
13
libsolv.spec
13
libsolv.spec
@ -38,7 +38,7 @@
|
||||
|
||||
Name: lib%{libname}
|
||||
Version: 0.6.34
|
||||
Release: 2%{?commit:.git.%{commitnum}.%{?shortcommit}}%{?dist}
|
||||
Release: 3%{?commit:.git.%{commitnum}.%{?shortcommit}}%{?dist}
|
||||
Summary: Package dependency solver
|
||||
|
||||
License: BSD
|
||||
@ -49,6 +49,14 @@ Source: %{url}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
|
||||
Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
|
||||
%endif
|
||||
|
||||
# Patches from git
|
||||
Patch0001: 0001-source-binary-rpm-detection-heuristic-when-ENABLE_RP.patch
|
||||
Patch0002: 0002-Tweak-source-heuristic-in-ENABLE_RPMPKG_LIBRPM-case.patch
|
||||
Patch0003: 0003-Remove-wrong-solv_free-data-vincore-in-repodata_inte.patch
|
||||
Patch0004: 0004-bindings-expose-repodata_str2dir-repodata_dir2str-an.patch
|
||||
Patch0005: 0005-Tweak-documentation-of-add_dirstr-method.patch
|
||||
Patch0006: 0006-Fix-fp-double-close-work-around-some-false-positives.patch
|
||||
|
||||
BuildRequires: cmake
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: ninja-build
|
||||
@ -277,6 +285,9 @@ mv %{buildroot}%{_bindir}/repo2solv{.sh,}
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Fri Jun 29 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.6.34-3
|
||||
- Backport few fixes and enhancements from upstream
|
||||
|
||||
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.6.34-2
|
||||
- Rebuilt for Python 3.7
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user