upgrade version to 0.17

This commit is contained in:
jinzhimin369 2021-01-27 12:36:48 +08:00 committed by yangl777
parent 780e02fae4
commit 33ee1e0d79
5 changed files with 7 additions and 275 deletions

View File

@ -1,171 +0,0 @@
From 74b81a4a092a3c31c3ad2506a2311f461cd7b4ae Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Tue, 17 Apr 2018 17:20:13 +0200
Subject: [PATCH] Implement genmetaalgo 1
Add setgenmetaalgo method to select the desired algorithm
---
BSSolv.xs | 70 ++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 49 insertions(+), 21 deletions(-)
diff --git a/BSSolv.xs b/BSSolv.xs
index 726b4ff..dcee8e6 100644
--- a/BSSolv.xs
+++ b/BSSolv.xs
@@ -128,6 +128,8 @@ static Id expander_directdepsend;
static Id buildservice_dodcookie;
static Id buildservice_annotation;
+static int genmetaalgo;
+
/* make sure bit n is usable */
#define MAPEXP(m, n) ((m)->size < (((n) + 8) >> 3) ? map_grow(m, n + 256) : 0)
@@ -2743,10 +2745,10 @@ create_considered(Pool *pool, Repo *repoonly, Map *considered, int unorderedrepo
}
struct metaline {
- char *l;
- int lastoff;
- int nslash;
- int killed;
+ char *l; /* pointer to line */
+ int lastoff; /* line offset of last path element */
+ int nslash; /* number of slashes */
+ int killed; /* 1: line has been killed. 2: because of a cycle package */
};
static int metacmp(const void *ap, const void *bp)
@@ -5243,6 +5245,19 @@ depsort(HV *deps, SV *mapp, SV *cycp, ...)
solv_free(names);
}
+int
+setgenmetaalgo(int algo)
+ CODE:
+ if (algo < 0)
+ algo = 1;
+ if (algo > 1)
+ croak("BSSolv::setgenmetaalgo: unsupported algo %d\n", algo);
+ genmetaalgo = algo;
+ RETVAL = algo;
+ OUTPUT:
+ RETVAL
+
+
void
gen_meta(AV *subp, ...)
PPCODE:
@@ -5328,7 +5343,7 @@ gen_meta(AV *subp, ...)
}
if (cycle)
{
- lp->killed = 1;
+ lp->killed = 1; /* killed because line includes a subpackage */
if (cycle > 1) /* ignore self cycles */
queue_push(&cycles, i);
}
@@ -5344,9 +5359,9 @@ gen_meta(AV *subp, ...)
char *cycledata = 0;
int cycledatalen = 0;
+ /* create hash of cycle packages */
cycledata = solv_extend(cycledata, cycledatalen, 1, 1, 255);
- cycledata[0] = 0;
- cycledatalen += 1;
+ cycledata[cycledatalen++] = 0;
hm = mkmask(cycles.count);
ht = solv_calloc(hm + 1, sizeof(*ht));
for (i = 0; i < cycles.count; i++)
@@ -5364,18 +5379,23 @@ gen_meta(AV *subp, ...)
break;
h = HASHCHAIN_NEXT(h, hh, hm);
}
- if (id)
- continue;
- cycledata = solv_extend(cycledata, cycledatalen, strlen(s) + 1, 1, 255);
- ht[h] = cycledatalen;
- strcpy(cycledata + cycledatalen, s);
- cycledatalen += strlen(s) + 1;
+ if (!id)
+ {
+ int l = strlen(s);
+ cycledata = solv_extend(cycledata, cycledatalen, l + 1, 1, 255);
+ ht[h] = cycledatalen; /* point to name */
+ strcpy(cycledata + cycledatalen, s);
+ cycledatalen += l + 1;
+ }
if (se)
*se = '/';
}
+
for (i = 0, lp = lines; i < nlines; i++, lp++)
{
- if (lp->killed || !lp->nslash)
+ if (!lp->nslash)
+ continue;
+ if (lp->killed && genmetaalgo == 0)
continue;
lo = strchr(lp->l + 34, '/') + 1;
for (s2 = lo; *s2; s2++)
@@ -5393,12 +5413,12 @@ gen_meta(AV *subp, ...)
*s2 = '/';
if (id)
{
- lp->killed = 1;
+ lp->killed = 2; /* killed because it containes a cycle package */
break;
}
lo = s2 + 1;
}
- if (lp->killed)
+ if (lp->killed == 2)
continue;
h = strhash(lo) & hm;
hh = HASHCHAIN_START;
@@ -5409,14 +5429,12 @@ gen_meta(AV *subp, ...)
h = HASHCHAIN_NEXT(h, hh, hm);
}
if (id)
- {
- lp->killed = 1;
- }
+ lp->killed = 2; /* killed because it containes a cycle package */
}
solv_free(ht);
cycledata = solv_free(cycledata);
- queue_free(&cycles);
}
+ queue_free(&cycles);
/* cycles are pruned, now sort array */
if (nlines > 1)
@@ -5427,7 +5445,10 @@ gen_meta(AV *subp, ...)
for (i = 0, lp = lines; i < nlines; i++, lp++)
{
if (lp->killed)
- continue;
+ {
+ if (genmetaalgo == 0 || lp->killed != 2)
+ continue;
+ }
s = lp->l;
h = strnhash(s, 10);
h = strhash_cont(s + lp->lastoff, h) & hm;
@@ -5439,6 +5460,13 @@ gen_meta(AV *subp, ...)
break;
h = HASHCHAIN_NEXT(h, hh, hm);
}
+ if (id && genmetaalgo == 1 && lp->killed == 2)
+ {
+ /* also kill old line of same level */
+ struct metaline *lp2 = lines + (id - 1);
+ if (!lp2->killed && lp2->nslash == lp->nslash)
+ lp2->killed = 1;
+ }
if (id)
lp->killed = 1;
else
--
2.17.0

