Hi,

attached is a patch that updates devel/p5-File-ChangeNotify from version
0.13 to 0.19. The updated version works with OpenBSD's Moose 1.08 but
also with more recent Moose versions.

The patch also fixes a small bug in KQueue.pm, that I reported to upstream.

It seems that the port so far didn't take into account that the
p5-IO-KQueue package could be installed on the system. Since the
KQueue-based file watcher quickly exceeds the maximum number of open
files in a default OpenBSD installation, I changed ChangeNotify.pm to
prefer the Default watcher even if IO::KQueue is available. I think this
is more reasonable than to ask the users to raise their openfiles and
maxfiles limits from 128 and 7030 to much higher values.

Tested on i386.

The following ports depend on p5-File-ChangeNotify:

- audio/squeezecenter
- sysutils/p5-Filesys-Notify-Simple
- www/p5-Catalyst-Devel

Upstream's change log:

0.19   2010-10-17
- The all.t test didn't run any tests at all if neither the Inotify nor
  KQueue watchers could be loaded. This was treated as a failure by test
  harnesses. Now we always test the Default class.

0.18   2010-10-15
- Always make a Default watcher object if we cannot load an OS-specific
  class.
- Add Test::Exception as a test prereq.

0.17   2010-10-04
- Loading File::ChangeNotify always loads the Default watcher class.
  This will give a useful error message if this module's prereqs are
  not loaded.

0.16   2010-07-12
- Changes to avoid a warning about a useless coercion from future
  versions of Moose.

0.15   2010-07-09
- Add a missing prereq, namespace::autoclean.

0.14   2010-07-08
- Running the tests left behind a lot of temp directories that should
  have been cleaned up, but weren't. Reported by Peter Edwards. RT
  #59125.
- License is now Artistic 2.0
Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/p5-File-ChangeNotify/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- Makefile    3 Dec 2010 11:44:31 -0000       1.5
+++ Makefile    1 Jan 2011 12:18:29 -0000
@@ -3,23 +3,24 @@
 COMMENT=       watch for changes to files, cross-platform style
 
 MODULES=       cpan
-DISTNAME=      File-ChangeNotify-0.13
-REVISION=      0
+DISTNAME=      File-ChangeNotify-0.19
 CATEGORIES=    devel
 
-# Perl
+# Artistic 2.0
 PERMIT_PACKAGE_CDROM =         Yes
 PERMIT_PACKAGE_FTP =           Yes
 PERMIT_DISTFILES_CDROM =       Yes
 PERMIT_DISTFILES_FTP =         Yes
 
 CONFIGURE_STYLE =      modbuild
-USE_GROFF =    Yes
 
+BUILD_DEPENDS = ${RUN_DEPENDS}
 RUN_DEPENDS =  devel/p5-Class-MOP \
                devel/p5-Moose \
                devel/p5-MooseX-Params-Validate \
-               devel/p5-MooseX-SemiAffordanceAccessor
+               devel/p5-MooseX-SemiAffordanceAccessor \
+               devel/p5-namespace-autoclean
+REGRESS_DEPENDS =      devel/p5-Test-Exception
 
 MAKE_ENV +=    TEST_POD=1 IS_MAINTAINER=1
 
