#
# Conditional build:
%bcond_without tests # do not perform "make test"
-#
+
%define pdir Mozilla
%define pnam CA
%include /usr/lib/rpm/macros.perl
Group: Development/Languages/Perl
Source0: http://www.cpan.org/modules/by-module/Mozilla/%{pdir}-%{pnam}-%{version}.tar.gz
# Source0-md5: 45a42082dbd68cf25869ceb2aa49d5b2
+Patch0: system-ca-certificates.patch
URL: http://search.cpan.org/dist/Mozilla-CA/
BuildRequires: perl-devel >= 1:5.8.0
BuildRequires: rpm-perlprov >= 4.1-13
+Requires: ca-certificates
BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
-Mozilla::CA provides a copy of Mozilla's bundle of Certificate
-Authority certificates in a form that can be consumed by modules and
-libraries based on OpenSSL.
+Mozilla::CA provides a path to ca-certificates copy of Mozilla's
+bundle of certificate authority certificates in a form that can be
+consumed by modules and libraries based on OpenSSL.
%description -l pl.UTF-8
Mozilla::CA dostarcza kopię pakietu certyfikatów CA (Certificate
%prep
%setup -q -n %{pdir}-%{pnam}-%{version}
+%patch0 -p1
+
+# Do not distribute Mozilla downloader, we take certificates from ca-certificates package
+rm mk-ca-bundle.pl
+sed -i '/^mk-ca-bundle.pl$/d' MANIFEST
%build
%{__perl} Makefile.PL \
%defattr(644,root,root,755)
%doc Changes README
%{perl_vendorlib}/Mozilla/CA.pm
-%{perl_vendorlib}/Mozilla/CA
+#%{perl_vendorlib}/Mozilla/CA
%{_mandir}/man3/Mozilla::CA.3pm*
--- /dev/null
+PLD Linux change (Elan Ruusamäe <glen@pld-linux.org>):
+use /etc/certs/ca-certificates.crt instead of /etc/pki/tls/certs/ca-bundle.crt
+
+From ae8af24d6d935b2824ad955aa9ea8cc557089c77 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Fri, 16 Sep 2011 10:33:54 +0200
+Subject: [PATCH] Redirect to ca-certificates bundle
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+This patch replaces Mozilla-CA certificate bundle with bundle
+delivered by ca-certificates RPM package used as single source of
+Mozilla certificate bundle.
+
+See <https://bugzilla.redhat.com/show_bug.cgi?id=738383> for more
+details.
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ MANIFEST | 1 -
+ Makefile.PL | 8 ++++++++
+ lib/Mozilla/CA.pm | 8 +-------
+ 3 files changed, 9 insertions(+), 8 deletions(-)
+
+diff --git a/MANIFEST b/MANIFEST
+index a88847b..6577ede 100644
+--- a/MANIFEST
++++ b/MANIFEST
+@@ -1,5 +1,4 @@
+ lib/Mozilla/CA.pm
+-lib/Mozilla/CA/cacert.pem
+ Makefile.PL
+ MANIFEST This list of files
+ README
+diff --git a/Makefile.PL b/Makefile.PL
+index 2b10474..57f2f07 100644
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -40,3 +40,11 @@ BEGIN {
+ ExtUtils::MakeMaker::WriteMakefile(%arg);
+ };
+ }
++
++package MY;
++sub MY::libscan {
++ my $name = shift->SUPER::libscan(@_);
++ # Remove private certificate bundle
++ if ($name =~ /cacert.pem\z/) { $name = '' };
++ return $name;
++}
+diff --git a/lib/Mozilla/CA.pm b/lib/Mozilla/CA.pm
+index 050a494..c9f7dc8 100644
+--- a/lib/Mozilla/CA.pm
++++ b/lib/Mozilla/CA.pm
+@@ -3,16 +3,10 @@ package Mozilla::CA;
+ use strict;
+ our $VERSION = '20141217';
+
+-use Cwd ();
+ use File::Spec ();
+-use File::Basename qw(dirname);
+
+ sub SSL_ca_file {
+- my $file = File::Spec->catfile(dirname(__FILE__), "CA", "cacert.pem");
+- if (!File::Spec->file_name_is_absolute($file)) {
+- $file = File::Spec->catfile(Cwd::cwd(), $file);
+- }
+- return $file;
++ return File::Spec->catfile('/etc/certs/ca-certificates.crt');
+ }
+
+ 1;
+--
+1.9.3
+