View File

@ -1,100 +0,0 @@
From a893eacf6594e2526e5a1ee73de3870947711ed0 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com>
Date: Sun, 27 May 2018 09:39:40 -0400
Subject: [PATCH] Align Debian and Arch support to libsolv
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
libsolv can be built without support for Debian or Arch repositories.
Thus, we should detect to build perl-BSSolv against libsolv that does not
support them.
Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1342160
Co-authored-by: Petr Písař <ppisar@redhat.com>
---
BSSolv.xs | 8 +++++++-
Makefile.PL | 15 +++++++++++++--
2 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/BSSolv.xs b/BSSolv.xs
index dcee8e6..26c659d 100644
--- a/BSSolv.xs
+++ b/BSSolv.xs
@@ -26,8 +26,10 @@
#include "repo_solv.h"
#include "repo_write.h"
#include "repo_rpmdb.h"
+#ifdef HAVE_DEBIAN
#include "repo_deb.h"
-#if 1
+#endif
+#ifdef HAVE_ARCH
#include "repo_arch.h"
#endif
#if defined(LIBSOLV_FEATURE_COMPLEX_DEPS)
@@ -2867,8 +2869,10 @@ repodata_addbin(Repodata *data, char *prefix, char *s, int sl, char *sid)
path = solv_dupjoin(prefix, "/", s);
if (sl >= 4 && !strcmp(s + sl - 4, ".rpm"))
p = repo_add_rpm(data->repo, (const char *)path, REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE|REPO_NO_LOCATION|RPM_ADD_WITH_PKGID|RPM_ADD_NO_FILELIST|RPM_ADD_NO_RPMLIBREQS);
+#ifdef HAVE_DEBIAN
else if (sl >= 4 && !strcmp(s + sl - 4, ".deb"))
p = repo_add_deb(data->repo, (const char *)path, REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE|REPO_NO_LOCATION|DEBS_ADD_WITH_PKGID);
+#endif
else if (sl >= 10 && !strcmp(s + sl - 10, ".obsbinlnk"))
{
p = repo_add_obsbinlnk(data->repo, (const char *)path, REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE|REPO_NO_LOCATION);
@@ -2879,8 +2883,10 @@ repodata_addbin(Repodata *data, char *prefix, char *s, int sl, char *sid)
return p;
}
#ifdef ARCH_ADD_WITH_PKGID
+#ifdef HAVE_ARCH
else if (sl >= 11 && (!strcmp(s + sl - 11, ".pkg.tar.gz") || !strcmp(s + sl - 11, ".pkg.tar.xz")))
p = repo_add_arch_pkg(data->repo, (const char *)path, REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE|REPO_NO_LOCATION|ARCH_ADD_WITH_PKGID);
+#endif
#endif
solv_free(path);
if (!p)
diff --git a/Makefile.PL b/Makefile.PL
index 58604f3..90eb131 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -2,21 +2,32 @@ use ExtUtils::MakeMaker;
my $solvprefix = '/usr';
-my $inc = "-I$solvprefix/include/solv";
+my @inc_dirs = ("$solvprefix/include/solv");
my $lib;
if (grep {$_ eq '--bundled-libsolv'} @ARGV) {
my $builddir = 'libsolv';
- $inc = "-I$builddir/src -I$builddir/ext";
+ @inc_dirs = ("$builddir/src", "$builddir/ext");
$lib = "-L$builddir/src -L$builddir/ext -lsolvext -lsolv -lz -llzma";
} else {
$lib = '-lsolvext -lsolv';
}
+my $def = '';
+
+if (grep {-e "$_/repo_deb.h"} @inc_dirs) {
+ $def .= ' -DHAVE_DEBIAN';
+}
+if (grep {-e "$_/repo_arch.h"} @inc_dirs) {
+ $def .= ' -DHAVE_ARCH';
+}
+
+my $inc = join ' ', map { '-I' . $_ } @inc_dirs;
WriteMakefile(
NAME => 'BSSolv',
VERSION_FROM => 'BSSolv.pm',
+ DEFINE => $def,
INC => $inc,
LIBS => [ $lib ],
)
--
2.17.0

