[packages/smokeping] Attempt update to 2.6.11; this stuff is horrible

mmazur mmazur at pld-linux.org
Tue Dec 22 12:27:27 CET 2015


commit c235887a23d670fb92ab8be5964fb8274d2f65b8
Author: Mariusz Mazur <mmazur at axeos.com>
Date:   Tue Dec 22 10:54:55 2015 +0100

    Attempt update to 2.6.11; this stuff is horrible

 fix-paths.patch                  | 142 +++++++++++++++++++++++++++++++++++++++
 high_precision_sleep_timer.patch |  73 ++++++++++++++++++++
 smokeping.init                   |   4 +-
 smokeping.spec                   |  83 ++++++++++-------------
 4 files changed, 251 insertions(+), 51 deletions(-)
---
diff --git a/smokeping.spec b/smokeping.spec
index f0efefa..6711efe 100644
--- a/smokeping.spec
+++ b/smokeping.spec
@@ -2,8 +2,8 @@
 Summary:	Smokeping - a latency grapher that uses rrdtool
 Summary(pl.UTF-8):	Smokeping - narzędzie do tworzenia wykresów opóźnień sieci
 Name:		smokeping
-Version:	2.4.2
-Release:	12
+Version:	2.6.11
+Release:	0.2
 License:	GPL v2+
 Group:		Networking/Utilities
 Source0:	http://oss.oetiker.ch/smokeping/pub/%{name}-%{version}.tar.gz
@@ -14,6 +14,8 @@ Source3:	%{name}-config
 Source4:	%{name}-lighttpd.conf
 Source5:	%{name}.tmpfiles
 Source6:	%{name}-httpd.conf
+Patch0:     fix-paths.patch
+Patch1:     high_precision_sleep_timer.patch
 URL:		http://oss.oetiker.ch/smokeping/
 BuildRequires:	perl-tools-pod
 BuildRequires:	rpm-perlprov >= 4.1-13
@@ -92,60 +94,50 @@ Interfejs WWW (CGI) do smokepinga.
 %prep
 %setup -q
 
-decruft() { grep -lr "$1" . | xargs %{__sed} -i -e "s|$1|$2|g"; }
+%patch0 -p1
+%patch1 -p1
 
-# eliminate Tobi's quirks
-decruft /usr/sepp/bin %{_bindir}
+#sed -i -e 's,^Net::.*$,,' PERL_MODULES
 
-# rrdtool package goes into standard perl tree
-decruft '^use lib .*rrdtool.*;' ''
-
-decruft /usr/bin/speedy-5.8.8 %{_bindir}/speedy
-
-sed -i -e '/\/home\/oposs\/smokeping\/software\/lib/d' htdocs/tr.cgi.dist
-sed -i -e '/\/home\/oetiker\/checkouts\/smokeping\/trunk\/software\/lib/d' htdocs/smokeping.cgi.dist
-sed -i -e 's|/home/oetiker/checkouts/smokeping/trunk/software/etc/config.dist|%{_sysconfdir}/config|' htdocs/smokeping.cgi.dist
-# working config in wrong location
-decruft "etc/config.dist" "%{_sysconfdir}/config"
-
-sed -i -e 's#use lib qw(lib);#use lib qw(%{_datadir}/%{name});#' bin/smokeping.dist
-
-sed -i -e 's#"cropper/#"/smokeping/cropper/#' etc/basepage.html.dist
+sed -i -e 's#@prefix@/etc/\(.*\).dist#/etc/smokeping/\1#' etc/config.dist.in
+sed -i -e 's#@prefix@/etc/#/etc/smokeping/#' etc/config.dist.in
 
 %build
+%configure
 %{__make}
 
 %install
 rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir},%{_wwwconfdir},%{_sbindir}} \
+install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,%{_sysconfdir},%{_wwwconfdir}} \
 	$RPM_BUILD_ROOT{%{_datadir}/%{name},%{_sharedstatedir}/%{name}/{img,rrd},%{_cgi_bindir}} \
 	$RPM_BUILD_ROOT{%{_mandir}/man{1,3,5,7},/var/run/%{name}} \
 	$RPM_BUILD_ROOT/usr/lib/tmpfiles.d
 
