rpms/perl-Net-Daemon/F-9 Net-Daemon-only-ithreads.patch, NONE, 1.1 import.log, NONE, 1.1 perl-Net-Daemon.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Petr Lautrbach plautrba at fedoraproject.org
Thu Oct 16 07:20:08 UTC 2008


Author: plautrba

Update of /cvs/pkgs/rpms/perl-Net-Daemon/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv20202/F-9

Modified Files:
	.cvsignore sources 
Added Files:
	Net-Daemon-only-ithreads.patch import.log perl-Net-Daemon.spec 
Log Message:
cvs-import.sh perl-Net-Daemon-0.44-5.fc9.src.rpm on branch F-9


Net-Daemon-only-ithreads.patch:

--- NEW FILE Net-Daemon-only-ithreads.patch ---
diff --git a/README b/README
index be4444e..c4b53a5 100644
--- a/README
+++ b/README
@@ -14,8 +14,8 @@ SYNOPSIS
 
 DESCRIPTION
     Net::Daemon is an abstract base class for implementing portable server
-    applications in a very simple way. The module is designed for Perl 5.005
-    and threads, but can work with fork() and Perl 5.004.
+    applications in a very simple way. The module is designed for Perl 5.006
+    and ithreads, but can work with fork() and Perl 5.004.
 
     The Net::Daemon class offers methods for the most common tasks a daemon
     needs: Starting up, logging, accepting clients, authorization,
@@ -142,11 +142,10 @@ DESCRIPTION
         The Net::Daemon server can run in three different modes, depending
         on the environment.
 
-        If you are running Perl 5.005 and did compile it for threads, then
+        If you are running Perl 5.006 and did compile it for ithreads, then
         the server will create a new thread for each connection. The thread
         will execute the server's Run() method and then terminate. This mode
-        is the default, you can force it with "--mode=ithreads" or
-        "--mode=threads".
+        is the default, you can force it with "--mode=ithreads".
 
         If threads are not available, but you have a working fork(), then
         the server will behave similar by creating a new process for each
@@ -156,7 +155,7 @@ DESCRIPTION
         Finally there's a single-connection mode: If the server has accepted
         a connection, he will enter the Run() method. No other connections
         are accepted until the Run() method returns. This operation mode is
-        useful if you have neither threads nor fork(), for example on the
+        useful if you have neither ithreads nor fork(), for example on the
         Macintosh. For debugging purposes you can force this mode with
         "--mode=single".
 
@@ -368,6 +367,7 @@ EXAMPLE
 
       require Net::Daemon;
 
+
       package Calculator;
 
       use vars qw($VERSION @ISA);
diff --git a/lib/Net/Daemon.pm b/lib/Net/Daemon.pm
index 4ebe5c7..9d97d4a 100644
--- a/lib/Net/Daemon.pm
+++ b/lib/Net/Daemon.pm
@@ -33,15 +33,9 @@ use POSIX ();
 
 package Net::Daemon;
 
-$Net::Daemon::VERSION = '0.43';
+$Net::Daemon::VERSION = '0.44';
 @Net::Daemon::ISA = qw(Net::Daemon::Log);
 
-#
-#   Regexps aren't thread safe, as of 5.00502 :-( (See the test script
-#   regexp-threads.)
-#
-$Net::Daemon::RegExpLock = 1;
-
 use vars qw($exit);
 
 ############################################################################
@@ -107,7 +101,7 @@ sub Options ($) {
 			      . 'Looping mode, <secs> seconds per loop' },
       'mode' => { 'template' => 'mode=s',
 		  'description' => '--mode <mode>           '
-		      . 'Operation mode (threads, fork or single)' },
+		      . 'Operation mode (ithreads, threads (same as ithreads), fork or single)' },
       'pidfile' => { 'template' => 'pidfile=s',
 		     'description' => '--pidfile <file>        '
 			 . 'Use <file> as PID file' },
