2
0
mirror of https://github.com/xcat2/xcat-dep.git synced 2024-11-23 10:01:46 +00:00

Add perl-Net-HTTPS-NB and perl-HTTP-Async into xcat-dep

This commit is contained in:
ertaozh 2016-03-21 04:37:48 -04:00
parent 5daab15e8e
commit c1f02b6695
8 changed files with 2052 additions and 0 deletions

View File

@ -0,0 +1,16 @@
Build Notes
1. To build rpm
1) copy HTTP-Async-0.30.patch and HTTP-Async-0.30.tar.gz into /root/rpmbuild/SOURCES
2) copy perl-HTTP-Async.spec into /root/rpmbuild/SPECS
3) rpmbuild -ba /root/rpmbuild/SPECS/perl-HTTP-Async.spec
4) The rpm package is located at /root/rpmbuild/RPMS/noarch/perl-HTTP-Async-0.30-2.noarch.rpm
2. To build .deb package
1) Install 'alien' on the build machine
2) Create a temparary directory such as /tmp/perl-HTTP-Async, and copy the perl-HTTP-Async-0.30-2.noarch.rpm package into it
3) Use the command "alien -k --scripts -s perl-HTTP-Async-0.30-2.noarch.rpm" to generate debian packaging related files.
It will generate a directory like ./perl-HTTP-Async-0.30
3) cd perl-HTTP-Async-0.30; mv usr/local/share/ usr/; rmdir usr/local/
4) dpkg-buildpackage -uc -us
5) The .deb package perl-http-async_0.30-2_all.deb will be located at /tmp/perl-HTTP-Async

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@ -0,0 +1,143 @@
%define upstream_name HTTP-Async
%define upstream_version 0.30
%{?perl_default_filter}
Name: perl-%{upstream_name}
Version: %{upstream_version}
Release: 2
Summary: Politely process multiple HTTP requests
License: GPL+ or Artistic
Group: Development/Perl
Url: http://search.cpan.org/dist/%{upstream_name}
Source0: http://www.cpan.org/modules/by-module/HTTP/%{upstream_name}-%{upstream_version}.tar.gz
Patch: HTTP-Async-0.30.patch
BuildArch: noarch
%description
Although using the conventional 'LWP::UserAgent' is fast and easy it does
have some drawbacks - the code execution blocks until the request has been
completed and it is only possible to process one request at a time.
'HTTP::Async' attempts to address these limitations.
It gives you a 'Async' object that you can add requests to, and then get
the requests off as they finish. The actual sending and receiving of the
requests is abstracted. As soon as you add a request it is transmitted, if
there are too many requests in progress at the moment they are queued.
There is no concept of starting or stopping - it runs continuously.
Whilst it is waiting to receive data it returns control to the code that
called it meaning that you can carry out processing whilst fetching data
from the network. All without forking or threading - it is actually done
using 'select' lists.
%prep
%setup -q -n %{upstream_name}-%{upstream_version}
%patch -p1
%build
CFLAGS="$RPM_OPT_FLAGS $CFLAGS" %__perl Makefile.PL
make
#%check
#%make test
%install
make PREFIX=%{_prefix} \
DESTDIR=%{buildroot} \
INSTALLDIRS=site \
install
#%make_install
find ${RPM_BUILD_ROOT} -type f -name perllocal.pod -exec rm -f {} ';'
find ${RPM_BUILD_ROOT} -type f -name .packlist -exec rm -f {} ';'
find ${RPM_BUILD_ROOT} \( -path '*/perllocal.pod' -o -path '*/.packlist' -o -path '*.bs' \) -a -prune -o -type f -printf "/%%P\n" > version-filelist
if [ "$(cat version-filelist)X" = "X" ] ; then
echo "ERROR: EMPTY FILE LIST"
exit 1
fi
%files -f version-filelist
%defattr(-,root,root)
%changelog
* Sat Feb 20 2016 umeabot <umeabot> 0.300.0-2.mga6
+ Revision: 971324
- Mageia 6 Mass Rebuild
* Wed Oct 14 2015 sander85 <sander85> 0.300.0-1.mga6
+ Revision: 891385
- update to 0.30
* Thu Jun 25 2015 shlomif <shlomif> 0.290.0-1.mga6
+ Revision: 843206
- update to 0.29
* Sat Oct 18 2014 umeabot <umeabot> 0.260.0-4.mga5
+ Revision: 788383
- Rebuild to potentially add missing dependencies
* Wed Oct 15 2014 umeabot <umeabot> 0.260.0-3.mga5
+ Revision: 742741
- Second Mageia 5 Mass Rebuild
* Tue Sep 16 2014 umeabot <umeabot> 0.260.0-2.mga5
+ Revision: 684992
- Mageia 5 Mass Rebuild
* Sat Jun 07 2014 sander85 <sander85> 0.260.0-1.mga5
+ Revision: 634333
- update to 0.26
* Tue Mar 25 2014 jquelin <jquelin> 0.250.0-1.mga5
+ Revision: 608358
- update to 0.25
* Tue Feb 04 2014 shlomif <shlomif> 0.230.0-1.mga5
+ Revision: 581190
- New version 0.23
* Sat Oct 19 2013 umeabot <umeabot> 0.220.0-2.mga4
+ Revision: 534493
- Mageia 4 Mass Rebuild
* Thu Sep 12 2013 sander85 <sander85> 0.220.0-1.mga4
+ Revision: 478134
- update to 0.22
* Thu Aug 29 2013 sander85 <sander85> 0.210.0-1.mga4
+ Revision: 473095
- update to 0.21
* Sun Jul 21 2013 sander85 <sander85> 0.200.0-1.mga4
+ Revision: 456932
- update to 0.20
* Sun Jun 02 2013 shlomif <shlomif> 0.180.0-1.mga4
+ Revision: 434433
- New version 0.18
* Sun Jan 13 2013 umeabot <umeabot> 0.110.0-2.mga3
+ Revision: 368255
- Mass Rebuild - https://wiki.mageia.org/en/Feature:Mageia3MassRebuild
* Wed Nov 14 2012 jquelin <jquelin> 0.110.0-1.mga3
+ Revision: 317678
- update to 0.11
* Mon Jun 04 2012 kharec <kharec> 0.100.0-1.mga3
+ Revision: 253983
- update to 0.10
* Fri Dec 16 2011 kharec <kharec> 0.90.0-1.mga2
+ Revision: 182446
- imported package perl-HTTP-Async
* Fri Dec 16 2011 cpan2dist 0.09-1mga
- initial mageia release, generated with cpan2dist

