#1 Rebase to 0.14
Merged 5 years ago by ngompa. Opened 5 years ago by ngompa.
rpms/ ngompa/perl-BSSolv rebase-BSSolv-0.14  into  master

file modified
+1
@@ -1,1 +1,2 @@ 

  /BSSolv-0.01-git1e18c32.tar.gz

+ /perl-BSSolv-0.14.tar.gz

@@ -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

+ 

0501-Align-Debian-and-Arch-support-to-libsolv.patch BSSolv-0.01-Align-Debian-and-Arch-support-to-libsolv.patch
file renamed
+33 -25
@@ -1,27 +1,28 @@ 

- From a6e945332b7252cd7b334f0be6a5940c562b53a0 Mon Sep 17 00:00:00 2001

- From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>

- Date: Mon, 6 Jun 2016 13:43:49 +0200

+ 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.

- This patch allows to build perl-BSSolv against libsolv that does not

+ Thus, we should detect to build perl-BSSolv against libsolv that does not

  support them.

  

- https://bugzilla.redhat.com/show_bug.cgi?id=1342160

- Signed-off-by: Petr Písař <ppisar@redhat.com>

+ Reference: https://bugzilla.redhat.com/show_bug.cgi?id=1342160

+ 

+ Co-authored-by: Petr Písař <ppisar@redhat.com>

  ---

   BSSolv.xs   |  8 +++++++-

-  Makefile.PL | 16 +++++++++++++---

-  2 files changed, 20 insertions(+), 4 deletions(-)

+  Makefile.PL | 15 +++++++++++++--

+  2 files changed, 20 insertions(+), 3 deletions(-)

  

  diff --git a/BSSolv.xs b/BSSolv.xs

- index 4468be9..9116a7c 100644

+ index dcee8e6..26c659d 100644

  --- a/BSSolv.xs

  +++ b/BSSolv.xs

- @@ -16,8 +16,10 @@

+ @@ -26,8 +26,10 @@

   #include "repo_solv.h"

   #include "repo_write.h"

   #include "repo_rpmdb.h"
@@ -32,44 +33,50 @@ 

  +#ifdef HAVE_ARCH

   #include "repo_arch.h"

   #endif

-  

- @@ -1018,11 +1020,15 @@ repodata_addbin(Repodata *data, char *prefix, char *s, int sl, char *sid)

+  #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);

-    else if (sl >= 4 && !strcmp(s + sl - 4, ".deb"))

  +#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

+  #endif

     solv_free(path);

     if (!p)

-      return 0;

  diff --git a/Makefile.PL b/Makefile.PL

- index 1325734..e150b52 100644

+ index 58604f3..90eb131 100644

  --- a/Makefile.PL

  +++ b/Makefile.PL

- @@ -2,20 +2,30 @@ use ExtUtils::MakeMaker;

+ @@ -2,21 +2,32 @@ use ExtUtils::MakeMaker;

   

   my $solvprefix = '/usr';

   

  -my $inc = "-I$solvprefix/include/solv";

  +my @inc_dirs = ("$solvprefix/include/solv");

-  my $lib = '';

+  my $lib;

   

-  if (@ARGV && $ARGV[0] eq '--bundled-libsolv') {

+  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";

+    $lib = "-L$builddir/src -L$builddir/ext -lsolvext -lsolv -lz -llzma";

+  } else {

+    $lib = '-lsolvext -lsolv';

   }

   

-  $lib = ($lib ? "$lib " : '') . '-lsolvext -lsolv -lz -llzma';

-  

  +my $def = '';

  +

  +if (grep {-e "$_/repo_deb.h"} @inc_dirs) {
@@ -79,14 +86,15 @@ 

  +    $def .= ' -DHAVE_ARCH';

  +}

  +

+ +my $inc = join ' ', map { '-I' . $_ } @inc_dirs;

+  

   WriteMakefile(

       NAME         => 'BSSolv',

       VERSION_FROM => 'BSSolv.pm',

- -    INC          => $inc,

  +    DEFINE       => $def,

- +    INC          => join(' ', map("-I$_", @inc_dirs)),

+      INC          => $inc,

       LIBS         => [ $lib ],

   )

  -- 