@@ -256,8 +250,6 @@ sub new ($$;$) {
     } elsif (!defined($self->{'mode'})) {
 	if (eval { require thread }) {
 	    $self->{'mode'} = 'ithreads';
-	} elsif (eval { require Thread }) {
-	    $self->{'mode'} = 'threads';
 	} else {
 	    my $fork = 0;
 	    if ($^O ne "MSWin32") {
@@ -276,10 +268,9 @@ sub new ($$;$) {
 	}
     }
 
+    $self->{'mode'} = 'ithreads' if ($self->{'mode'} eq 'threads');
     if ($self->{'mode'} eq 'ithreads') {
 	require threads;
-    } elsif ($self->{'mode'} eq 'threads') {
-	require Thread;
     } elsif ($self->{'mode'} eq 'fork') {
 	# Initialize forking mode ...
     } elsif ($self->{'mode'} eq 'single') {
@@ -354,13 +345,6 @@ sub Accept ($) {
 	    my $masks = ref($client->{'mask'}) ?
 		$client->{'mask'} : [ $client->{'mask'} ];
 
-	    #
-	    # Regular expressions aren't thread safe, as of
-	    # 5.00502 :-(
-	    #
-	    my $lock;
-	    $lock = lock($Net::Daemon::RegExpLock)
-		if ($self->{'mode'} eq 'threads');
 	    foreach my $mask (@$masks) {
 		foreach my $alias (@patterns) {
 		    if ($alias =~ /$mask/) {
@@ -459,14 +443,6 @@ sub ChildFunc {
     my($self, $method, @args) = @_;
     if ($self->{'mode'} eq 'single') {
 	$self->$method(@args);
-    } elsif ($self->{'mode'} eq 'threads') {
-	my $startfunc = sub {
-	    my $self = shift;
-	    my $method = shift;
-	    $self->$method(@_)
-	};
-	Thread->new($startfunc, $self, $method, @args)
-	    or die "Failed to create a new thread: $!";
     } elsif ($self->{'mode'} eq 'ithreads') {
 	my $startfunc = sub {
 	    my $self = shift;
@@ -730,8 +706,8 @@ Net::Daemon - Perl extension for portable daemons
 =head1 DESCRIPTION
 
 Net::Daemon is an abstract base class for implementing portable server
-applications in a very simple way. The module is designed for Perl 5.005
-and threads, but can work with fork() and Perl 5.004.
+applications in a very simple way. The module is designed for Perl 5.006
+and ithreads, but can work with fork() and Perl 5.004.
 
 The Net::Daemon class offers methods for the most common tasks a daemon
 needs: Starting up, logging, accepting clients, authorization, restricting
@@ -875,11 +851,10 @@ I<loop-timeout>.
 The Net::Daemon server can run in three different modes, depending on
 the environment.
 
-If you are running Perl 5.005 and did compile it for threads, then
+If you are running Perl 5.006 and did compile it for ithreads, then
 the server will create a new thread for each connection. The thread
 will execute the server's Run() method and then terminate. This mode
-is the default, you can force it with "--mode=ithreads" or
-"--mode=threads".
+is the default, you can force it with "--mode=ithreads".
 
 If threads are not available, but you have a working fork(), then the
 server will behave similar by creating a new process for each connection.
@@ -889,7 +864,7 @@ you use the "--mode=fork" option.
 Finally there's a single-connection mode: If the server has accepted a
 connection, he will enter the Run() method. No other connections are
 accepted until the Run() method returns. This operation mode is useful
-if you have neither threads nor fork(), for example on the Macintosh.
+if you have neither ithreads nor fork(), for example on the Macintosh.
 For debugging purposes you can force this mode with "--mode=single".
 
 When running in mode single, you can still handle multiple clients at
diff --git a/t/server b/t/server
index 0bb2a23..3537495 100644
--- a/t/server
+++ b/t/server
@@ -70,8 +70,6 @@ sub Run ($) {
 	    }
 	    my $num;
 	    {
-		my $lock = lock($Net::Daemon::RegExpLock)
-		    if ($self->{'mode'} eq 'threads');
 		if ($line =~ /(\d+)/) {
 		    $num = $1;
 		}
diff --git a/t/thread.t b/t/thread.t
deleted file mode 100644
index 5567503..0000000
--- a/t/thread.t
+++ /dev/null
@@ -1,59 +0,0 @@
-# -*- perl -*-
-#
-#   $Id: thread.t,v 1.2 1999/08/12 14:28:59 joe Exp $
-#
-
-require 5.004;
-use strict;
-
-use IO::Socket ();
-use Config ();
-use Net::Daemon::Test ();
-
-my $numTests = 5;
-
-
-# Check whether threads are available, otherwise skip this test.
-
-if (!eval { require Thread; my $t = Thread->new(sub { }) }) {
-    print "1..0\n";
-    exit 0;
-}
-
-my($handle, $port) = Net::Daemon::Test->Child
-    ($numTests, $^X, 't/server', '--timeout', 20, '--mode=threads');
-
-
-print "Making first connection to port $port...\n";
-my $fh = IO::Socket::INET->new('PeerAddr' => '127.0.0.1',
-			       'PeerPort' => $port);
-printf("%s 1\n", $fh ? "ok" : "not ok");
-printf("%s 2\n", $fh->close() ? "ok" : "not ok");
-print "Making second connection to port $port...\n";
-$fh = IO::Socket::INET->new('PeerAddr' => '127.0.0.1',
-			    'PeerPort' => $port);
-printf("%s 3\n", $fh ? "ok" : "not ok");
-eval {
-    for (my $i = 0;  $i < 20;  $i++) {
-	if (!$fh->print("$i\n")  ||  !$fh->flush()) {
-	    die "Error while writing $i: " . $fh->error() . " ($!)";
-	}
-	my $line = $fh->getline();
-	die "Error while reading $i: " . $fh->error() . " ($!)"
-	    unless defined($line);
-	die "Result error: Expected " . ($i*2) . ", got $line"
-	    unless ($line =~ /(\d+)/  &&  $1 == $i*2);
-    }
-};
-if ($@) {
-    print STDERR "$@\n";
-    print "not ok 4\n";
-} else {
-    print "ok 4\n";
-}
-printf("%s 5\n", $fh->close() ? "ok" : "not ok");
-
-END {
-    if ($handle) { $handle->Terminate() }
-    if (-f "ndtest.prt") { unlink "ndtest.prt" }
-}
diff --git a/t/threadm.t b/t/threadm.t
deleted file mode 100644
index 518ccf6..0000000
--- a/t/threadm.t
+++ /dev/null
@@ -1,121 +0,0 @@
-# -*- perl -*-
-#
-#   $Id: threadm.t,v 1.3 2007/05/16 13:58 mhn $
-#
-
-require 5.004;
-use strict;
-
-use IO::Socket ();
-use Config ();
-use Net::Daemon::Test ();
-use Fcntl ();
-use Config ();
-
-
-$| = 1;
-$^W = 1;
-
-
-if (!$Config::Config{'usethreads'}  ||
-    $Config::Config{'usethreads'} ne 'define'  ||
-    !eval { require Thread }) {
-    print "1..0\n";
-    exit 0;
-}
-
-
-my($handle, $port);
-if (@ARGV) {
-    $port = shift @ARGV;
-} else {
-    ($handle, $port) = Net::Daemon::Test->Child
-	(10, $^X, '-Iblib/lib', '-Iblib/arch', 't/server',
-	 '--mode=threads', 'logfile=stderr', 'debug');
-}
-
-
-my $regexpLock = 1;
-sub IsNum {
-    #
-    # Regular expressions aren't thread safe, as of 5.00502 :-(
-    #
-    my $lock = lock($regexpLock);
-    my $str = shift;
-    (defined($str)  &&  $str =~ /(\d+)/) ? $1 : undef;
-}
-
-
-sub ReadWrite {
-    my $fh = shift; my $i = shift; my $j = shift;
-    die "Child $i: Error while writing $j: $!"
-	unless $fh->print("$j\n") and $fh->flush();
-    my $line = $fh->getline();
-    die "Child $i: Error while reading: " . $fh->error() . " ($!)"
-	unless defined($line);
-    my $num = IsNum($line);
-    die "Child $i: Cannot parse result: $line"
-	unless defined($num);
-    die "Child $i: Expected " . ($j*2) . ", got $num"
-	unless ($num == $j*2);
-}
-
-
-sub MyChild {
-    my $i = shift;
-
-    eval {
-	my $fh = IO::Socket::INET->new('PeerAddr' => '127.0.0.1',
-				       'PeerPort' => $port);
-	die "Cannot connect: $!" unless defined($fh);
-	for (my $j = 0;  $j < 1000;  $j++) {
-	    ReadWrite($fh, $i, $j);
-	}
-    };
-    if ($@) {
-	print STDERR $@;
-	return 0;
-    }
-    return 1;
-}
-
-my @threads = ();
-
-if (!$Config::Config{'usethreads'}  ||
-    $Config::Config{'usethreads'} ne 'define') {
-
-    for (my $i = 0;  $i < 10;  $i++) {
-        #print "Spawning child $i.\n";
-        my $tid = Thread->new(\&MyChild, $i);
-        if (!$tid) {
-            print STDERR "Failed to create new thread: $!\n";
-            exit 1;
-        }
-        push(@threads, $tid);
-    }
-
-}
-eval { alarm 1; alarm 0 };
-alarm 120 unless $@;
-for (my $i = 1;  $i <= 10;  $i++) {
-    if (@threads) {
-        my $tid = shift @threads;
-        if ($tid->join()) {
-            print "ok $i\n";
-        } else {
-            print "not ok $i\n";
-        }
-    } else {
-        print "ok $i\n"; # Fake output for Windows when
-                         # Perl -V reveals usethreads
-    }
-}
-
-END {
-    if ($handle) {
-	print "Terminating server.\n";
-	$handle->Terminate();
-	undef $handle;
-    }
-    unlink "ndtest.prt";
-}
diff --git a/MANIFEST b/MANIFEST
index e306721..442e86b 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -17,7 +17,5 @@ t/loop.t		Test the loop-timeout option
 t/loop-child.t		Same with loop-child set
 t/server		Script used by the server tests
 t/single.t		Test of a single-mode server
-t/thread.t		Test of a multithreaded server
-t/threadm.t		Test of a multithreaded server with multiple clients
 t/unix.t		Test for Unix sockets
 META.yml                                 Module meta-data (added by MakeMaker)



--- NEW FILE import.log ---
perl-Net-Daemon-0_44-5_fc9:F-9:perl-Net-Daemon-0.44-5.fc9.src.rpm:1224141521


--- NEW FILE perl-Net-Daemon.spec ---
Name:           perl-Net-Daemon
Version:        0.44
Release:        5%{?dist}
Summary:        Perl extension for portable daemons

Group:          Development/Libraries
License:        GPL+ or Artistic
URL:            http://search.cpan.org/dist/Net-Daemon/
Source0:        http://search.cpan.org/CPAN/authors/id/M/MN/MNOONING/Net-Daemon/Net-Daemon-0.43.tar.gz
#upstream report http://rt.cpan.org/Ticket/Display.html?id=39759
Patch0:         Net-Daemon-only-ithreads.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:      noarch
# Correct for lots of packages, other common choices include eg. Module::Build
BuildRequires:  perl(ExtUtils::MakeMaker)
Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

%description
Net::Daemon is an abstract base class for implementing portable server 
applications in a very simple way. The module is designed for Perl 5.006 and 
ithreads (and higher), but can work with fork() and Perl 5.004.

The Net::Daemon class offers methods for the most common tasks a daemon 
needs: Starting up, logging, accepting clients, authorization, restricting 
its own environment for security and doing the true work. You only have to 
override those methods that aren't appropriate for you, but typically 
inheriting will safe you a lot of work anyways.


%prep
%setup -q -n Net-Daemon
%patch0 -p1 

# generate our other two licenses...
perldoc perlgpl > LICENSE.GPL
perldoc perlartistic > LICENSE.Artistic


%build
%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS"
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} ';'
# Remove the next line from noarch packages (unneeded)
find $RPM_BUILD_ROOT -type f -name '*.bs' -a -size 0 -exec rm -f {} ';'
find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null ';'
chmod -R u+w $RPM_BUILD_ROOT/*


%check
%{?!_with_network_tests:
# Disable tests which will fail under mock
  rm t/config*
  rm t/fork*
  rm t/ithread*
  rm t/loop*
  rm t/single.t
  rm t/unix.t
}

make test


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc ChangeLog README LICENSE.*
%{perl_vendorlib}/*
%{_mandir}/man3/*.3*


%changelog
* Mon Oct 13 2008 Petr Lautrbach <plautrba at redhat.com> 0.44-5
- "--with network_tests" - don't remove network tests 
* Mon Oct  6 2008 Petr Lautrbach <plautrba at redhat.com> 0.44-4
- Description and License fixed
- Patch without backup 
* Mon Oct  6 2008 Petr Lautrbach <lautrba at redhat.com> 0.44-3
- Requires: fixed 
* Fri Oct  3 2008 Petr Lautrbach <lautrba at redhat.com> 0.44-2
- only-ithreads patch added
- disabled tests which fail under mock
* Fri Sep 26 2008 Petr Lautrbach <lautrba at redhat.com>
- initial rpm release


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/perl-Net-Daemon/F-9/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	15 Oct 2008 17:03:24 -0000	1.1
+++ .cvsignore	16 Oct 2008 07:19:38 -0000	1.2
@@ -0,0 +1 @@
+Net-Daemon-0.43.tar.gz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/perl-Net-Daemon/F-9/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	15 Oct 2008 17:03:24 -0000	1.1
+++ sources	16 Oct 2008 07:19:38 -0000	1.2
@@ -0,0 +1 @@
+a173a8407fb7b049aa465598eca6dfd7  Net-Daemon-0.43.tar.gz




More information about the fedora-extras-commits mailing list