perl-LDAP/perl-LDAP.spec
2022-07-15 22:01:26 +08:00

190 lines
5.9 KiB
RPMSpec

%bcond_with perl_LDAP_enables_optional_test
# Support XML serialization of LDAP schemata (DSML languge)
%bcond_with perl_LDAP_enables_xml
Name: perl-LDAP
Version: 0.68
Release: 1
Summary: LDAP Perl module
License: GPL+ or Artistic
URL: https://metacpan.org/release/perl-ldap
Source0: https://cpan.metacpan.org/authors/id/M/MA/MARSCHAP/perl-ldap-%{version}.tar.gz
# Optional tests need to know a location of an LDAP server executable
Patch0: perl-ldap-0.65-Configure-usr-sbin-slapd-for-tests.patch
# Remove an unreliable cancelling test
Patch1: perl-ldap-0.66-test-Remove-a-test-for-cancelling-asynchronous-calls.patch
# Fix resolving localhost on loopback-only machines
Patch2: perl-ldap-0.68-Do-not-default-IO-Socket-IP-to-AI_ADDRCONFIG-flag.patch
BuildArch: noarch
BuildRequires: coreutils
BuildRequires: make
BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(Config)
BuildRequires: perl(inc::Module::Install)
BuildRequires: perl(Module::Install::AutoInstall)
BuildRequires: perl(Module::Install::Metadata)
BuildRequires: perl(Module::Install::WriteAll)
# Run-time:
BuildRequires: perl(base)
BuildRequires: perl(Carp)
BuildRequires: perl(constant)
BuildRequires: perl(Convert::ASN1) >= 0.2
BuildRequires: perl(Encode)
BuildRequires: perl(Exporter)
BuildRequires: perl(IO::Select)
BuildRequires: perl(IO::Socket)
%if %{with perl_LDAP_enables_optional_test}
BuildRequires: perl(IO::Socket::SSL) >= 1.26
%endif
BuildRequires: perl(Socket)
BuildRequires: perl(strict)
BuildRequires: perl(Text::Soundex)
BuildRequires: perl(Time::Local)
%if %{with perl_LDAP_enables_xml}
BuildRequires: perl(XML::SAX::Base)
BuildRequires: perl(XML::SAX::Writer)
%endif
# Tests:
BuildRequires: perl(File::Basename)
BuildRequires: perl(File::Compare)
BuildRequires: perl(File::Path)
BuildRequires: perl(File::Spec)
BuildRequires: perl(IO::File)
BuildRequires: perl(Test::More)
%if %{with perl_LDAP_enables_optional_test}
# Optional tests:
BuildRequires: openldap-servers
BuildRequires: perl(LWP::UserAgent)
%endif
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires: perl(Authen::SASL) >= 2.00
Requires: perl(Convert::ASN1) >= 0.2
Requires: perl(IO::Socket::SSL) >= 1.26
Requires: perl(JSON)
%if %{with perl_LDAP_enables_xml}
Suggests: perl(Net::LDAP::DSML)
%endif
Requires: perl(MIME::Base64)
# Prefer core Text::Soundex
Requires: perl(Text::Soundex)
Requires: perl(Time::Local)
# Remove under-specified dependencies
%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}^perl\\(Net::LDAP::Filter\\)$
%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}^perl\\(Convert::ASN1\\)$
%description
Net::LDAP is a collection of modules that implements an LDAP services API
for Perl programs. The module may be used to search directories or perform
maintenance functions such as adding, deleting or modifying entries.
%if %{with perl_LDAP_enables_xml}
%package -n perl-Net-LDAP-DSML
Summary: DSML Writer for Net::LDAP
Requires: perl-LDAP = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Requires: perl(MIME::Base64)
Requires: perl(Net::LDAP::Schema)
Requires: perl(XML::SAX::Writer)
%description -n perl-Net-LDAP-DSML
Directory Service Markup Language (DSML) is the XML standard for representing
directory service information in XML. At the moment this Perl module only
writes DSML entry and schema entities. Reading DSML entities is a future
project.
%endif
%package tests
Summary: Tests for %{name}
Requires: coreutils
Requires: perl-LDAP = %{?epoch:%{epoch}:}%{version}-%{release}
Requires: perl-Test-Harness
Requires: perl(Convert::ASN1) >= 0.2
Requires: perl(File::Spec)
Requires: perl(Net::LDAPI)
Requires: perl(Text::Soundex)
%if %{with perl_LDAP_enables_xml}
Requires: perl(XML::SAX::Base)
Requires: perl(XML::SAX::Writer)
%endif
%if %{with perl_LDAP_enables_optional_test}
# Optional tests:
Requires: openldap-servers
Requires: perl(IO::Socket::SSL) >= 1.26
Requires: perl(Net::LDAPS)
Requires: perl(LWP::UserAgent)
%endif
%description tests
Tests from %{name}-%{version}. Execute them with "%{_libexecdir}/%{name}/test".
%prep
%setup -q -n perl-ldap-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
chmod -c 644 bin/* contrib/* lib/Net/LDAP/DSML.pm
perl -pi -e 's|^#!/usr/local/bin/perl\b|#!%{__perl}|' contrib/*
rm -rf inc
perl -i -ne 'print $_ unless m{^inc/}' MANIFEST
%if !%{with perl_LDAP_enables_xml}
rm t/05dsml.t
perl -i -ne 'print $_ unless m{^t/05dsml\.t}' MANIFEST
%endif
find -type f \! -name 'regenerate_cert.sh' -exec chmod -x {} +
for F in t/*; do
perl -i -MConfig -pe 's/\A#!perl\b/$Config{startperl}/' "$F"
chmod +x "$F"
done
%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 < /dev/null
%{make_build}
%install
%{make_install}
mkdir -p %{buildroot}/%{_libexecdir}/%{name}
cp -a data t test.cfg %{buildroot}/%{_libexecdir}/%{name}
cat > %{buildroot}/%{_libexecdir}/%{name}/test <<'EOF'
#!/bin/bash
set -e
DIR=$(mktemp -d)
pushd "$DIR"
cp -a %{_libexecdir}/%{name}/* ./
prove -I .
popd
rm -rf "$DIR"
EOF
chmod +x %{buildroot}/%{_libexecdir}/%{name}/test
%{_fixperms} %{buildroot}/*
%check
make test
%files
%doc Changes CREDITS
%doc contrib/ bin/
%{perl_vendorlib}/Bundle/
%{perl_vendorlib}/LWP/
%{perl_vendorlib}/Net/
%exclude %{perl_vendorlib}/Net/LDAP/DSML.pm
%{_mandir}/man3/*.3pm*
%exclude %{_mandir}/man3/Net::LDAP::DSML.3pm*
%if %{with perl_LDAP_enables_xml}
%files -n perl-Net-LDAP-DSML
%{perl_vendorlib}/Net/LDAP/DSML.pm
%{_mandir}/man3/Net::LDAP::DSML.3pm*
%endif
%files tests
%{_libexecdir}/%{name}
%changelog
* Thu Jun 30 2022 misaka00251 <misaka00251@misakanet.cn> - 0.68-1
- Init package (Thanks to fedora team)