Index: distinfo
===================================================================
RCS file: /cvs/ports/devel/p5-File-ChangeNotify/distinfo,v
retrieving revision 1.2
diff -u -r1.2 distinfo
--- distinfo    3 Jul 2010 03:41:42 -0000       1.2
+++ distinfo    1 Jan 2011 12:18:29 -0000
@@ -1,5 +1,5 @@
-MD5 (File-ChangeNotify-0.13.tar.gz) = eR70uZegW1BwTiwo+Ph4oA==
-RMD160 (File-ChangeNotify-0.13.tar.gz) = Jltiid+UQa63uHcm5mBS2KnQ69s=
-SHA1 (File-ChangeNotify-0.13.tar.gz) = WcEiFJwmsqrqCjYp2xNnbAlSbqM=
-SHA256 (File-ChangeNotify-0.13.tar.gz) = 
yHAoVdthRnb9v2P9raOA6tj2FAE11Y1TkUQuDYmpaig=
-SIZE (File-ChangeNotify-0.13.tar.gz) = 18155
+MD5 (File-ChangeNotify-0.19.tar.gz) = VQwjU6nvRVIDu8AC7DGr+A==
+RMD160 (File-ChangeNotify-0.19.tar.gz) = AR00UgFZUSdOzuYz8k9v6hycoho=
+SHA1 (File-ChangeNotify-0.19.tar.gz) = kHUhoX7Qh7eHUQZHMhP2WNo+WaE=
+SHA256 (File-ChangeNotify-0.19.tar.gz) = 
8UfmQPMm0uG3XrKZ+1LXcDXbEE+evsc71IuEhBOXAdA=
+SIZE (File-ChangeNotify-0.19.tar.gz) = 19908
Index: patches/patch-lib_File_ChangeNotify_Watcher_KQueue_pm
===================================================================
RCS file: patches/patch-lib_File_ChangeNotify_Watcher_KQueue_pm
diff -N patches/patch-lib_File_ChangeNotify_Watcher_KQueue_pm
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_File_ChangeNotify_Watcher_KQueue_pm       1 Jan 2011 
12:18:29 -0000
@@ -0,0 +1,23 @@
+$OpenBSD$
+--- lib/File/ChangeNotify/Watcher/KQueue.pm.orig       Sun Oct 17 22:00:14 2010
++++ lib/File/ChangeNotify/Watcher/KQueue.pm    Sat Jan  1 10:21:31 2011
+@@ -184,7 +184,7 @@ sub _watch_file {
+ 
+     # Don't panic if we can't open a file
+     open my $fh, '<', $file or warn "Can't open '$file': $!";
+-    return unless $fh;
++    return unless $fh && defined fileno($fh);
+ 
+     # Store this filehandle (this will automatically nuke any existing events
+     # assigned to the file)
+@@ -229,6 +229,10 @@ On FreeBSD, you can check (and alter) your system's se
+ necessary. The important keys are: C<kern.maxfiles> and
+ C<kern.maxfilesperproc>.  You can see how many files your system current has
+ open with C<kern.openfiles>.
++
++On OpenBSD, the C<sysctl> keys are C<kern.maxfiles> and C<kern.nfiles>.
++Per-process limits are set in F</etc/login.conf>. See L<login.conf(5)> and
++L<BSD::Resource> for details.
+ 
+ =head1 SUPPORT
+ 
Index: patches/patch-lib_File_ChangeNotify_pm
===================================================================
RCS file: patches/patch-lib_File_ChangeNotify_pm
diff -N patches/patch-lib_File_ChangeNotify_pm
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_File_ChangeNotify_pm      1 Jan 2011 12:18:29 -0000
@@ -0,0 +1,44 @@
+$OpenBSD$
+--- lib/File/ChangeNotify.pm.orig      Sun Oct 17 22:00:14 2010
++++ lib/File/ChangeNotify.pm   Sat Jan  1 11:14:59 2011
+@@ -15,11 +15,13 @@ use Module::Pluggable::Object;
+ sub instantiate_watcher {
+     my $class = shift;
+ 
+-    for my $class ( $class->usable_classes() ) {
+-        if ( _try_load($class) ) {
+-            return $class->new(@_);
+-        }
+-    }
++# On OpenBSD, always instantiate the Default watcher as the KQueue watcher
++# quickly exceeds the maximum number of open files.
++#    for my $class ( $class->usable_classes() ) {
++#        if ( _try_load($class) ) {
++#            return $class->new(@_);
++#        }
++#    }
+ 
+     return File::ChangeNotify::Watcher::Default->new(@_);
+ }
+@@ -109,13 +111,20 @@ This class provides the following methods:
+ 
+ =head2 File::ChangeNotify->instantiate_watcher(...)
+ 
+-This method looks at each available subclass of
++Normally, this method looks at each available subclass of
+ L<File::ChangeNotify::Watcher> and instantiates the first one it can
+ load, using the arguments you provided.
+ 
+ It always tries to use the L<File::ChangeNotify::Watcher::Default>
+ class last, on the assumption that any other class that is available
+ is a better option.
++
++On OpenBSD, this method always instantiates the default class as the
++L<File::ChangeNotify::Watcher::KQueue> class quickly runs out of file
++descriptors in a default system installation. Install L<IO::KQueue>,
++raise your resource limits and instantiate the
++L<File::ChangeNotify::Watcher::KQueue> class explicitly, if you prefer
++to use a KQueue-based watcher.
+ 
+ =head2 File::ChangeNotify->usable_classes()
+ 

Reply via email to