Binary file not shown.

BIN
perl-BSSolv-0.17.tar.gz Normal file

Binary file not shown.

View File

@ -2,20 +2,20 @@
%global min_libsolv_version 0.6.30 %global min_libsolv_version 0.6.30
Name: perl-BSSolv Name: perl-BSSolv
Version: 0.14 Version: 0.17
Release: 1%{?dist} Release: 1
Summary: OBS solver and repository management using libsolv Summary: OBS solver and repository management using libsolv
License: GPL or Artistic License: GPL or Artistic
URL: https://github.com/openSUSE/perl-BSSolv URL: https://github.com/openSUSE/perl-BSSolv
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
# Backports from upstream # Backports from upstream
Patch0001: 0001-Implement-genmetaalgo-1.patch #Patch0001: 0001-Implement-genmetaalgo-1.patch
# Patches proposed upstream # Patches proposed upstream
# Align Debian and Arch support to libsolv, bug #1342160 # Align Debian and Arch support to libsolv, bug #1342160
# From: https://github.com/openSUSE/perl-BSSolv/pull/10 # From: https://github.com/openSUSE/perl-BSSolv/pull/10
Patch0501: 0501-Align-Debian-and-Arch-support-to-libsolv.patch #Patch0501: 0501-Align-Debian-and-Arch-support-to-libsolv.patch
BuildRequires: gcc BuildRequires: gcc
BuildRequires: libsolv-devel >= %{min_libsolv_version} BuildRequires: libsolv-devel >= %{min_libsolv_version}
@ -61,6 +61,9 @@ make test
%doc README dist/perl-BSSolv.changes %doc README dist/perl-BSSolv.changes
%changelog %changelog
* Wed Jan 27 2021 liudabo <liudabo1@huawei.com> - 0.17-1
- upgrade version to 0.17
* Wed Nov 25 2020 wuchaochao <wuchaochao4@huawei.com> - 0.14-1 * Wed Nov 25 2020 wuchaochao <wuchaochao4@huawei.com> - 0.14-1
- change spec - change spec