View File

@ -0,0 +1,16 @@
Build Notes
1. To build rpm
1) copy Net-HTTPS-NB-0.14.patch and Net-HTTPS-NB-0.14.tar.gz into /root/rpmbuild/SOURCES
2) copy perl-Net-HTTPS-NB.spec into /root/rpmbuild/SPECS
3) rpmbuild -ba /root/rpmbuild/SPECS/perl-Net-HTTPS-NB.spec
4) The rpm package is located at /root/rpmbuild/RPMS/noarch/perl-Net-HTTPS-NB-0.14-2.noarch.rpm
2. To build .deb package
1) Install 'alien' on the build machine
2) Create a temparary directory such as /tmp/perl-Net-HTTPS-NB, and copy the perl-Net-HTTPS-NB-0.14-2.noarch.rpm package into it
3) Use the command "alien -k --scripts -s perl-Net-HTTPS-NB-0.14-2.noarch.rpm" to generate debian packaging related files.
It will generate a directory like ./perl-Net-HTTPS-NB-0.14
3) cd perl-Net-HTTPS-NB-0.14; mv usr/local/share/ usr/; rmdir usr/local/
4) dpkg-buildpackage -uc -us
5) The .deb package perl-net-https-nb_0.14-2_all.deb will be located at /tmp/perl-Net-HTTPS-NB

