Use upstream-approved fix for zero networks (CPAN RT#60439)

Also:
- Fix shellbangs in utility scripts
- Specify all dependencies
- Use %license
epel9 imports/e9/perl-Net-IP-1.26-20.el9
Paul Howarth 6 years ago
parent f4a6e32d4d
commit be8a2bdebe

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

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

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

@ -1,58 +1,93 @@
#TODO: BR:/R: perl(IP::Authority) when available
Name: perl-Net-IP Name: perl-Net-IP
Version: 1.26 Version: 1.26
Release: 19%{?dist} Release: 20%{?dist}
Summary: Perl module for manipulation of IPv4 and IPv6 addresses Summary: Perl module for manipulation of IPv4 and IPv6 addresses
# Some ambiguity here, see http://rt.cpan.org/Ticket/Display.html?id=28689 # 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 # MIT-like for the IP.pm itself, and "like Perl itself" for all the other
# scripts included. # scripts included.
License: MIT and (GPL+ or Artistic) License: MIT and (GPL+ or Artistic)
URL: https://metacpan.org/release/Net-IP URL: https://metacpan.org/release/Net-IP
Source: https://cpan.metacpan.org/authors/id/M/MA/MANU/Net-IP-%{version}.tar.gz Source: https://cpan.metacpan.org/modules/by-module/Net/Net-IP-%{version}.tar.gz
Patch0: perl-Net-IP-1.25-bz197425.patch Patch0: Net-IP-1.26-rt60439.patch
Patch1: Net-IP-1.26-shellbang.patch
BuildArch: noarch BuildArch: noarch
# Build:
BuildRequires: coreutils
BuildRequires: findutils
BuildRequires: make
BuildRequires: perl-generators BuildRequires: perl-generators
BuildRequires: perl-interpreter
BuildRequires: perl(Config)
BuildRequires: perl(ExtUtils::MakeMaker) BuildRequires: perl(ExtUtils::MakeMaker)
# Run-time: # Run-time:
BuildRequires: perl(Exporter) BuildRequires: perl(Exporter)
BuildRequires: perl(Math::BigInt) BuildRequires: perl(Math::BigInt)
BuildRequires: perl(overload)
BuildRequires: perl(strict)
BuildRequires: perl(vars)
# Script Run-time:
BuildRequires: perl(Getopt::Std)
# Tests: # Tests:
BuildRequires: perl(File::Basename)
BuildRequires: perl(FileHandle)
BuildRequires: perl(lib) BuildRequires: perl(lib)
# Dependencies:
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
# Not yet packaged: IP::Authority # Not yet packaged: IP::Authority
%description %description
This is the Net::IP module for Perl, designed to allow easy This is the Net::IP module, designed to allow easy manipulation of IPv4 and
manipulation of IPv4 and IPv6 addresses. Two applications using the IPv6 addresses.
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 Two applications using the Net::IP module are included: ipcount, an IP address
prefixes contained in a given range; and iptab, which prints out a 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". handy IP "cheat sheet".
%prep %prep
%setup -q -n Net-IP-%{version} %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 %build
perl Makefile.PL INSTALLDIRS=vendor perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags} make %{?_smp_mflags}
%install %install
make pure_install DESTDIR=$RPM_BUILD_ROOT make pure_install DESTDIR=%{buildroot}
find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} ';' find %{buildroot} -type f -name .packlist -delete
chmod -R u+w $RPM_BUILD_ROOT/* %{_fixperms} -c %{buildroot}
%check %check
make test 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 %files
%doc COPYING Changes README %license COPYING
%doc Changes README
# GPL+ or Artistic
%{_bindir}/ipcount %{_bindir}/ipcount
%{_bindir}/iptab %{_bindir}/iptab
# MIT
%{perl_vendorlib}/Net/ %{perl_vendorlib}/Net/
%{_mandir}/man3/Net::IP.3* %{_mandir}/man3/Net::IP.3*
%changelog %changelog
* Fri Aug 23 2019 Paul Howarth <paul@city-fan.org> - 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 <releng@fedoraproject.org> - 1.26-19 * Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.26-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

Loading…
Cancel
Save