[Git][debian-gis-team/tirex][master] 5 commits: New upstream version 0.7.1

Bas Couwenberg (@sebastic) gitlab at salsa.debian.org
Wed Feb 28 12:31:23 GMT 2024



Bas Couwenberg pushed to branch master at Debian GIS Project / tirex


Commits:
d4258269 by Bas Couwenberg at 2024-02-28T13:13:00+01:00
New upstream version 0.7.1
- - - - -
ea7da769 by Bas Couwenberg at 2024-02-28T13:13:01+01:00
Update upstream source from tag 'upstream/0.7.1'

Update to upstream version '0.7.1'
with Debian dir 80e41e7b7cb31b8ac4a1c2205be6316a9bfb1ca0
- - - - -
345d364e by Bas Couwenberg at 2024-02-28T13:13:19+01:00
New upstream release.

- - - - -
8f048aa7 by Bas Couwenberg at 2024-02-28T13:17:17+01:00
Refresh patches.

- - - - -
36ca10a5 by Bas Couwenberg at 2024-02-28T13:28:59+01:00
Update lintian overrides.

- - - - -


16 changed files:

- Makefile
- README.md
- backend-mapnik/metatilehandler.cc
- backend-mapnik/networklistener.cc
- backend-mapnik/renderd.cc
- bin/tirex-backend-manager
- bin/tirex-status
- debian/changelog
- − debian/patches/0001-Make-sure-usr-libexec-directory-extists.patch
- debian/patches/series
- debian/tirex.lintian-overrides
- + etc/logrotate.d/tirex-master
- etc/tirex.conf.dist
- lib/Tirex.pm
- lib/Tirex/Backend.pm
- lib/Tirex/Config.pm


Changes:

=====================================
Makefile
=====================================
@@ -33,6 +33,7 @@ install: build
 	for program in bin/*; do \
 	    install -m 755 ${INSTALLOPTS} $$program $(DESTDIR)/usr/bin/; \
     done
+	install -m 755 ${INSTALLOPTS} -d                                       $(DESTDIR)/usr/libexec
 	install -m 755 ${INSTALLOPTS} backends/test                            $(DESTDIR)/usr/libexec/tirex-backend-test
 	install -m 755 ${INSTALLOPTS} backends/wms                             $(DESTDIR)/usr/libexec/tirex-backend-wms
 	install -m 755 ${INSTALLOPTS} backends/tms                             $(DESTDIR)/usr/libexec/tirex-backend-tms


=====================================
README.md
=====================================
@@ -58,7 +58,7 @@ installed. Call
 to create the packages. The following packages will be created in the parent
 directory:
 
-    tirex-core
+    tirex
     tirex-backend-mapnik
     tirex-backend-wms
     tirex-backend-mapserver


=====================================
backend-mapnik/metatilehandler.cc
=====================================
@@ -218,7 +218,15 @@ const NetworkResponse *MetatileHandler::handleRequest(const NetworkRequest *requ
         }
 
         outfile.close();
+        free(offsets);
         delete rrs;
+
+        if (outfile.fail())
+        {
+            unlink(tmpfilename);
+            return NetworkResponse::makeErrorResponse(request, "cannot write metatile");
+        }
+
         rename(tmpfilename, metafilename);
         debug("created %s", metafilename);
 
@@ -233,7 +241,6 @@ const NetworkResponse *MetatileHandler::handleRequest(const NetworkRequest *requ
         char buffer[20];
         snprintf(buffer, 20, "%ld", (end.tv_sec-start.tv_sec) * 1000 + (end.tv_usec - start.tv_usec) / 1000);
         resp->setParam("render_time", buffer);
-        free(offsets);
     }
     debug("<< MetatileHandler::handleRequest");
     return resp;


=====================================
backend-mapnik/networklistener.cc
=====================================
@@ -193,7 +193,7 @@ void NetworkListener::run()
             if (mMaxRequests > -1 && ++mRequestCount > mMaxRequests) 
             {
                 error("maxrequests reached, terminating");
-		exit(1);
+                break;
             }
         }
     }


=====================================
backend-mapnik/renderd.cc
=====================================
@@ -273,6 +273,6 @@ int main(int argc, char **argv)
 {
     RenderDaemon mtd(argc, argv);
     mtd.run();
-    exit(9); // return with EXIT_CODE_RESTART==9 which means everything is ok, the backend can be restartet if the backend-manager wants to
+    exit(9); // return with EXIT_CODE_RESTART==9 which means everything is ok, the backend can be restarted if the backend-manager wants to
 }
 


=====================================
bin/tirex-backend-manager
=====================================
@@ -141,6 +141,9 @@ my $TERM_TIMEOUT   =  5;
 # timeout when waiting for alive messages from workers
 my $SELECT_TIMEOUT = 10;
 
+# hash that catalogues worker processes
+my $workers;
+
 #-----------------------------------------------------------------------------
 # Main loop
 #-----------------------------------------------------------------------------
@@ -148,7 +151,7 @@ my $SELECT_TIMEOUT = 10;
     my $sockets = {};
     while (1)
     {
-        my $workers = {};
+        $workers = {};
 
         Tirex::Renderer->read_config_dir($config_dir);
         syslog('info', 'Found config for renderers: %s', join(' ', map { $_->get_name(); } Tirex::Renderer->all()));
@@ -160,22 +163,15 @@ my $SELECT_TIMEOUT = 10;
 
         while (! $received_sighup)
         {
-            start_workers($workers, $sockets);
-            check_for_alive_messages($workers);
-            cleanup_dead_workers($workers);
-            kill_old_workers($workers);
+            start_workers($sockets);
+            check_for_alive_messages();
+            cleanup_dead_workers();
+            kill_old_workers();
 
             if ($received_sigterm)
             {
                 syslog('info', 'TERM/INT received, forwarding to children: %s', join(' ', keys %$workers));
-
-                foreach my $pid (keys %$workers)
-                {
-                    kill('HUP', $pid);
-                }
-
-                unlink($pidfile); # ignore return code
-                exit(0);
+                exit_gracefully(0);
             }
 
             sleep 1;
@@ -192,6 +188,19 @@ my $SELECT_TIMEOUT = 10;
     }
 }
 
+#-----------------------------------------------------------------------------
+# Terminate and also kill all children.
+#-----------------------------------------------------------------------------
+sub exit_gracefully
+{
+    my $exitcode = shift;
+    foreach my $pid (keys %$workers)
+    {
+        kill('HUP', $pid);
+    }
+    unlink($pidfile); # ignore return code
+    exit($exitcode);
+}
 
 #-----------------------------------------------------------------------------
 # Open sockets for all renderers or re-use old ones after a SIGHUP
@@ -251,7 +260,6 @@ sub open_sockets
 #-----------------------------------------------------------------------------
 sub start_workers
 {
-    my $workers = shift;
     my $sockets = shift;
 
     foreach my $renderer (Tirex::Renderer->enabled())
@@ -327,8 +335,6 @@ sub create_pipe
 #-----------------------------------------------------------------------------
 sub check_for_alive_messages
 {
-    my $workers = shift;
-
     my $select = IO::Select->new();
     foreach my $worker (values %$workers)
     {
@@ -353,33 +359,24 @@ sub check_for_alive_messages
 #-----------------------------------------------------------------------------
 sub cleanup_dead_workers
 {
-    my $workers = shift;
-
     while ((my $pid = waitpid(-1, WNOHANG)) > 0) 
     {
-        my $exit_code = $? >> 8;
-        my $signal    = $? & 127;
-        syslog('warning', 'child %d terminated (exit_code=%d, signal=%d)', $pid, $exit_code, $signal);
-
         # this will happen if a worker child dies which we don't know about
         # because we got a SIGHUP in between
         next unless ($workers->{$pid});
 
-        # if the return code of the child is something other than $EXIT_CODE_RESTART, the renderer is disabled
+        my $exit_code = $? >> 8;
+        my $signal    = $? & 127;
+        syslog('warning', 'child %d terminated (exit_code=%d, signal=%d)', $pid, $exit_code, $signal);
+
+        # if the return code of the child is something other than $EXIT_CODE_RESTART, we quit.
         # this does not happen if the worker child was killed because of a timeout
-        #if ($exit_code != $Tirex::EXIT_CODE_RESTART && ! defined $workers->{$pid}->{'hungup'})
-        #{
-        #    my $renderer = $workers->{$pid}->{'renderer'};
-        #    if ($renderer->get_debug())
-        #    {
-        #        syslog('debug', 'renderer %s not disabled because we are in debug mode', $renderer->get_name());
-        #    }
-        #    else
-        #    {
-        #        $renderer->disable();
-        #        syslog('err', 'disabled renderer %s', $renderer->get_name());
-        #    }
-        #}
+        if ($exit_code != $Tirex::EXIT_CODE_RESTART && ! defined $workers->{$pid}->{'hungup'})
+        {
+            my $renderer = $workers->{$pid}->{'renderer'};
+            syslog('err', 'terminating due to unexpected error in renderer %s', $renderer->get_name());
+            exit_gracefully(2);
+        }
 
         $workers->{$pid}->{'handle'}->close();
         $workers->{$pid}->{'renderer'}->remove_worker($pid);
@@ -393,8 +390,6 @@ sub cleanup_dead_workers
 #-----------------------------------------------------------------------------
 sub kill_old_workers
 {
-    my $workers = shift;
-
     my $now = time();
 
     foreach my $worker (values %$workers) 
@@ -467,7 +462,6 @@ sub sigterm_handler
     $received_sigterm = 1;
 }
 
-
 __END__
 
 =head1 NAME


=====================================
bin/tirex-status
=====================================
@@ -155,18 +155,22 @@ sub format_status
         my @styles = keys %{$d->{'rm'}->{'stats'}->{'sum_render_time'}};
         my $maxzoom = 0;
         map { $maxzoom = max($maxzoom, scalar(@{$d->{'rm'}->{'stats'}->{'sum_render_time'}->{$_}})); } @styles;
-        $r = "style     zoom |";
+        my $max_name_len = 0;
+        map { $max_name_len = max($max_name_len, length($_)); } @styles;
+
+        $r = "style" . " " x ($max_name_len-9) . "zoom |";
         for (my $i = 0; $i < $maxzoom; $i++)
         {
             $r .= sprintf("%7d ", $i);
         }
         $r .= "\n";
-        $r .= "---------------+";
-        $r .= "----------" x $maxzoom;
+        $r .= "-" x $max_name_len;
+        $r .= "-+";
+        $r .= "--------" x $maxzoom;
         $r .= "\n";
-        foreach (@styles)
+        foreach (sort @styles)
         {
-            $r .= sprintf("%-15s|", $_);
+            $r .= sprintf("%-${max_name_len}s |", $_);
             for (my $i = 0; $i < $maxzoom; $i++)
             {
                 my $time = $d->{'rm'}->{'stats'}->{'sum_render_time'}->{$_}->[$i];


=====================================
debian/changelog
=====================================
@@ -1,17 +1,20 @@
-tirex (0.7.0-4) UNRELEASED; urgency=medium
+tirex (0.7.1-1) UNRELEASED; urgency=medium
 
   * Team upload.
 
   [ Bas Couwenberg ]
+  * New upstream release.
   * Bump debhelper compat to 13.
   * Enable Salsa CI.
   * Switch to dh-sequence-*.
+  * Refresh patches.
+  * Update lintian overrides.
 
   [ Helmut Grohne ]
   * Let dh_installsystemd choose the location of systemd units.
     (closes: #1052715)
 
- -- Bas Couwenberg <sebastic at debian.org>  Tue, 13 Jun 2023 16:20:21 +0200
+ -- Bas Couwenberg <sebastic at debian.org>  Wed, 28 Feb 2024 13:13:05 +0100
 
 tirex (0.7.0-3) unstable; urgency=medium
 


=====================================
debian/patches/0001-Make-sure-usr-libexec-directory-extists.patch deleted
=====================================
@@ -1,22 +0,0 @@
-From: Felix Delattre <fd at gfz-potsdam.de>
-Date: Thu, 7 Oct 2021 15:11:21 +0000
-Subject: Make sure /usr/libexec directory extists.
-Origin: https://github.com/openstreetmap/tirex/pull/42/commits/97fce9e2ac64fb4b7fb3d0a99ce766a3d6273546
-Bug: https://github.com/openstreetmap/tirex/pull/42
-
----
- Makefile | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/Makefile b/Makefile
-index 2aecf6c..a9608fa 100644
---- a/Makefile
-+++ b/Makefile
-@@ -33,6 +33,7 @@ install: build
- 	for program in bin/*; do \
- 	    install -m 755 ${INSTALLOPTS} $$program $(DESTDIR)/usr/bin/; \
-     done
-+	install -m 755 ${INSTALLOPTS} -d                                       $(DESTDIR)/usr/libexec
- 	install -m 755 ${INSTALLOPTS} backends/test                            $(DESTDIR)/usr/libexec/tirex-backend-test
- 	install -m 755 ${INSTALLOPTS} backends/wms                             $(DESTDIR)/usr/libexec/tirex-backend-wms
- 	install -m 755 ${INSTALLOPTS} backends/tms                             $(DESTDIR)/usr/libexec/tirex-backend-tms


=====================================
debian/patches/series
=====================================
@@ -1,2 +1 @@
-0001-Make-sure-usr-libexec-directory-extists.patch
 rules-requires-root.patch


=====================================
debian/tirex.lintian-overrides
=====================================
@@ -1,6 +1,3 @@
-# This package only provides systemd unit files:
-package-supports-alternative-init-but-no-init.d-script
-
 # False positive, lat/lon
 typo-in-manual-page lon long *
 


=====================================
etc/logrotate.d/tirex-master
=====================================
@@ -0,0 +1,10 @@
+# /etc/logrotate.d/tirex-master
+/var/log/tirex/jobs.log {
+  daily
+  rotate 35
+  dateext
+  compress
+  missingok
+  notifempty
+  create 0644 tirex tirex
+}


=====================================
etc/tirex.conf.dist
=====================================
@@ -82,6 +82,6 @@ bucket name=background minprio=20 maxproc=2 maxload=4
 #  command to execute for replicating the space-separated list of files
 #  %FILES% to host %HOST%. By default uses a ssh connection with a 
 #  persistent control connection that will be re-created on demand.
-#syncd_command=tar -C/ -cf - %FILES% | ssh %HOST% -oControlMaster=auto -oControlPersist=1h -oControlPath=/run/tirex/ssh-control-%h-%r-%p -Tq "tar -C/ -xf -"
+#syncd_command=rsync --archive --relative --no-implied-dirs --rsh="ssh -oControlMaster=auto -oControlPersist=1h -oControlPath=$SOCKET_DIR/ssh-control-%h-%r-%p -Tq" %FILES% "%HOST%:/
 
 #-- THE END ------------------------------------------------------------------


=====================================
lib/Tirex.pm
=====================================
@@ -74,7 +74,7 @@ our $BACKEND_MANAGER_ALIVE_TIMEOUT   = 8; # minutes - make this a tad smaller th
 our $SYNCD_PIDFILE                   = '/run/tirex/tirex-syncd.pid';
 our $SYNCD_UDP_PORT                  = 9323;
 our $SYNCD_AGGREGATE_DELAY           = 5;
-our $SYNCD_COMMAND                   = qq(tar -C/ -cf - %FILES% | ssh %HOST% -oControlMaster=auto -oControlPersist=1h -oControlPath=$SOCKET_DIR/ssh-control-%h-%r-%p -Tq "tar -C/ -xf -");
+our $SYNCD_COMMAND                   = qq(rsync --archive --relative --no-implied-dirs --rsh="ssh -oControlMaster=auto -oControlPersist=1h -oControlPath=$SOCKET_DIR/ssh-control-%h-%r-%p -Tq" %FILES% "%HOST%:/");
 
 our $MODTILE_SOCK                    = "/run/tirex/modtile.sock";
 our $MODTILE_PERM                    = 0666;


=====================================
lib/Tirex/Backend.pm
=====================================
@@ -199,14 +199,22 @@ sub main
             my $t0 = [Time::HiRes::gettimeofday];
             my $image = $self->create_metatile($map, $metatile);
 
-            $self->set_status('writing metatile');
+            if ($image)
+            {
+                $self->set_status('writing metatile');
 
-            $self->write_metatile($image, $filename, $metatile);
+                $self->write_metatile($image, $filename, $metatile);
 
-            $msg = $msg->reply();
-            $msg->{'render_time'} = int(Time::HiRes::tv_interval($t0) * 1000); # in milliseconds
+                $msg = $msg->reply();
+                $msg->{'render_time'} = int(Time::HiRes::tv_interval($t0) * 1000); # in milliseconds
 
-            ::syslog('debug', 'sending response: %s', $msg->to_s()) if ($Tirex::DEBUG);
+                ::syslog('debug', 'sending response: %s', $msg->to_s()) if ($Tirex::DEBUG);
+            }
+            else
+            {
+                ::syslog('err', 'backend error');
+                $msg = $msg->reply('ERROR_BACKEND', 'The backend failed to produce a meta tile');
+            }
         }
         else
         {


=====================================
lib/Tirex/Config.pm
=====================================
@@ -72,6 +72,10 @@ sub parse_line
     {
         $confhash->{$prefix.$1} = $2;
     }
+    elsif ($line =~ /^([a-z0-9_]+)\s*=\s*"(\S*)"\s*$/)
+    {
+        $confhash->{$prefix.$1} = $2;
+    }
     elsif ($line =~ /^([a-z0-9_]+)\s+(.*?)\s*$/)
     {
         my $obj = $1;



View it on GitLab: https://salsa.debian.org/debian-gis-team/tirex/-/compare/0bcbd2725e711ab214a4b21ca8968250e3ef84ea...36ca10a594eba932b9ccadf7e5b7ec77a8ffc974

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/tirex/-/compare/0bcbd2725e711ab214a4b21ca8968250e3ef84ea...36ca10a594eba932b9ccadf7e5b7ec77a8ffc974
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20240228/abed7052/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list