View File

@ -0,0 +1,197 @@
diff -Nru Net-HTTPS-NB-0.14/examples/google_multi.pl Net-HTTPS-NB-0.14_mod/examples/google_multi.pl
--- Net-HTTPS-NB-0.14/examples/google_multi.pl 2015-10-14 09:05:46.000000000 -0400
+++ Net-HTTPS-NB-0.14_mod/examples/google_multi.pl 1969-12-31 19:00:00.000000000 -0500
@@ -1,112 +0,0 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-use AnyEvent;
-use Errno qw/EWOULDBLOCK EAGAIN/;
-use lib '../lib';
-use Net::HTTPS::NB;
-
-# Get number of the search results for each specified language in parallel via encrypted google
-# Make it easier with AnyEvent
-
-my $loop = AnyEvent->condvar;
-$loop->begin;
-
-for my $q (qw(perl python ruby php lua)) {
- my $sock = Net::HTTPS::NB->new(Host => 'encrypted.google.com', Blocking => 0)
- or next;
-
- $loop->begin();
-
- my $wc; $wc = AnyEvent->io(
- fh => $sock,
- poll => 'w', # first wait until non-blocking socket connection completed
- cb => sub { wait_connection($wc, $loop, $sock, $q) }
- );
-}
-
-$loop->end;
-$loop->recv();
-
-# wait until non-blocking connection completed
-sub wait_connection {
- undef $_[0]; # remove watcher completely
- my ($wc, $loop, $sock, $q) = @_;
-
- if ($sock->connected) { # handshake completed
- print "$q: Connected\n";
- $sock->write_request(GET => "/search?q=$q");
- my $wh; $wh = AnyEvent->io( # now wait headers
- fh => $sock,
- poll => 'r',
- cb => sub { wait_headers($wh, $loop, $sock, $q) }
- );
- }
- elsif($HTTPS_ERROR == HTTPS_WANT_READ) {
- $wc = AnyEvent->io( # handshake need reading
- fh => $sock,
- poll => 'r',
- cb => sub { wait_connection($wc, $loop, $sock, $q) }
- );
- }
- elsif($HTTPS_ERROR == HTTPS_WANT_WRITE) {
- $wc = AnyEvent->io( # handshake need writing
- fh => $sock,
- poll => 'w',
- cb => sub { wait_connection($wc, $loop, $sock, $q) }
- );
- }
- else {
- print "$q: Connection failed - $HTTPS_ERROR\n";
- $loop->end();
- }
-}
-
-# wait for full headers
-sub wait_headers {
- my (undef, $loop, $sock, $q) = @_;
-
- if (my @h = $sock->read_response_headers()) {
- undef $_[0]; # remove headers watcher
-
- print "$q: HTTP code - $h[0]\n";
- my $body = '';
-
- unless (wait_body($_, $loop, $sock, $q, \$body)) {
- my $wb; $wb = AnyEvent->io( # now wait body
- fh => $sock,
- poll => 'r',
- cb => sub { wait_body($wb, $loop, $sock, $q, \$body) }
- );
- }
- }
- # else this sub will invoked again when new data will arrive
-}
-
-# wait for full body
-sub wait_body {
- my (undef, $loop, $sock, $q, $body) = @_;
-
- my ($n, $buf);
- while (1) {
- $n = $sock->read_entity_body($buf, 1024);
- if ($n > 0) {
- substr($$body, length $$body) = $buf; # append body
- }
- elsif ((defined($n) && $n == 0) || (!defined($n) && $! != EWOULDBLOCK && $! != EAGAIN)) {
- # error or eof, but who cares?
- undef $_[0]; # remove body watcher
- my ($result) = $$body =~ /([\d,]+\s+results?)/;
- print "$q: ", $result||'unknown', "\n";
- $loop->end;
- return 1; # body readed
- }
- else {
- # wait more data
- last;
- }
- }
-
- 0; # body still not readed
-}
diff -Nru Net-HTTPS-NB-0.14/Makefile.PL Net-HTTPS-NB-0.14_mod/Makefile.PL
--- Net-HTTPS-NB-0.14/Makefile.PL 2015-10-14 07:11:10.000000000 -0400
+++ Net-HTTPS-NB-0.14_mod/Makefile.PL 2016-03-14 03:09:39.063284216 -0400
@@ -6,7 +6,7 @@
NAME => 'Net::HTTPS::NB',
LICENSE => 'perl',
VERSION_FROM => 'lib/Net/HTTPS/NB.pm', # finds $VERSION
- PREREQ_PM => { Exporter => 0, IO::Socket::SSL => 0.98, Net::HTTP => 0, Net::HTTPS => 0, Test::More => 0.88 },
+ PREREQ_PM => { Exporter => 0, IO::Socket::SSL => 0.98, Net::HTTP => 0, Net::HTTPS => 0 },
META_MERGE => { resources => {repository => 'https://github.com/olegwtf/p5-Net-HTTPS-NB'} },
($] >= 5.005 ? ## Add these new keywords supported since 5.005
(ABSTRACT_FROM => 'lib/Net/HTTPS/NB.pm', # retrieve abstract from module
diff -Nru Net-HTTPS-NB-0.14/META.json Net-HTTPS-NB-0.14_mod/META.json
--- Net-HTTPS-NB-0.14/META.json 2015-10-14 09:13:45.000000000 -0400
+++ Net-HTTPS-NB-0.14_mod/META.json 2016-03-14 03:09:59.463284615 -0400
@@ -36,7 +36,6 @@
"IO::Socket::SSL" : "0.98",
"Net::HTTP" : "0",
"Net::HTTPS" : "0",
- "Test::More" : "0.88"
}
}
},
diff -Nru Net-HTTPS-NB-0.14/META.yml Net-HTTPS-NB-0.14_mod/META.yml
--- Net-HTTPS-NB-0.14/META.yml 2015-10-14 09:13:45.000000000 -0400
+++ Net-HTTPS-NB-0.14_mod/META.yml 2016-03-14 03:10:10.243284924 -0400
@@ -22,7 +22,6 @@
IO::Socket::SSL: '0.98'
Net::HTTP: '0'
Net::HTTPS: '0'
- Test::More: '0.88'
resources:
repository: https://github.com/olegwtf/p5-Net-HTTPS-NB
version: 0.14
diff -Nru Net-HTTPS-NB-0.14/t/Net-HTTPS-NB.t Net-HTTPS-NB-0.14_mod/t/Net-HTTPS-NB.t
--- Net-HTTPS-NB-0.14/t/Net-HTTPS-NB.t 2015-10-14 07:11:10.000000000 -0400
+++ Net-HTTPS-NB-0.14_mod/t/Net-HTTPS-NB.t 1969-12-31 19:00:00.000000000 -0500
@@ -1,43 +0,0 @@
-#!/usr/bin/env perl
-
-use Test::More;
-BEGIN {
- use_ok('Net::HTTPS::NB');
-}
-use strict;
-
-SKIP: {
- skip "I heared fork doesn't work on Windows"
- if $^O =~ /MSWin/i;
-
- my ($host, $port) = make_server();
- my $start = time();
- my $sock = Net::HTTPS::NB->new(Host => $host, PeerPort => $port);
-
- ok(time() - $start >= 3, 'Blocking connect');
- ok(! defined $sock, 'HTTPS init error');
-
- ($host, $port) = make_server();
- $start = time();
- $sock = Net::HTTPS::NB->new(Host => $host, PeerPort => $port, Blocking => 0);
-
- ok(time() - $start < 3, 'Non blocking connect');
- is($sock->connected, 0, 'Invalid socket connection');
- isa_ok($sock, 'Net::HTTPS::NB');
-}
-
-done_testing();
-
-sub make_server {
- my $serv = IO::Socket::INET->new(Listen => 3);
- my $child = fork();
- die 'fork:', $! unless defined $child;
-
- if ($child == 0) {
- sleep 3;
- $serv->accept();
- exit;
- }
-
- return ($serv->sockhost eq "0.0.0.0" ? "127.0.0.1" : $serv->sockhost, $serv->sockport);
-}