- 2.5.5

+ 2.17.0

  

file modified
+43 -26
@@ -1,54 +1,71 @@ 

- %global gitrev 1e18c32

+ %global min_libsolv_version 0.6.30

  

  Name:           perl-BSSolv

- Version:        0.01

- Release:        19.git%{gitrev}%{?dist}

- Url:            https://github.com/openSUSE/perl-BSSolv

- # Taken from the upstream url from the revision %{gitrev}

- Source0:        BSSolv-%{version}-git%{gitrev}.tar.gz

+ Version:        0.14

+ Release:        1%{?dist}

+ Summary:        OBS solver and repository management using libsolv

+ License:        GPL or Artistic

+ URL:            https://github.com/openSUSE/perl-BSSolv

+ Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz

+ 

+ # Backports from upstream

+ Patch0001:      0001-Implement-genmetaalgo-1.patch

+ 

+ # Patches proposed upstream

  # Align Debian and Arch support to libsolv, bug #1342160

- Patch0:         BSSolv-0.01-Align-Debian-and-Arch-support-to-libsolv.patch

- Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

- BuildRequires:  libsolv-devel >= 0.3.0-7

- BuildRequires:  libdb4-devel

+ # From: https://github.com/openSUSE/perl-BSSolv/pull/10

+ Patch0501:      0501-Align-Debian-and-Arch-support-to-libsolv.patch

+ 

+ BuildRequires:  libsolv-devel >= %{min_libsolv_version}

  BuildRequires:  perl-interpreter

  BuildRequires:  perl(strict)

- BuildRequires:  expat-devel

  BuildRequires:  perl-interpreter

  BuildRequires:  perl-devel

  BuildRequires:  perl-generators

- BuildRequires:  xz-devel

- BuildRequires:  zlib-devel

+ BuildRequires:  perl(Test::More)

  BuildRequires:  perl(ExtUtils::MakeMaker)

- Summary:        A new approach to package dependency solving

- License:        GPL or Artistic

- Group:          Development/Libraries

+ Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

+ Requires:       libsolv%{?_isa} >= %{min_libsolv_version}

+ 

  

  %description

- Using a Satisfyability Solver to compute package dependencies.

+ This is a support perl module for the OBS backend. It contains functions

+ for repository management, dependency solving, package ordering, and meta

+ file creation.

+ 

  

  %prep

- %setup -c %{name}-%{version}-%{release} -T

- tar xvzf %{SOURCE0}

- %patch0 -p1

+ %autosetup -p1

  

  %build

+ # Ensure build flags are set

+ %{set_build_flags}

  perl Makefile.PL

  make %{?_smp_mflags}

  

  %install

- make DESTDIR=$RPM_BUILD_ROOT install_vendor

- find $RPM_BUILD_ROOT -type f -name perllocal.pod -exec rm -f {} \;

- find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;

- find $RPM_BUILD_ROOT -type f -name '*.bs' -a -size 0 -exec rm -f {} ';'

- %{_fixperms} $RPM_BUILD_ROOT/*

+ 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 {} ';'

+ %{_fixperms} %{buildroot}/*

+ 

+ %check

+ make test

  

  %files

  %{perl_vendorarch}/BSSolv.pm

  %{perl_vendorarch}/auto/BSSolv

- %doc README

+ %doc README dist/perl-BSSolv.changes

  

  %changelog

+ * Sun May 27 2018 Neal Gompa <ngompa13@gmail.com> - 0.14-1

+ - Rebase to 0.14

+ - Backport genmetaalgo support

+ - Refresh patch for building against EL libsolv

+ - Enable running unit tests

+ - Modernize spec

+ 

  * Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.01-19.git1e18c32

  - Escape macros in %%changelog

  

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- fc4542746acdd5ac9402d0b626d8e7e7  BSSolv-0.01-git1e18c32.tar.gz

+ SHA512 (perl-BSSolv-0.14.tar.gz) = cf95b0f842da9ff446bdced74030a7eebcfd2e9260ed830cfc977bb3105cad933880e47dc954069ac5ba89a2ba3d8f1f440556091584fa6b48872a74681b0415