-install etc/basepage.html.dist $RPM_BUILD_ROOT%{_sysconfdir}/basepage.html
-install etc/config.dist $RPM_BUILD_ROOT%{_sysconfdir}
-install etc/smokemail.dist $RPM_BUILD_ROOT%{_sysconfdir}/smokemail
-install etc/smokeping_secrets.dist $RPM_BUILD_ROOT%{_sysconfdir}/smokeping_secrets
-install etc/tmail.dist $RPM_BUILD_ROOT%{_sysconfdir}/tmail
-install bin/smokeping.dist $RPM_BUILD_ROOT%{_sbindir}/smokeping
-install bin/tSmoke.dist $RPM_BUILD_ROOT%{_sbindir}/tSmoke
-cp -r htdocs/{cropper,resource,script,tr.html} $RPM_BUILD_ROOT%{_cgi_bindir}
-install htdocs/smokeping.cgi.dist $RPM_BUILD_ROOT%{_cgi_bindir}/smokeping.cgi
-install htdocs/tr.cgi.dist $RPM_BUILD_ROOT%{_cgi_bindir}/tr.cgi
-cp -r lib/* $RPM_BUILD_ROOT%{_datadir}/%{name}
+%{__make} install DESTDIR=$RPM_BUILD_ROOT
+
+# start of fixing paths
+for f in basepage.html smokemail smokeping_secrets tmail; do
+    mv $RPM_BUILD_ROOT/etc/smokeping/{$f.dist,$f}
+done
+
+rm -rf $RPM_BUILD_ROOT/etc/smokeping/examples
+
+mv $RPM_BUILD_ROOT/usr/lib/{*.pm,Smokeping} $RPM_BUILD_ROOT%{_datadir}/%{name}
+
+mv $RPM_BUILD_ROOT{/usr/htdocs/cropper,%{_cgi_bindir}}
+mv $RPM_BUILD_ROOT%{_bindir}/smokeping_cgi $RPM_BUILD_ROOT%{_cgi_bindir}/smokeping.cgi
+
+mv $RPM_BUILD_ROOT%{_mandir}/man1/{smokeping_cgi.1,smokeping.cgi.1}
+# end of fixing paths
+
 install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
 install %{SOURCE2} $RPM_BUILD_ROOT%{_wwwconfdir}/apache.conf
 install %{SOURCE6} $RPM_BUILD_ROOT%{_wwwconfdir}/httpd.conf
 install %{SOURCE4} $RPM_BUILD_ROOT%{_wwwconfdir}/lighttpd.conf
 install %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/config
-install doc/*.1 $RPM_BUILD_ROOT%{_mandir}/man1
-# TODO: man(3) pages from subdirectories are packaged in %_docdir too, clean them up
-install doc/{,Config/,Smokeping/{,matchers/,probes/,sorters/}}*.3 $RPM_BUILD_ROOT%{_mandir}/man3
-install doc/*.5 $RPM_BUILD_ROOT%{_mandir}/man5
-install doc/*.7 $RPM_BUILD_ROOT%{_mandir}/man7
-
 install %{SOURCE5} $RPM_BUILD_ROOT/usr/lib/tmpfiles.d/%{name}.conf
 
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -207,16 +199,13 @@ find /var/lib/smokeping/rrd -type d -user root -group root -exec chown smokeping
 
 %files
 %defattr(644,root,root,755)
-%doc CHANGES CONTRIBUTORS COPYRIGHT README TODO doc/*.html doc/*.txt doc/Config doc/Smokeping doc/examples
-%attr(755,root,root) %{_sbindir}/smokeping
-%attr(755,root,root) %{_sbindir}/tSmoke
+%doc CHANGES CONTRIBUTORS COPYRIGHT README TODO doc/*.txt doc/examples
+%attr(755,root,root) %{_bindir}/smokeinfo
+%attr(755,root,root) %{_bindir}/smokeping
+%attr(755,root,root) %{_bindir}/tSmoke
 %{_datadir}/smokeping
 %exclude %{_cgi_bindir}/cropper
-%exclude %{_datadir}/smokeping/smokeping.cgi
-%exclude %{_cgi_bindir}/resource
-%exclude %{_cgi_bindir}/script
-%exclude %{_datadir}/smokeping/tr.cgi
-%exclude %{_datadir}/smokeping/tr.html
+%exclude %{_datadir}/smokeping/smokeping.*cgi
 %{_mandir}/man1/smokeping.1*
 %{_mandir}/man1/smokeping.cgi.1*
 %{_mandir}/man1/tSmoke.1*
@@ -245,7 +234,3 @@ find /var/lib/smokeping/rrd -type d -user root -group root -exec chown smokeping
 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_wwwconfdir}/lighttpd.conf
 %{_cgi_bindir}/cropper
 %attr(755,root,root) %{_cgi_bindir}/smokeping.cgi
-%{_cgi_bindir}/resource
-%{_cgi_bindir}/script
-%attr(755,root,root) %{_cgi_bindir}/tr.cgi
-%{_cgi_bindir}/tr.html
diff --git a/fix-paths.patch b/fix-paths.patch
new file mode 100644
index 0000000..1cafc5e
--- /dev/null
+++ b/fix-paths.patch
@@ -0,0 +1,142 @@
+diff -urN smokeping-2.6.11.orig/doc/smokeping_install.pod smokeping-2.6.11/doc/smokeping_install.pod
+--- smokeping-2.6.11.orig/doc/smokeping_install.pod	2013-11-14 10:42:22.000000000 +0100
++++ smokeping-2.6.11/doc/smokeping_install.pod	2015-12-17 11:48:24.203504524 +0100
+@@ -152,7 +152,7 @@
+ 
+ =head2 Configuration
+ 
+-Use the F<etc/config.dist> file as a template to create your own smokeping configuration file.
++Use the F</etc/smokeping/config> file as a template to create your own smokeping configuration file.
+ See L<smokeping_config> for details.
+ 
+ =over
+diff -urN smokeping-2.6.11.orig/etc/basepage.html.dist smokeping-2.6.11/etc/basepage.html.dist
+--- smokeping-2.6.11.orig/etc/basepage.html.dist	2012-04-02 09:20:35.000000000 +0200
++++ smokeping-2.6.11/etc/basepage.html.dist	2015-12-17 11:48:24.211504620 +0100
+@@ -53,10 +53,10 @@
+ -->
+ </STYLE>
+ 
+-<script src="cropper/lib/prototype.js" type="text/javascript"></script>      
+-<script src="cropper/lib/scriptaculous.js?load=builder,effects,dragdrop" type="text/javascript"></script>
+-<script src="cropper/cropper.js" type="text/javascript"></script>
+-<script src="cropper/smokeping-zoom.js" type="text/javascript"></script>
++<script src="/smokeping/cropper/lib/prototype.js" type="text/javascript"></script>      
++<script src="/smokeping/cropper/lib/scriptaculous.js?load=builder,effects,dragdrop" type="text/javascript"></script>
++<script src="/smokeping/cropper/cropper.js" type="text/javascript"></script>
++<script src="/smokeping/cropper/smokeping-zoom.js" type="text/javascript"></script>
+ 
+ 
+ 
+diff -urN smokeping-2.6.11.orig/lib/Smokeping/Examples.pm smokeping-2.6.11/lib/Smokeping/Examples.pm
+--- smokeping-2.6.11.orig/lib/Smokeping/Examples.pm	2011-10-05 11:51:46.000000000 +0200
++++ smokeping-2.6.11/lib/Smokeping/Examples.pm	2015-12-17 11:48:24.208504584 +0100
+@@ -12,7 +12,7 @@
+ This module generates L<smokeping_examples> and the example
+ configuration files distributed with Smokeping. It is supposed to be
+ invoked from the smokeping distribution top directory, as it will need
+-the C<etc/config.dist> template configuration file and will create files
++the C</etc/smokeping/config> template configuration file and will create files
+ in the directories C<doc> and C<doc/examples>.
+ 
+ =head1 DESCRIPTION
+@@ -107,7 +107,7 @@
+ ${e}head1 DESCRIPTION
+ 
+ Currently the examples differ only in the C<Probes> and C<Targets>
+-sections. The other sections are taken from the C<etc/config.dist>
++sections. The other sections are taken from the C</etc/smokeping/config>
+ configuration template in the Smokeping distribution so that the example
+ files are complete.
+ 
+diff -urN smokeping-2.6.11.orig/lib/Smokeping.pm smokeping-2.6.11/lib/Smokeping.pm
+--- smokeping-2.6.11.orig/lib/Smokeping.pm	2014-11-04 23:56:29.000000000 +0100
++++ smokeping-2.6.11/lib/Smokeping.pm	2015-12-17 11:48:24.194504417 +0100
+@@ -3526,7 +3526,7 @@
+ 
+  *** Probes ***
+  +FPing
+- binary = /usr/sepp/bin/fping
++ binary = /usr/bin/fping
+ 
+ You can override it for a particular slave like this:
+ 
+--- smokeping-2.6.11.orig/bin/smokeping	2011-10-05 11:51:46.000000000 +0200
++++ smokeping-2.6.11/bin/smokeping	2015-12-22 10:41:23.876468254 +0100
+@@ -4,14 +4,11 @@
+ use strict;
+ use warnings;
+ 
+-use FindBin;
+-# PERL5LIB
+-use lib "$FindBin::Bin/../thirdparty/lib/perl5";
+-use lib "$FindBin::Bin/../lib";
++use lib "/usr/share/smokeping";
+ 
+ use Smokeping;
+  
+-Smokeping::main("$FindBin::Bin/../etc/config");
++Smokeping::main("/etc/smokeping/config");
+ 
+ =head1 NAME
+ 
+--- smokeping-2.6.11.orig/bin/tSmoke	2011-10-05 11:51:46.000000000 +0200
++++ smokeping-2.6.11/bin/tSmoke	2015-12-22 10:44:19.154562257 +0100
+@@ -51,10 +51,7 @@
+ # -- Getopt::Long
+ #
+ # Point the lib variables to your implementation
+-use FindBin;
+-# PERL5LIB
+-use lib "$FindBin::Bin/../thirdparty/lib/perl5";
+-use lib "$FindBin::Bin/../lib";
++use lib "/usr/share/smokeping";
+ 
+ use Smokeping;
+ use Net::SMTP;
+@@ -63,7 +60,7 @@
+ use RRDs;
+ 
+ # Point to your Smokeping config file
+-my $cfgfile = "etc/config.dist";
++my $cfgfile = "/etc/smokeping/config";
+ 
+ # global variables
+ my $cfg;
+--- smokeping-2.6.11.orig/bin/smokeping_cgi	2011-10-05 11:51:46.000000000 +0200
++++ smokeping-2.6.11/bin/smokeping_cgi	2015-12-22 10:45:24.548343500 +0100
+@@ -4,10 +4,7 @@
+ use strict;
+ use warnings;
+ 
+-use FindBin;
+-# PERL5LIB
+-use lib "$FindBin::Bin/../thirdparty/lib/perl5";
+-use lib "$FindBin::Bin/../lib";
++use lib "/usr/share/smokeping";
+ 
+ # don't bother with zombies
+ $SIG{CHLD} = 'IGNORE';
+@@ -18,7 +15,7 @@
+ 
+ use CGI::Fast;
+ 
+-my $cfg = (shift @ARGV) || "$FindBin::Bin/../etc/config";
++my $cfg = (shift @ARGV) || "/etc/smokeping/config";
+ 
+ 
+ while (my $q = new CGI::Fast) {
+--- smokeping-2.6.11.orig/bin/smokeinfo	2012-07-03 22:37:04.000000000 +0200
++++ smokeping-2.6.11/bin/smokeinfo	2015-12-22 10:46:30.982137167 +0100
+@@ -2,10 +2,7 @@
+ use strict;
+ use warnings;
+ 
+-use FindBin;
+-# PERL5LIB
+-use lib "$FindBin::Bin/../thirdparty/lib/perl5";
+-use lib "$FindBin::Bin/../lib";
++use lib "/usr/share/smokeping";
+ 
+ use Smokeping::Info;
+ use Getopt::Long 2.25 qw(:config no_ignore_case);
diff --git a/high_precision_sleep_timer.patch b/high_precision_sleep_timer.patch
new file mode 100644
index 0000000..429ba13
--- /dev/null
+++ b/high_precision_sleep_timer.patch
@@ -0,0 +1,73 @@
+--- smokeping-2.6.11.orig/lib/Smokeping.pm	2015-12-21 13:02:15.615786332 +0100
++++ smokeping-2.6.11/lib/Smokeping.pm	2015-12-21 20:26:59.387447714 +0100
+@@ -10,7 +10,7 @@
+ use SNMP_Session;
+ # enable locale??
+ #use locale;
+-use POSIX qw(locale_h signal_h sys_wait_h);
++use POSIX qw(fmod locale_h signal_h sys_wait_h);
+ use Smokeping::Config;
+ use RRDs;
+ use Sys::Syslog qw(:DEFAULT setlogsock);
+@@ -21,6 +21,7 @@
+ use Smokeping::RRDhelpers;
+ use Smokeping::Graphs;
+ use URI::Escape;
++use Time::HiRes;
+ 
+ setlogsock('unix')
+    if grep /^ $^O $/xo, ("linux", "openbsd", "freebsd", "netbsd");
+@@ -4395,18 +4396,27 @@
+ 
+     report_probes($probes, $myprobe);
+ 
++    my $now = Time::HiRes::time();
++    my $longprobe = 0;
+     while (1) {
+         unless ($opt{nosleep} or $opt{debug}) {
+-                my $sleeptime = $step - (time-$offset) % $step;
++                my $sleeptime = $step - fmod($now-$offset, $step);
++                my $logmsg = "Sleeping $sleeptime seconds.";
++                if ($longprobe && $step-$sleeptime < 0.3) {
++                    $logmsg = "NOT sleeping $sleeptime seconds, running probes immediately.";
++                    $sleeptime = 0;
++                }
+                 if (defined $myprobe) {
+-                        $probes->{$myprobe}->do_debug("Sleeping $sleeptime seconds.");
++                        $probes->{$myprobe}->do_debug($logmsg);
+                 } else {
+-                        do_debuglog("Sleeping $sleeptime seconds.");
++                        do_debuglog($logmsg);
++                }
++                if ($sleeptime > 0) {
++                    Time::HiRes::sleep($sleeptime);
+                 }
+-                sleep $sleeptime;
+                 last if checkhup($multiprocessmode, $gothup) && reload_cfg($cfgfile);
+         }
+-        my $now = time;       
++        my $startts = Time::HiRes::time();
+         run_probes $probes, $myprobe; # $myprobe is undef if running without 'concurrentprobes'
+         my %sortercache;
+         if ($opt{'master-url'}){            
+@@ -4430,8 +4440,11 @@
+             save_sortercache($cfg,\%sortercache,$myprobe);
+         }
+         exit 0 if $opt{debug};
+-        my $runtime = time - $now;
++        $now = Time::HiRes::time();
++        my $runtime = $now - $startts;
++        $longprobe = 0;
+         if ($runtime > $step) {
++                $longprobe = 1;
+                 my $warn = "WARNING: smokeping took $runtime seconds to complete 1 round of polling. ".
+                 "It should complete polling in $step seconds. ".
+                 "You may have unresponsive devices in your setup.\n";
+@@ -4442,6 +4455,7 @@
+                 }
+         }
+         elsif ($runtime > $step * 0.8) {
++                $longprobe = 1;
+                 my $warn = "NOTE: smokeping took $runtime seconds to complete 1 round of polling. ".
+                 "This is over 80% of the max time available for a polling cycle ($step seconds).\n";
+                 if (defined $myprobe) {
diff --git a/smokeping.init b/smokeping.init
index 53e4dbb..c1c718e 100644
--- a/smokeping.init
+++ b/smokeping.init
@@ -23,13 +23,13 @@ else
 fi
 
 checkconfig() {
-	/usr/sbin/smokeping --check || exit 1
+	/usr/bin/smokeping --check || exit 1
 }
 
 start() {
 	if [ ! -f /var/lock/subsys/smokeping ]; then
 		msg_starting smokeping
-		daemon --pidfile /var/run/smokeping/smokeping.pid --user smokeping /usr/sbin/smokeping
+		daemon --pidfile /var/run/smokeping/smokeping.pid --user smokeping /usr/bin/smokeping
 		RETVAL=$?
 		[ $RETVAL -eq 0 ] && touch /var/lock/subsys/smokeping
 	else
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/smokeping.git/commitdiff/0c2fb5b231b1d20f79f8c579dd53eb96252dcb26



More information about the pld-cvs-commit mailing list