jhbuild r1780 - in trunk: . jhbuild jhbuild/commands jhbuild/frontends



Author: fpeters
Date: Sun Jan  6 15:32:47 2008
New Revision: 1780
URL: http://svn.gnome.org/viewvc/jhbuild?rev=1780&view=rev

Log:
* jhbuild/defaults.jhbuildrc, jhbuild/config.py,
jhbuild/commands/base.py, jhbuild/frontends/terminal.py: added a quiet
mode, activated by the quiet_mode variable in configuration variable or
the -q/--quiet flag to build and buildone commands.  (closes: #503925)



Modified:
   trunk/ChangeLog
   trunk/jhbuild/commands/base.py
   trunk/jhbuild/config.py
   trunk/jhbuild/defaults.jhbuildrc
   trunk/jhbuild/frontends/terminal.py

Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog	(original)
+++ trunk/ChangeLog	Sun Jan  6 15:32:47 2008
@@ -1,5 +1,12 @@
 2008-01-06  Frederic Peters  <fpeters 0d be>
 
+	* jhbuild/defaults.jhbuildrc, jhbuild/config.py,
+	jhbuild/commands/base.py, jhbuild/frontends/terminal.py: added a quiet
+	mode, activated by the quiet_mode variable in configuration variable or
+	the -q/--quiet flag to build and buildone commands.  (closes: #503925)
+
+2008-01-06  Frederic Peters  <fpeters 0d be>
+
 	* jhbuild/modtypes/tarball.py: made Tarball module type a thin wrapper
 	around Autotools module type and Tarball repository type; thus removing
 	a lot of duplicated code.

Modified: trunk/jhbuild/commands/base.py
==============================================================================
--- trunk/jhbuild/commands/base.py	(original)
+++ trunk/jhbuild/commands/base.py	Sun Jan  6 15:32:47 2008
@@ -132,6 +132,9 @@
             make_option('-n', '--no-network',
                         action='store_true', dest='nonetwork', default=False,
                         help='skip version control update'),
+            make_option('-q', '--quiet',
+                        action='store_true', dest='quiet', default=False,
+                        help='quiet (no output)'),
             make_option('-s', '--skip', metavar='MODULES',
                         action='append', dest='skip', default=[],
                         help='treat the given modules as up to date'),
@@ -173,6 +176,8 @@
             config.trycheckout = True
         if options.nopoison:
             config.nopoison = True
+        if options.quiet:
+            config.quiet_mode = True
 
         module_set = jhbuild.moduleset.load(config)
         module_list = module_set.get_module_list(args or config.modules,
@@ -213,6 +218,9 @@
             make_option('-n', '--no-network',
                         action='store_true', dest='nonetwork', default=False,
                         help='skip version control update'),
+            make_option('-q', '--quiet',
+                        action='store_true', dest='quiet', default=False,
+                        help='quiet (no output)'),
             make_option('-D', metavar='DATE-SPEC',
                         action='store', dest='sticky_date', default=None,
                         help='set a sticky date when checking out modules'),
@@ -236,6 +244,8 @@
             config.sticky_date = options.sticky_date
         if options.noxvfb is not None:
             config.noxvfb = options.noxvfb
+        if options.quiet:
+            config.quiet_mode = True
 
         module_set = jhbuild.moduleset.load(config)
         try:

Modified: trunk/jhbuild/config.py
==============================================================================
--- trunk/jhbuild/config.py	(original)
+++ trunk/jhbuild/config.py	Sun Jan  6 15:32:47 2008
@@ -38,7 +38,7 @@
                 'tarballdir', 'pretty_print', 'svn_program', 'makedist',
                 'makedistcheck', 'nonotify', 'cvs_program',
                 'checkout_mode', 'copy_dir', 'module_checkout_mode',
-                'build_policy', 'trycheckout', 'nopoison']
+                'build_policy', 'trycheckout', 'nopoison', 'quiet_mode']
 
 env_prepends = {}
 def prependpath(envvar, path):

Modified: trunk/jhbuild/defaults.jhbuildrc
==============================================================================
--- trunk/jhbuild/defaults.jhbuildrc	(original)
+++ trunk/jhbuild/defaults.jhbuildrc	Sun Jan  6 15:32:47 2008
@@ -56,6 +56,7 @@
 nopoison      = False  # don't poison modules on failure
 
 interact      = True   # whether to interact with the user.
+quiet_mode    = False  # whether to display running commands output
 
 # checkout modes. For VCS directories, it specifies how the checkout
 # is done. We can also specify checkout modes for specific modules

Modified: trunk/jhbuild/frontends/terminal.py
==============================================================================
--- trunk/jhbuild/frontends/terminal.py	(original)
+++ trunk/jhbuild/frontends/terminal.py	Sun Jan  6 15:32:47 2008
@@ -102,11 +102,9 @@
             pretty_command = command
         else:
             pretty_command = ' '.join(command)
-        print pretty_command
 
-        # get rid of hint if pretty printing is disabled.
-        if not self.config.pretty_print:
-            hint = None
+        if not self.config.quiet_mode:
+            print pretty_command
 
         kws['stdin'] = subprocess.PIPE
         if hint in ('cvs', 'svn', 'hg-update.py'):
@@ -116,6 +114,10 @@
             kws['stdout'] = None
             kws['stderr'] = None
 
+        if self.config.quiet_mode:
+            kws['stdout'] = subprocess.PIPE
+            kws['stderr'] = subprocess.STDOUT
+
         if cwd is not None:
             kws['cwd'] = cwd
 
@@ -129,12 +131,24 @@
             sys.stderr.write('Error: %s\n' % str(e))
             raise CommandError(str(e))
 
+        output = []
         if hint in ('cvs', 'svn', 'hg-update.py'):
             conflicts = []
-            def format_line(line, error_output, conflicts=conflicts):
-                if line[-1] == '\n': line = line[:-1]
+            def format_line(line, error_output, conflicts = conflicts, output = output):
                 if line.startswith('C '):
                     conflicts.append(line)
+
+                if self.config.quiet_mode:
+                    output.append(line)
+                    return
+
+                if line[-1] == '\n': line = line[:-1]
+                if not self.config.pretty_print:
+                    hint = None
+                    print line
+                    return
+
+                if line.startswith('C '):
                     print '%s%s%s' % (t_colour[12], line, t_reset)
                 elif line.startswith('M '):
                     print '%s%s%s' % (t_colour[10], line, t_reset)
@@ -142,6 +156,7 @@
                     print '%s%s%s' % (t_colour[8], line, t_reset)
                 else:
                     print line
+
             cmds.pprint_output(p, format_line)
             if conflicts:
                 sys.stdout.write('\nConflicts during checkout:\n')
@@ -150,6 +165,10 @@
                                      % (t_colour[12], line, t_reset))
                 # make sure conflicts fail
                 if p.returncode == 0 and hint == 'cvs': p.returncode = 1
+        elif self.config.quiet_mode:
+            def format_line(line, error_output, output = output):
+                output.append(line)
+            cmds.pprint_output(p, format_line)
         else:
             try:
                 p.communicate()
@@ -160,6 +179,8 @@
                     # process might already be dead.
                     pass
         if p.wait() != 0:
+            if self.config.quiet_mode:
+                print ''.join(output)
             raise CommandError('########## Error running %s' % pretty_command, p.returncode)
 
     def start_phase(self, module, state):



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