Binary file not shown.

View File

@ -0,0 +1,96 @@
%define upstream_name Net-HTTPS-NB
%define upstream_version 0.14
%{?perl_default_filter}
Name: perl-%{upstream_name}
Version: %{upstream_version}
Release: 2
Summary: Non-blocking HTTPS client
License: GPL+ or Artistic
Group: Development/Perl
Url: http://search.cpan.org/dist/%{upstream_name}
Source0: http://www.cpan.org/modules/by-module/Net/%{upstream_name}-%{upstream_version}.tar.gz
Patch: Net-HTTPS-NB-0.14.patch
BuildRequires: perl(Exporter)
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(IO::Socket::SSL) >= 0.980.0
BuildRequires: perl(Net::HTTP)
BuildRequires: perl(Net::HTTPS)
BuildArch: noarch
%description
Same interface as Net::HTTPS but it will never try multiple reads when the
read_response_headers() or read_entity_body() methods are invoked. In
addition allows non-blocking connect.
* If read_response_headers() did not see enough data to complete the
headers an empty list is returned.
* If read_entity_body() did not see new entity data in its read the value
-1 is returned.
%prep
%setup -q -n %{upstream_name}-%{upstream_version}
%patch -p1
%build
%__perl Makefile.PL
make
%install
%make_install
find ${RPM_BUILD_ROOT} -type f -name perllocal.pod -exec rm -f {} ';'
find ${RPM_BUILD_ROOT} -type f -name .packlist -exec rm -f {} ';'
find ${RPM_BUILD_ROOT} \( -path '*/perllocal.pod' -o -path '*/.packlist' -o -path '*.bs' \) -a -prune -o -type f -printf "/%%P\n" > version-filelist
if [ "$(cat version-filelist)X" = "X" ] ; then
echo "ERROR: EMPTY FILE LIST"
exit 1
fi
%files -f version-filelist
%defattr(-,root,root)
%changelog
* Sat Feb 20 2016 umeabot <umeabot> 0.140.0-2.mga6
+ Revision: 971331
- Mageia 6 Mass Rebuild
+ sander85 <sander85>
- update to 0.14
* Wed Oct 14 2015 sander85 <sander85> 0.140.0-1.mga6
+ Revision: 891476
- update to 0.14
* Sun Oct 19 2014 umeabot <umeabot> 0.130.0-5.mga5
+ Revision: 788555
- Rebuild to potentially add missing dependencies
* Wed Oct 15 2014 umeabot <umeabot> 0.130.0-4.mga5
+ Revision: 749262
- Second Mageia 5 Mass Rebuild
* Tue Sep 16 2014 umeabot <umeabot> 0.130.0-3.mga5
+ Revision: 685663
- Mageia 5 Mass Rebuild
* Sat Oct 19 2013 umeabot <umeabot> 0.130.0-2.mga4
+ Revision: 527941
- Mageia 4 Mass Rebuild
* Fri Jun 14 2013 kharec <kharec> 0.130.0-1.mga4
+ Revision: 442978
- update to 0.13
* Fri Feb 22 2013 kharec <kharec> 0.120.0-1.mga3
+ Revision: 399852
- imported package perl-Net-HTTPS-NB
* Fri Feb 22 2013 cpan2dist 0.12-1mga
- initial mageia release, generated with cpan2dist