101 lines
3.1 KiB
Diff
101 lines
3.1 KiB
Diff
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
|
|
|