[PATCH] sb/setbuilder: do not include remotes in mailed reports

Gedare Bloom gedare at rtems.org
Thu Apr 2 04:35:07 UTC 2020


I couldn't test this patch successfully, the "Mailing report" step
hung for me without a good SMTP server to test it with.

On Wed, Apr 1, 2020 at 10:33 PM Gedare Bloom <gedare at rtems.org> wrote:
>
> Closes #3887.
> ---
>  source-builder/sb/reports.py    | 47 ++++++++++++++++++++-------------
>  source-builder/sb/setbuilder.py |  2 +-
>  2 files changed, 29 insertions(+), 20 deletions(-)
>
> diff --git a/source-builder/sb/reports.py b/source-builder/sb/reports.py
> index ab20671..2f72088 100644
> --- a/source-builder/sb/reports.py
> +++ b/source-builder/sb/reports.py
> @@ -241,13 +241,16 @@ class markdown_formatter(formatter):
>              self.line(self._strong('Remotes:'))
>              self.line('')
>              rc = 1
> -            for r in remotes:
> -                if 'url' in remotes[r]:
> -                    text = remotes[r]['url']
> -                else:
> -                    text = 'no URL found'
> -                self.line('%d. %s: %s' % (rc, r, text))
> -                rc += 1
> +            if not remotes:
> +                self.line('[ removed for email, reply to sender for details ]')
> +            else:
> +                for r in remotes:
> +                    if 'url' in remotes[r]:
> +                        text = remotes[r]['url']
> +                    else:
> +                        text = 'no URL found'
> +                    self.line('%d. %s: %s' % (rc, r, text))
> +                    rc += 1
>              self.line('')
>              self.line(self._strong('Status:'))
>              self.line('')
> @@ -427,14 +430,17 @@ class text_formatter(formatter):
>          if valid:
>              self.line('%s Remotes:' % (self.cini))
>              rc = 0
> -            for r in remotes:
> -                rc += 1
> -                if 'url' in remotes[r]:
> -                    text = remotes[r]['url']
> -                else:
> -                    text = 'no URL found'
> -                text = '%s: %s' % (r, text)
> -                self.line('%s  %2d: %s' % (self.cini, rc, text))
> +            if not remotes:
> +                self.line('[ removed for email, reply to sender for details ]')
> +            else:
> +                for r in remotes:
> +                    rc += 1
> +                    if 'url' in remotes[r]:
> +                        text = remotes[r]['url']
> +                    else:
> +                        text = 'no URL found'
> +                    text = '%s: %s' % (r, text)
> +                    self.line('%s  %2d: %s' % (self.cini, rc, text))
>              self.line('%s Status:' % (self.cini))
>              if dirty:
>                  self.line('%s  Repository is dirty' % (self.cini))
> @@ -647,17 +653,20 @@ class report:
>      def release_status(self):
>          self.formatter.release_status(version.string())
>
> -    def git_status(self):
> +    def git_status(self, sanitize = False):
>          r = git.repo('.', self.opts, self.macros)
> -        self.formatter.git_status(r.valid(), r.dirty(), r.head(), r.remotes())
> +        if sanitize:
> +            self.formatter.git_status(r.valid(), r.dirty(), r.head(), None)
> +        else:
> +            self.formatter.git_status(r.valid(), r.dirty(), r.head(), r.remotes())
>
> -    def introduction(self, name, intro_text = None):
> +    def introduction(self, name, intro_text = None, sanitize = False):
>          now = datetime.datetime.now().ctime()
>          self.formatter.introduction(name, now, intro_text)
>          if version.released():
>              self.release_status()
>          else:
> -            self.git_status()
> +            self.git_status(sanitize)
>
>      def epilogue(self, name):
>          self.formatter.epilogue(name)
> diff --git a/source-builder/sb/setbuilder.py b/source-builder/sb/setbuilder.py
> index 7b80817..9367d55 100644
> --- a/source-builder/sb/setbuilder.py
> +++ b/source-builder/sb/setbuilder.py
> @@ -201,7 +201,7 @@ class buildset:
>              if mail:
>                  r = reports.report('text', self.configs,
>                                     copy.copy(opts), copy.copy(macros))
> -                r.introduction(_build.config.file_name())
> +                r.introduction(_build.config.file_name(), sanitize = True)
>                  r.generate(_build.config.file_name())
>                  r.epilogue(_build.config.file_name())
>                  self.write_mail_report(r.get_output())
> --
> 2.17.1
>


More information about the devel mailing list