[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

freeze exception for libnagios-object-perl



I would like you guys to consider a freeze exception for an RC bug fix
in libnagios-object-perl. The patch adds support for Nagios 3, the
version in Lenny. I'd also like to include a few documentation/minor
changes with it.

My sponser told me to ask before he uploaded it, so I have attached an
interdiff with the patches taken out, and attached them separately
(for readability).

Here's the changelog:
 libnagios-object-perl (0.14-2) UNRELEASED; urgency=low
 .
   [ Ryan Niebur ]
   * New maintainer (Closes: #501941)
   * bump standards version to 3.8.0
     - added a README.source
     - use the Homepage field
   * nothing is compiled. no need for CFLAGS.
   * Build distclean
     - no need to run make clean, there is no makefile.
   * use quilt
   * don't install the scripts and their documentation. It seems that
     the old package didn't have the scripts even though if I build it
     from source it does. so, for now, just don't include it.
   * Work with Nagios 3, the version in Debian Lenny. Patch from
     http://rt.cpan.org/Public/Bug/Display.html?id=33125, thanks
     TOMDAAE. (Closes: #503900)
   * Added patch to use correct path to status.dat in man pages
   * fix short description
   * add whatis descriptions to man pages
   * add Vcs-{Browser,Svn} fields
   * Removed accidental inclusion of work in progress code in the man
     page
 .
   [ Damyan Ivanov ]
   * debian/watch: use dist-based URL.
   * debian/control: use dist-based Homepage

Thanks!
Ryan

-- 
_________________________
Ryan Niebur
ryanryan52@gmail.com
diff -u libnagios-object-perl-0.14/debian/watch libnagios-object-perl-0.14/debian/watch
--- libnagios-object-perl-0.14/debian/watch
+++ libnagios-object-perl-0.14/debian/watch
@@ -3 +3 @@
-http://search.cpan.org/CPAN/authors/id/T/TO/TOBEYA/Nagios-Object-(.*).tar.gz
+http://search.cpan.org/dist/Nagios-Object/   .*/Nagios-Object-v?(\d[\d_.]+)\.(?:tar(?:\.gz|\.bz2)?|tgz|zip)
diff -u libnagios-object-perl-0.14/debian/control libnagios-object-perl-0.14/debian/control
--- libnagios-object-perl-0.14/debian/control
+++ libnagios-object-perl-0.14/debian/control
@@ -1,15 +1,19 @@
 Source: libnagios-object-perl
 Section: perl
 Priority: optional
-Maintainer: Thierry Randrianiriana <randrianiriana@gmail.com>
-Build-Depends: debhelper (>= 5)
+Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
+Uploaders: Ryan Niebur <ryanryan52@gmail.com>
+Build-Depends: debhelper (>= 5), quilt
 Build-Depends-Indep: perl (>= 5.8.0-7), libmodule-build-perl, libtest-exception-perl
-Standards-Version: 3.7.2
+Standards-Version: 3.8.0
+Vcs-Svn: svn://svn.debian.org/pkg-perl/trunk/libnagios-object-perl/
+Vcs-Browser: http://svn.debian.org/viewsvn/pkg-perl/trunk/libnagios-object-perl/
+Homepage: http://search.cpan.org/dist/Nagios-Object/
 
 Package: libnagios-object-perl
 Architecture: all
 Depends: ${perl:Depends}, ${misc:Depends}
-Description: Parse and represent Nagios configuration as objects in Perl
+Description: Perl module to parse and represent Nagios configuration as objects
  Nagios::Object is a group of modules for parsing a Nagios configuration and
  representing it as objects in perl. Inheriting from templates is supported,
  encoraged, and kept intact within the perl representation(s).
@@ -23,2 +26,0 @@
- .
-  Homepage: http://search.cpan.org/~tobeya/Nagios-Object/
diff -u libnagios-object-perl-0.14/debian/rules libnagios-object-perl-0.14/debian/rules
--- libnagios-object-perl-0.14/debian/rules
+++ libnagios-object-perl-0.14/debian/rules
@@ -4,6 +4,8 @@
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+include /usr/share/quilt/quilt.make
+
 PACKAGE=$(shell dh_listpackages)
 
 ifndef PERL
@@ -15,19 +17,11 @@
 endif
 TMP     =`pwd`/debian/$(PACKAGE)
 
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
-	CFLAGS += -O0
-else
-	CFLAGS += -O2
-endif
-
 configure: configure-stamp
 
-configure-stamp:
+configure-stamp: $(QUILT_STAMPFN)
 	dh_testdir
-	$(PERL) Build.PL --installdirs vendor destdir=$(TMP)
+	$(PERL) Build.PL --installdirs vendor destdir=$(TMP) --install_path script=temp --install_path bin=temp --install_path bindoc=temp
 	touch configure-stamp
 
 build: build-stamp
@@ -39,12 +33,11 @@
 
 	touch $@
 
-clean:
+clean: unpatch
 	dh_testdir
 	dh_testroot
+	[ ! -f Build ] || ./Build distclean
 	rm -rf build-stamp Build _build blib
-
-	-$(MAKE) clean
 	dh_clean configure-stamp build-stamp
 
 install: build
@@ -54,6 +47,7 @@
 	dh_installdirs
 
 	./Build install PREFIX=$(TMP)/usr
+	rm -fr $(TMP)/temp
 
 # Build architecture-dependent files here.
 binary-arch:;
diff -u libnagios-object-perl-0.14/debian/changelog libnagios-object-perl-0.14/debian/changelog
--- libnagios-object-perl-0.14/debian/changelog
+++ libnagios-object-perl-0.14/debian/changelog
@@ -1,3 +1,33 @@
+libnagios-object-perl (0.14-2) UNRELEASED; urgency=low
+
+  [ Ryan Niebur ]
+  * New maintainer (Closes: #501941)
+  * bump standards version to 3.8.0
+    - added a README.source
+    - use the Homepage field
+  * nothing is compiled. no need for CFLAGS.
+  * Build distclean
+    - no need to run make clean, there is no makefile.
+  * use quilt
+  * don't install the scripts and their documentation. It seems that
+    the old package didn't have the scripts even though if I build it
+    from source it does. so, for now, just don't include it.
+  * Work with Nagios 3, the version in Debian Lenny. Patch from
+    http://rt.cpan.org/Public/Bug/Display.html?id=33125, thanks
+    TOMDAAE. (Closes: #503900)
+  * Added patch to use correct path to status.dat in man pages
+  * fix short description
+  * add whatis descriptions to man pages
+  * add Vcs-{Browser,Svn} fields
+  * Removed accidental inclusion of work in progress code in the man
+    page
+
+  [ Damyan Ivanov ]
+  * debian/watch: use dist-based URL.
+  * debian/control: use dist-based Homepage
+
+ -- Ryan Niebur <ryanryan52@gmail.com>  Fri, 31 Oct 2008 01:31:18 -0700
+
 libnagios-object-perl (0.14-1) unstable; urgency=low
 
   * New upstream release
only in patch2:
unchanged:
--- libnagios-object-perl-0.14.orig/debian/README.source
+++ libnagios-object-perl-0.14/debian/README.source
@@ -0,0 +1,3 @@
+This debian package uses quilt to manage changes to the upstream
+sources. To get the sources that will be built, run "quilt push
+-a". For more information see /usr/share/doc/quilt/README.source .
only in patch2:
unchanged:
--- libnagios-object-perl-0.14.orig/debian/patches/series
+++ libnagios-object-perl-0.14/debian/patches/series
@@ -0,0 +1,5 @@
+mention-version-3-in-man-pages
+work-with-nagios-3
+use-correct-path-to-status.dat
+add-useful-whatis-entry-for-manpages
+fix-accidental-inclusion-of-wip-code-in-manpage
--- a/lib/Nagios/Config.pm
+++ b/lib/Nagios/Config.pm
@@ -58,6 +58,7 @@
  my $cf = Nagios::Config->new( Filename => $configfile );
  my $cf = Nagios::Config->new( Filename => $configfile, Version => 1 );
  my $cf = Nagios::Config->new( Filename => $configfile, Version => 2 );
+ my $cf = Nagios::Config->new( Filename => $configfile, Version => 3 );
 
 =cut
 
--- a/lib/Nagios/Object/Config.pm
+++ b/lib/Nagios/Object/Config.pm
@@ -41,6 +41,7 @@
 Create a new configuration object.  If Version is not specified, the already weak
 validation will be weakened further to allow mixing of Nagios 1.0 and 2.0 configurations.
 For now, the minor numbers of Version are ignored.  Do not specify any letters as in '2.0a1'.
+Currently only the features present in Nagios 2 are supported for Nagios 3.
 
 To enable regular expression matching, use either the "regexp_matching" or "true_regexp_matching"
 arguments to new().    See enable_regexp_matching() and enable_true_regexp_matching() below.
--- a/lib/Nagios/Config.pm
+++ b/lib/Nagios/Config.pm
@@ -29,7 +29,7 @@
 
 =head1 NAME
 
-Nagios::Config
+Nagios::Config - Parser for the Nagios::Object set of perl modules
 
 =head1 DESCRIPTION
 
--- a/lib/Nagios/Object.pm
+++ b/lib/Nagios/Object.pm
@@ -309,7 +309,7 @@
 
 =head1 NAME
 
-Nagios::Object
+Nagios::Object - Creates perl objects to represent Nagios objects
 
 =head1 DESCRIPTION
 
--- a/lib/Nagios/Object/Config.pm
+++ b/lib/Nagios/Object/Config.pm
@@ -26,7 +26,7 @@
 
 =head1 NAME
 
-Nagios::Object::Config
+Nagios::Object::Config - Perl objects to represent Nagios configuration
 
 =head1 DESCRIPTION
 
--- a/lib/Nagios/StatusLog.pm
+++ b/lib/Nagios/StatusLog.pm
@@ -84,7 +84,7 @@
 
 =head1 NAME
 
-Nagios::StatusLog, Nagios::(Service|Host|Program)::Status
+Nagios::StatusLog, Nagios::(Service|Host|Program)::Status - Perl objects to represent the Nagios status file
 
 =head1 DESCRIPTION
 

Attachment: use-correct-path-to-status.dat
Description: Netscape Proxy Auto Config

--- a/lib/Nagios/Object/Config.pm
+++ b/lib/Nagios/Object/Config.pm
@@ -138,7 +138,9 @@
 
 =cut
 
-=item COMMENTED OUT NEW PARSER WORK IN PROGRESS
+=begin comment
+
+# COMMENTED OUT NEW PARSER WORK IN PROGRESS
 
 # this is the new one I'm working on to improve speed and flexibility
 sub parse2 {
@@ -203,6 +205,8 @@
     }
 }
 
+=end comment
+
 =cut
 
 # TODO: add checks for undefined values where prohibited in %nagios_setup
--- a/lib/Nagios/StatusLog.pm
+++ b/lib/Nagios/StatusLog.pm
@@ -28,18 +28,36 @@
         Service => [qw(
             host_name description status current_attempt state_type last_check next_check check_type checks_enabled accept_passive_service_checks event_handler_enabled last_state_change problem_has_been_acknowledged last_hard_state time_ok time_unknown time_warning time_critical last_notification current_notification_number notifications_enabled latency execution_time flap_detection_enabled is_flapping percent_state_change scheduled_downtime_depth failure_prediction_enabled process_performance_data obsess_over_service plugin_output
             service_description modified_attributes check_command event_handler has_been_checked should_be_scheduled check_execution_time check_latency current_state max_attempts last_hard_state_change last_time_ok last_time_warning last_time_unknown last_time_critical performance_data next_notification no_more_notifications active_checks_enabled passive_checks_enabled acknowledgement_type last_update 
+            check_interval check_options check_period current_event_id current_notification_id current_problem_id last_event_id last_problem_id long_plugin_output notification_period retry_interval
         )],
 
         Host => [qw(
             host_name status last_check last_state_change problem_has_been_acknowledged time_up time_down time_unreachable last_notification current_notification_number notifications_enabled event_handler_enabled checks_enabled flap_detection_enabled is_flapping percent_state_change scheduled_downtime_depth failure_prediction_enabled process_performance_data plugin_output
             modified_attributes check_command event_handler has_been_checked should_be_scheduled check_execution_time check_latency current_state last_hard_state check_type performance_data next_check current_attempt max_attempts state_type last_hard_state_change last_time_up last_time_down last_time_unreachable next_notification no_more_notifications acknowledgement_type active_checks_enabled passive_checks_enabled obsess_over_host last_update
+            check_interval check_options check_period current_event_id current_notification_id current_problem_id last_event_id last_problem_id long_plugin_output notification_period retry_interval
         )],
 
         Program => [qw(
             program_start nagios_pid daemon_mode last_command_check last_log_rotation enable_notifications execute_service_checks accept_passive_service_checks enable_event_handlers obsess_over_services enable_flap_detection enable_failure_prediction process_performance_data
             modified_host_attributes modified_service_attributes active_service_checks_enabled passive_service_checks_enabled active_host_checks_enabled passive_host_checks_enabled obsess_over_hosts check_service_freshness check_host_freshness global_host_event_handler global_service_event_handler
+            active_ondemand_host_check_stats active_ondemand_service_check_stats active_scheduled_host_check_stats active_scheduled_service_check_stats cached_host_check_stats cached_service_check_stats external_command_stats high_external_command_buffer_slots next_comment_id next_downtime_id next_event_id next_notification_id next_problem_id parallel_host_check_stats passive_host_check_stats passive_service_check_stats serial_host_check_stats total_external_command_buffer_slots used_external_command_buffer_slots
         )],
-        Info => [qw( created version )]
+        Contact => [qw(
+            contact_name modified_attributes modified_host_attributes modified_service_attributes host_notification_period service_notification_period last_host_notification last_service_notification host_notifications_enabled service_notifications_enabled
+        )],
+        Servicecomment => [qw(
+            host_name service_description entry_type comment_id source persistent entry_time expires expire_time author comment_data
+        )],
+        Hostcomment => [qw(
+            host_name entry_type comment_id source persistent entry_time expires expire_time author comment_data
+        )],
+        Servicedowntime => [qw(
+             host_name service_description downtime_id entry_time start_time end_time triggered_by fixed duration author comment
+        )],
+        Hostdowntime => [qw(
+             host_name downtime_id entry_time start_time end_time triggered_by fixed duration author comment
+        )],
+        Info => [qw( created version  )]
     );
 
     GENESIS: {
@@ -72,7 +90,8 @@
 
 Reads the Nagios status log and returns ::Status objects that can
 be used to get status information about a host.   For Nagios version 2.x logs,
-pass in the Version => 2.0 parameter to new().
+pass in the Version => 2.0 parameter to new(). And similarly, pass in the
+Version => 3.0 parameter to new() for Nagios version 3.x logs.
 
  my $log = Nagios::StatusLog->new(
                 Filename => "/var/opt/nagios/status.log",
@@ -89,6 +108,12 @@
                 Version  => 2.0
            );
 
+ # for Nagios v3.0
+ my $log = Nagios::StatusLog->new(
+                Filename => "/var/opt/nagios/status.dat",
+                Version  => 3.0
+           );
+
 =head1 METHODS
 
 =over 4
@@ -123,12 +148,17 @@
     }
 
     my $self = bless( {
-        LOGFILE => $logfile,
-        VERSION => $version,
-        INFO    => {},
-        PROGRAM => {},
-        HOST    => {},
-        SERVICE => {}
+        LOGFILE         => $logfile,
+        VERSION         => $version,
+        INFO            => {},
+	CONTACT         => {},
+        PROGRAM         => {},
+        HOST            => {},
+        HOSTCOMMENT     => {},
+        HOSTDOWNTIME    => {},
+        SERVICE         => {},
+        SERVICECOMMENT  => {},
+        SERVICEDOWNTIME => {}
     }, $type );
 
     $self->update();
@@ -144,7 +174,9 @@
 
 sub update {
     my $self = shift;
-    if ( $self->{VERSION} >= 2 ) {
+    if ( $self->{VERSION} >= 3 ) {
+        return $self->update_v3( @_ );
+    } elsif ( $self->{VERSION} >= 2 && $self->{VERSION} < 3 ) {
         return $self->update_v2( @_ );
     }
     return $self->update_v1( @_ );
@@ -298,6 +330,97 @@
     1;
 }
 
+sub update_v3 ($) {
+    my $self = shift;
+
+    # be compatible with StatusLog which makes sure that references
+    # held in client code remain valid during update (also prevents
+    # some memory leaks)
+    sub _copy3 {
+        my( $from, $to ) = @_;
+        foreach my $key ( keys %$from ) {
+            $to->{$key} = $from->{$key};
+        }
+    }
+
+    my %handlers = (
+        hoststatus => sub {
+            my $item = shift;
+            my $host = $item->{host_name};
+            if ( !exists $self->{HOST}{$host} ) {
+                $self->{HOST}{$host} = {};
+            }
+            _copy3( $item, $self->{HOST}{$host} );
+        },
+        servicestatus => sub {
+            my $item = shift;
+            my $host = $item->{host_name};
+            my $svc  = $item->{service_description};
+
+            if ( !exists $self->{SERVICE}{$host}{$svc} ) {
+                $self->{SERVICE}{$host}{$svc} = {};
+            }
+            _copy3( $item, $self->{SERVICE}{$host}{$svc} );
+        },
+        info => sub {
+            _copy3( shift, $self->{INFO} );
+        },
+        programstatus => sub {
+            _copy3( shift, $self->{PROGRAM} );
+        },
+        contactstatus => sub {
+            _copy3( shift, $self->{CONTACT} );
+        },
+        servicecomment => sub {
+            _copy3( shift, $self->{SERVICECOMMENT} );
+        },
+        hostcomment => sub {
+            _copy3( shift, $self->{HOSTCOMMENT} );
+        },
+        servicedowntime => sub {
+            _copy3( shift, $self->{SERVICEDOWNTIME} );
+        },
+        hostdowntime => sub {
+            _copy3( shift, $self->{HOSTDOWNTIME} );
+        }
+
+    );
+
+    my $log_fh = gensym;
+    open( $log_fh, "<$self->{LOGFILE}" )
+        || croak "could not open file $self->{LOGFILE} for reading: $!";
+
+    # change the first line of the RE to this:
+    # (info|programstatus|hoststatus|servicestatus|contactstatus|servicecomment|hostcomment|servicedowntime|hostdowntime) \s* {(
+    # to make it a bit more careful, but it has a measurable cost on runtime
+    my $entry_re = qr/
+        # capture the type into $1
+        (\w+) \s*
+        # capture all of the text between the brackets into $2
+        {( .*? )}
+        # match the last bracket only if followed by another definition
+        (?=(?: \s* (?:info|programstatus|hoststatus|servicestatus|contacstatus|servicecomment|hostcomment|servicedowntime|hostdowntime) \s* { | \Z) )
+        # capture remaining text (1-2 lines) into $3 for re-processing
+        (.*)$
+    /xs;
+
+    my $entry = '';
+    while ( my $line = <$log_fh> ) {
+        next if ( $line =~ /^\s*#/ );
+        $entry .= $line;
+        if ( $entry =~ m/$entry_re/ ) {
+            ( my $type, my $text, $entry ) = ( $1, $2, $3 );
+            $text =~ s/[\r\n]+\s*/\n/g; # clean up whitespace and newlines
+            my %item = map { split /\s*=\s*/, $_, 2 } split /\n/, $text;
+            $handlers{$type}->( \%item );
+        }
+    }
+
+    close( $log_fh );
+
+    1;
+}
+
 sub list_tags {
     my $type = ref($_[0]) ? ref($_[0]) : $_[0];
     my $listref = ${"$type\::tags"};

Attachment: signature.asc
Description: Digital signature


Reply to: