Changeset 4727c3e in rtems-source-builder


Ignore:
Timestamp:
04/02/20 04:29:31 (3 years ago)
Author:
Gedare Bloom <gedare@…>
Branches:
5, master
Children:
ad90540
Parents:
113c65c
git-author:
Gedare Bloom <gedare@…> (04/02/20 04:29:31)
git-committer:
Gedare Bloom <gedare@…> (04/05/20 04:11:00)
Message:

sb/reports: add sanitize parameter enabled for --mail

Adds a --sanitize option to command line for reports.py
and also for the reports.report() interface from setbuilder.py
to remove the Remotes information from git.

Closes #3887.

Location:
source-builder/sb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • source-builder/sb/reports.py

    r113c65c r4727c3e  
    242242            self.line('')
    243243            rc = 1
    244             for r in remotes:
    245                 if 'url' in remotes[r]:
    246                     text = remotes[r]['url']
    247                 else:
    248                     text = 'no URL found'
    249                 self.line('%d. %s: %s' % (rc, r, text))
    250                 rc += 1
     244            if not remotes:
     245                self.line('[ remotes removed, contact sender for details ]')
     246            else:
     247                for r in remotes:
     248                    if 'url' in remotes[r]:
     249                        text = remotes[r]['url']
     250                    else:
     251                        text = 'no URL found'
     252                    self.line('%d. %s: %s' % (rc, r, text))
     253                    rc += 1
    251254            self.line('')
    252255            self.line(self._strong('Status:'))
     
    428431            self.line('%s Remotes:' % (self.cini))
    429432            rc = 0
    430             for r in remotes:
    431                 rc += 1
    432                 if 'url' in remotes[r]:
    433                     text = remotes[r]['url']
    434                 else:
    435                     text = 'no URL found'
    436                 text = '%s: %s' % (r, text)
    437                 self.line('%s  %2d: %s' % (self.cini, rc, text))
     433            if not remotes:
     434                self.line('[ remotes removed, contact sender for details ]')
     435            else:
     436                for r in remotes:
     437                    rc += 1
     438                    if 'url' in remotes[r]:
     439                        text = remotes[r]['url']
     440                    else:
     441                        text = 'no URL found'
     442                    text = '%s: %s' % (r, text)
     443                    self.line('%s  %2d: %s' % (self.cini, rc, text))
    438444            self.line('%s Status:' % (self.cini))
    439445            if dirty:
     
    604610    """Report the build details about a package given a config file."""
    605611
    606     def __init__(self, formatter, _configs, opts, macros = None):
     612    def __init__(self, formatter, sanitize, _configs, opts, macros = None):
    607613        if type(formatter) == str:
    608614            if formatter == 'text':
     
    622628        self.configs = _configs
    623629        self.opts = opts
     630        self.sanitize = sanitize
    624631        if macros is None:
    625632            self.macros = opts.defaults
     
    650657    def git_status(self):
    651658        r = git.repo('.', self.opts, self.macros)
    652         self.formatter.git_status(r.valid(), r.dirty(), r.head(), r.remotes())
     659        if self.sanitize:
     660            self.formatter.git_status(r.valid(), r.dirty(), r.head(), None)
     661        else:
     662            self.formatter.git_status(r.valid(), r.dirty(), r.head(), r.remotes())
    653663
    654664    def introduction(self, name, intro_text = None):
     
    893903                    '--list-configs': 'List available configurations',
    894904                    '--format':       'Output format (text, html, markdown, ini, xml)',
    895                     '--output':       'File name to output the report' }
     905                    '--output':       'File name to output the report',
     906                    '--sanitize':     'Remove Remotes information from report'}
    896907        opts = options.load(args, optargs, logfile = False)
    897908        if opts.get_arg('--output') and len(opts.params()) > 1:
     
    923934                else:
    924935                    raise error.general('invalid format: %s' % (format_opt[1]))
    925             r = report(formatter, configs, opts)
     936            sanitize = False
     937            if opts.get_arg('--sanitize'):
     938                sanitize = True
     939            r = report(formatter, sanitize, configs, opts)
    926940            for _config in opts.params():
    927941                if output is None:
  • source-builder/sb/setbuilder.py

    r113c65c r4727c3e  
    190190                else:
    191191                    outname = None
    192                 r = reports.report(format, self.configs,
     192                r = reports.report(format, False, self.configs,
    193193                                   copy.copy(opts), copy.copy(macros))
    194194                r.introduction(_build.config.file_name())
     
    200200                del r
    201201            if mail:
    202                 r = reports.report('text', self.configs,
     202                r = reports.report('text', True, self.configs,
    203203                                   copy.copy(opts), copy.copy(macros))
    204204                r.introduction(_build.config.file_name())
Note: See TracChangeset for help on using the changeset viewer.