[X2Go-Commits] [x2goserver] 20/30: x2goserver/lib/x2goupdateoptionsstring: add debug option and some debugging output.

git-admin at x2go.org git-admin at x2go.org
Thu Dec 13 11:22:48 CET 2018


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository x2goserver.

commit 4971a608244d3e25a13adf9cb154655431719e3a
Author: Mihai Moldovan <ionic at ionic.de>
Date:   Wed Dec 12 10:11:20 2018 +0100

    x2goserver/lib/x2goupdateoptionsstring: add debug option and some debugging output.
---
 debian/changelog                       |  2 ++
 x2goserver/lib/x2goupdateoptionsstring | 31 ++++++++++++++++++++++++++-----
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index d54fd18..6745fc3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -49,6 +49,8 @@ x2goserver (4.1.0.4-0x2go1) UNRELEASED; urgency=medium
     - x2goserver/lib/x2goupdateoptionsstring: write wrapper that handles
       program options, creates intermediate, passes through transform chains,
       reconverts to a string and prints it.
+    - x2goserver/lib/x2goupdateoptionsstring: add debug option and some
+      debugging output.
   * debian/control:
     + Build-depend upon lsb-release for distro version detection.
   * debian/x2goserver.manpages:
diff --git a/x2goserver/lib/x2goupdateoptionsstring b/x2goserver/lib/x2goupdateoptionsstring
index c562974..a88c79d 100755
--- a/x2goserver/lib/x2goupdateoptionsstring
+++ b/x2goserver/lib/x2goupdateoptionsstring
@@ -686,7 +686,8 @@ sub Main {
 
   my $help = 0;
   my $man = 0;
-  GetOptionsFromArray (\@_, 'help|?|h' => \$help, 'man' => \$man) or pod2usage (2);
+  my $debug = 0;
+  GetOptionsFromArray (\@_, 'help|?|h' => \$help, 'man' => \$man, 'debug|d' => \$debug) or pod2usage (2);
 
   if ($help) {
     pod2usage (1);
@@ -714,6 +715,10 @@ sub Main {
     }
   }
 
+  if ($debug) {
+    print {*STDERR} 'Dumping intermediate array after initial parsing: ' . Dumper ($intermediate);
+  }
+
   if (!($error_detected)) {
     my $cur_transform = shift;
 
@@ -728,6 +733,10 @@ sub Main {
         last;
       }
 
+      if ($debug) {
+        print {*STDERR} 'Parsing current raw transformation option: ' . Dumper ($cur_transform);
+      }
+
       my $interpreted_transform_ref = interpret_transform ($cur_transform);
 
       if (!(defined ($interpreted_transform_ref))) {
@@ -738,6 +747,10 @@ sub Main {
 
       my ($transform_mode, $sanitized_transform) = @{$interpreted_transform_ref};
 
+      if ($debug) {
+        print {*STDERR} 'Parsed raw transformation option into mode \'' . $transform_mode . '\' and sanitized transform option \'' . Dumper ($sanitized_transform) . "'\n";
+      }
+
       $intermediate = transform_intermediate ($intermediate, $transform_mode, $sanitized_transform);
 
       if (!(defined ($intermediate))) {
@@ -745,6 +758,10 @@ sub Main {
         $error_detected = 7;
         last;
       }
+
+      if ($debug) {
+        print {*STDERR} 'Dumping transformed intermediate array: ' . Dumper ($intermediate);
+      }
     }} while (defined ($cur_transform = shift));
   }
 
@@ -814,7 +831,7 @@ x2goupdateoptionsstring - X2Go Agent Options String Manipulator
 
 =item B<x2goupdateoptionsstring> B<--man>
 
-=item B<x2goupdateoptionsstring> I<options> [B<->|B<+>]I<key>[B<=>I<value>] ...
+=item B<x2goupdateoptionsstring> [B<--debug>|B<-d>] [B<-->] [B<->|B<+>]I<key>[B<=>I<value>] ...
 
 =back
 
@@ -823,9 +840,9 @@ x2goupdateoptionsstring - X2Go Agent Options String Manipulator
 B<x2goupdateoptionsstring> is a utility for manipulating options strings as
 passed to X2Go Agent/NX Agent.
 
-Called it with the options string as the first parameter and the options you
-want to manipulate as additional parameters. At least one additional parameter
-must be provided.
+Call it with optional flags, the options string as the first parameter and the
+options you want to manipulate as additional parameters. At least one
+additional parameter must be provided.
 
 It can either add, remove or replace components.
 
@@ -851,6 +868,10 @@ Print a brief help message and exits.
 
 Prints the manual page and exits.
 
+=item B<--debug>|B<-d>
+
+Enables noisy debug output.
+
 =back
 
 =head1 EXAMPLE

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2goserver.git


More information about the x2go-commits mailing list