From be8a2bdebe89bfdc997490c2f6752bda5364a65a Mon Sep 17 00:00:00 2001 From: Paul Howarth Date: Fri, 23 Aug 2019 14:57:17 +0100 Subject: [PATCH] Use upstream-approved fix for zero networks (CPAN RT#60439) Also: - Fix shellbangs in utility scripts - Specify all dependencies - Use %license --- Net-IP-1.26-rt60439.patch | 43 +++++++++++++++++++++ Net-IP-1.26-shellbang.patch | 16 ++++++++ perl-Net-IP-1.25-bz197425.patch | 11 ------ .rpmlint => perl-Net-IP.rpmlintrc | 0 perl-Net-IP.spec | 63 ++++++++++++++++++++++++------- 5 files changed, 108 insertions(+), 25 deletions(-) create mode 100644 Net-IP-1.26-rt60439.patch create mode 100644 Net-IP-1.26-shellbang.patch delete mode 100644 perl-Net-IP-1.25-bz197425.patch rename .rpmlint => perl-Net-IP.rpmlintrc (100%) diff --git a/Net-IP-1.26-rt60439.patch b/Net-IP-1.26-rt60439.patch new file mode 100644 index 0000000..d407347 --- /dev/null +++ b/Net-IP-1.26-rt60439.patch @@ -0,0 +1,43 @@ +--- IP.pm ++++ IP.pm +@@ -416,7 +416,9 @@ sub intip { + + my $int = ip_bintoint($self->binip()); + +- if (!$int) { ++ # this then fails for 0.0.0.0, which is wrong. ++ # ++ if (not defined $int) { + $self->{error} = $ERROR; + $self->{errno} = $ERRNO; + return; +@@ -625,9 +627,11 @@ sub last_int { + + return ($self->{last_int}) if defined($self->{last_int}); + +- my $last_bin = $self->last_bin() or return; ++ my $last_bin = $self->last_bin(); ++ return unless defined $last_bin; + +- my $last_int = ip_bintoint($last_bin, $self->version()) or return; ++ my $last_int = ip_bintoint($last_bin, $self->version()); ++ return unless defined $last_int; + + $self->{last_int} = $last_int; + +@@ -1267,11 +1271,13 @@ sub ip_prefix_to_range { + # Turn into a binary + # Get last address + # Turn into an IP +- my $binip = ip_iptobin($ip, $ip_version) or return; ++ my $binip = ip_iptobin($ip, $ip_version); ++ return unless defined $binip; + + return unless (ip_check_prefix($binip, $len, $ip_version)); + +- my $lastip = ip_last_address_bin($binip, $len, $ip_version) or return; ++ my $lastip = ip_last_address_bin($binip, $len, $ip_version); ++ return unless defined $lastip; + return unless ($lastip = ip_bintoip($lastip, $ip_version)); + + return ($ip, $lastip); diff --git a/Net-IP-1.26-shellbang.patch b/Net-IP-1.26-shellbang.patch new file mode 100644 index 0000000..6458b58 --- /dev/null +++ b/Net-IP-1.26-shellbang.patch @@ -0,0 +1,16 @@ +--- ipcount ++++ ipcount +@@ -1,4 +1,4 @@ +-#!perl -w ++#!/usr/bin/perl -w + + # Copyright (c) 2000 RIPE NCC + # +--- iptab ++++ iptab +@@ -1,4 +1,4 @@ +-#!perl ++#!/usr/bin/perl + + use Net::IP; + use strict; diff --git a/perl-Net-IP-1.25-bz197425.patch b/perl-Net-IP-1.25-bz197425.patch deleted file mode 100644 index 9e8fc9f..0000000 --- a/perl-Net-IP-1.25-bz197425.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Net-IP-1.25/IP.pm.bz197425 2006-05-22 12:46:40.000000000 -0400 -+++ Net-IP-1.25/IP.pm 2006-07-05 15:20:26.000000000 -0400 -@@ -410,7 +410,7 @@ - - my $int = ip_bintoint($self->binip()); - -- if (!$int) { -+ if (ref($int) ne "Math::BigInt") { - $self->{error} = $ERROR; - $self->{errno} = $ERRNO; - return; diff --git a/.rpmlint b/perl-Net-IP.rpmlintrc similarity index 100% rename from .rpmlint rename to perl-Net-IP.rpmlintrc diff --git a/perl-Net-IP.spec b/perl-Net-IP.spec index ba55360..1d9c44b 100644 --- a/perl-Net-IP.spec +++ b/perl-Net-IP.spec @@ -1,58 +1,93 @@ +#TODO: BR:/R: perl(IP::Authority) when available + Name: perl-Net-IP Version: 1.26 -Release: 19%{?dist} +Release: 20%{?dist} Summary: Perl module for manipulation of IPv4 and IPv6 addresses # Some ambiguity here, see http://rt.cpan.org/Ticket/Display.html?id=28689 # MIT-like for the IP.pm itself, and "like Perl itself" for all the other # scripts included. License: MIT and (GPL+ or Artistic) URL: https://metacpan.org/release/Net-IP -Source: https://cpan.metacpan.org/authors/id/M/MA/MANU/Net-IP-%{version}.tar.gz -Patch0: perl-Net-IP-1.25-bz197425.patch +Source: https://cpan.metacpan.org/modules/by-module/Net/Net-IP-%{version}.tar.gz +Patch0: Net-IP-1.26-rt60439.patch +Patch1: Net-IP-1.26-shellbang.patch BuildArch: noarch +# Build: +BuildRequires: coreutils +BuildRequires: findutils +BuildRequires: make BuildRequires: perl-generators +BuildRequires: perl-interpreter +BuildRequires: perl(Config) BuildRequires: perl(ExtUtils::MakeMaker) # Run-time: BuildRequires: perl(Exporter) BuildRequires: perl(Math::BigInt) +BuildRequires: perl(overload) +BuildRequires: perl(strict) +BuildRequires: perl(vars) +# Script Run-time: +BuildRequires: perl(Getopt::Std) # Tests: +BuildRequires: perl(File::Basename) +BuildRequires: perl(FileHandle) BuildRequires: perl(lib) +# Dependencies: Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) # Not yet packaged: IP::Authority %description -This is the Net::IP module for Perl, designed to allow easy -manipulation of IPv4 and IPv6 addresses. Two applications using the -Net::IP module are included: ipcount, an IP address mini-calculator, -it can calculate the number of IP addresses in a prefix or all the -prefixes contained in a given range; and iptab, which prints out a +This is the Net::IP module, designed to allow easy manipulation of IPv4 and +IPv6 addresses. + +Two applications using the Net::IP module are included: ipcount, an IP address +mini-calculator, which can calculate the number of IP addresses in a prefix or +all the prefixes contained in a given range; and iptab, which prints out a handy IP "cheat sheet". %prep %setup -q -n Net-IP-%{version} -%patch0 -p1 + +# Apply fix for zero networks (#197425, CPAN RT#20265, CPAN RT#60439) +%patch0 + +# Fix shellbangs in shipped scripts +%patch1 %build perl Makefile.PL INSTALLDIRS=vendor make %{?_smp_mflags} %install -make pure_install DESTDIR=$RPM_BUILD_ROOT -find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} ';' -chmod -R u+w $RPM_BUILD_ROOT/* +make pure_install DESTDIR=%{buildroot} +find %{buildroot} -type f -name .packlist -delete +%{_fixperms} -c %{buildroot} %check make test +# This should work for 0.0.0.0 +# https://bugzilla.redhat.com/show_bug.cgi?id=197425 +PERL5LIB=%{buildroot}%{perl_vendorlib} ./iptab + %files -%doc COPYING Changes README +%license COPYING +%doc Changes README +# GPL+ or Artistic %{_bindir}/ipcount %{_bindir}/iptab +# MIT %{perl_vendorlib}/Net/ %{_mandir}/man3/Net::IP.3* - %changelog +* Fri Aug 23 2019 Paul Howarth - 1.26-20 +- Use upstream-approved fix for zero networks (CPAN RT#60439) +- Fix shellbangs in utility scripts +- Specify all dependencies +- Use %%license + * Fri Jul 26 2019 Fedora Release Engineering - 1.26-19 - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild