!1 Init package

Merge pull request !1 from syyhao/developer
This commit is contained in:
openeuler-ci-bot 2020-03-06 17:23:00 +08:00 committed by Gitee
commit 933443eeeb
11 changed files with 7933 additions and 73 deletions

View File

@ -0,0 +1,171 @@
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

@ -0,0 +1,100 @@
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

17
BSSolv.pm Normal file
View File

@ -0,0 +1,17 @@
package BSSolv;
use strict;
require Exporter;
our @ISA = qw(Exporter);
our $VERSION = '0.17';
require XSLoader;
XSLoader::load('BSSolv', $VERSION);
package BSSolv::repo;
1;

7545
BSSolv.xs Normal file

File diff suppressed because it is too large Load Diff

22
Makefile.PL Normal file
View File

@ -0,0 +1,22 @@
use ExtUtils::MakeMaker;
my $solvprefix = '/usr';
my $inc = "-I$solvprefix/include/solv";
my $lib;
if (grep {$_ eq '--bundled-libsolv'} @ARGV) {
my $builddir = 'libsolv';
$inc = "-I$builddir/src -I$builddir/ext";
$lib = "-L$builddir/src -L$builddir/ext -lsolvext -lsolv -lz -llzma -lzstd";
} else {
$lib = '-lsolvext -lsolv';
}
WriteMakefile(
NAME => 'BSSolv',
VERSION_FROM => 'BSSolv.pm',
INC => $inc,
LIBS => [ $lib ],
)

View File

@ -1,36 +0,0 @@
# perl-BSSolv
#### Description
A new approach to package dependency solving
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1,37 +0,0 @@
# perl-BSSolv
#### 介绍
A new approach to package dependency solving
#### 软件架构
软件架构说明
#### 安装教程
1. xxxx
2. xxxx
3. xxxx
#### 使用说明
1. xxxx
2. xxxx
3. xxxx
#### 参与贡献
1. Fork 本仓库
2. 新建 Feat_xxx 分支
3. 提交代码
4. 新建 Pull Request
#### 码云特技
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
2. 码云官方博客 [blog.gitee.com](https://blog.gitee.com)
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解码云上的优秀开源项目
4. [GVP](https://gitee.com/gvp) 全称是码云最有价值开源项目,是码云综合评定出的优秀开源项目
5. 码云官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
6. 码云封面人物是一档用来展示码云会员风采的栏目 [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

BIN
libsolv-0.7.2.tar.gz Normal file

Binary file not shown.

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

Binary file not shown.

75
perl-BSSolv.spec Normal file
View File

@ -0,0 +1,75 @@
Name: perl-BSSolv
Version: 0.37
Release: lp151.1.2
Summary: A new approach to package dependency solving
License: BSD-3-Clause
Url: https://github.com/openSUSE/perl-BSSolv
Source: libsolv-0.7.2.tar.gz
Source1: Makefile.PL
Source2: BSSolv.pm
Source3: BSSolv.xs
Source4: typemap
BuildRequires: perl-devel cmake gcc-c++ perl xz-devel zlib-devel
BuildRequires: libzstd-devel perl(ExtUtils::MakeMaker) check-devel
Requires: perl
%if 0%{!?perl_vendorarch}
%define perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
%endif
%description
Using a Satisfyability Solver to compute package dependencies.
%prep
%setup -c
ln -s libsolv-* libsolv
cp %{SOURCE1} %{SOURCE2} %{SOURCE3} %{SOURCE4} .
pushd libsolv
popd
%build
export CFLAGS="$RPM_OPT_FLAGS"
export CXXFLAGS="$CFLAGS"
CMAKE_FLAGS=
CFLAGS="$CFLAGS -DUSE_OWN_QSORT"
pushd libsolv
cmake $CMAKE_FLAGS \
-DDISABLE_SHARED=1 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_SKIP_RPATH=1 \
-DENABLE_RPMPKG=1 \
-DENABLE_DEBIAN=1 \
-DENABLE_ARCHREPO=1 \
-DENABLE_LZMA_COMPRESSION=1 \
-DENABLE_ZSTD_COMPRESSION=1 \
-DENABLE_COMPLEX_DEPS=1 \
-DMULTI_SEMANTICS=1
pushd src ; make ; popd
pushd ext ; make ; popd
popd
perl Makefile.PL --bundled-libsolv INSTALLDIRS=vendor NO_PERLLOCAL=1 NO_PACKLIST=1
%make_build
%check
make test
%install
make DESTDIR=%{buildroot} install_vendor
find %{buildroot} -type f -name perllocal.pod -exec rm -f {} \;
find %{buildroot} -type f -name .packlist -exec rm -f {} \;
find %{buildroot} -type f -name '*.bs' -a -size 0 -exec rm -f {} ';'
find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null \;
%{_fixperms} %{buildroot}/*
%files
%defattr(-,root,root)
%{perl_vendorarch}/BSSolv.pm
%{perl_vendorarch}/auto/BSSolv
%changelog
* Wed Mar 4 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.37-lp151.1.2
- Package init

3
typemap Normal file
View File

@ -0,0 +1,3 @@
BSSolv::pool T_PTROBJ
BSSolv::repo T_PTROBJ
BSSolv::expander T_PTROBJ