commit
a58e9a95c0
79
0001-fix-perl-shbang.patch
Normal file
79
0001-fix-perl-shbang.patch
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
From c4954baea55f227e28a2228a1b4425a7973b0d8d Mon Sep 17 00:00:00 2001
|
||||||
|
From: bzg1107 <preloyalwhite@163.com>
|
||||||
|
Date: Sat, 22 Jan 2022 19:33:24 +0800
|
||||||
|
Subject: [PATCH] fix perl shbang
|
||||||
|
|
||||||
|
---
|
||||||
|
IP.pm | 16 +++++++++++-----
|
||||||
|
ipcount | 2 +-
|
||||||
|
iptab | 2 +-
|
||||||
|
3 files changed, 13 insertions(+), 7 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/IP.pm b/IP.pm
|
||||||
|
index 0ff27ff..c6425e0 100644
|
||||||
|
--- a/IP.pm
|
||||||
|
+++ b/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/ipcount b/ipcount
|
||||||
|
index 5e98596..0871ca7 100755
|
||||||
|
--- a/ipcount
|
||||||
|
+++ b/ipcount
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!perl -w
|
||||||
|
+#!/usr/bin/perl -w
|
||||||
|
|
||||||
|
# Copyright (c) 2000 RIPE NCC
|
||||||
|
#
|
||||||
|
diff --git a/iptab b/iptab
|
||||||
|
index 2c05789..6a7e4ae 100755
|
||||||
|
--- a/iptab
|
||||||
|
+++ b/iptab
|
||||||
|
@@ -1,4 +1,4 @@
|
||||||
|
-#!perl
|
||||||
|
+#!/usr/bin/perl
|
||||||
|
|
||||||
|
use Net::IP;
|
||||||
|
use strict;
|
||||||
|
--
|
||||||
|
2.30.0
|
||||||
|
|
||||||
BIN
Net-IP-1.26.tar.gz
Normal file
BIN
Net-IP-1.26.tar.gz
Normal file
Binary file not shown.
50
perl-Net-IP.spec
Normal file
50
perl-Net-IP.spec
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
Name: perl-Net-IP
|
||||||
|
Version: 1.26
|
||||||
|
Release: 1
|
||||||
|
Summary: Perl module for manipulation of IPv4 and IPv6 addresses
|
||||||
|
License: MIT and GPL+
|
||||||
|
URL: https://metacpan.org/release/Net-IP
|
||||||
|
Source: https://cpan.metacpan.org/modules/by-module/Net/Net-IP-%{version}.tar.gz
|
||||||
|
Patch0: 0001-fix-perl-shbang.patch
|
||||||
|
BuildArch: noarch
|
||||||
|
BuildRequires: coreutils findutils make perl-generators perl-interpreter perl(Config) perl(ExtUtils::MakeMaker)
|
||||||
|
BuildRequires: perl(Math::BigInt) perl(overload) perl(strict) perl(vars) perl(Getopt::Std) perl(File::Basename)
|
||||||
|
BuildRequires: perl(Exporter) perl(FileHandle) perl(lib)
|
||||||
|
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
|
||||||
|
|
||||||
|
%description
|
||||||
|
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
|
||||||
|
%autosetup -p1 -n Net-IP-%{version}
|
||||||
|
|
||||||
|
%build
|
||||||
|
perl Makefile.PL INSTALLDIRS=vendor
|
||||||
|
make %{?_smp_mflags}
|
||||||
|
|
||||||
|
%install
|
||||||
|
make pure_install DESTDIR=%{buildroot}
|
||||||
|
find %{buildroot} -type f -name .packlist -delete
|
||||||
|
%{_fixperms} -c %{buildroot}
|
||||||
|
|
||||||
|
%check
|
||||||
|
make test
|
||||||
|
PERL5LIB=%{buildroot}%{perl_vendorlib} ./iptab
|
||||||
|
|
||||||
|
%files
|
||||||
|
%license COPYING
|
||||||
|
%doc Changes README
|
||||||
|
%{_bindir}/ipcount
|
||||||
|
%{_bindir}/iptab
|
||||||
|
%{perl_vendorlib}/Net/
|
||||||
|
%{_mandir}/man3/Net::IP.3*
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Jan 24 2022 baizhonggui <baizhonggui@huawei.com> - 1.26-1
|
||||||
|
- Package init
|
||||||
Loading…
x
Reference in New Issue
Block a user