예제 #1
0
    def handle_wi(self, wi):
        if not wi.params.source or not wi.params.target:
            raise RuntimeError(
                "Missing mandatory parameters source and target")
        if not wi.fields.msg:
            wi.fields.msg = []

        for repo in self.obs.getProjectRepositories(wi.params.source):
            if repo in wi.fields.exclude_repos:
                continue
            else:
                src_url = "%s/%s/%s" % (
                    self.reposerver, wi.params.source.replace(":", ":/"), repo)
                break
        for repo in self.obs.getProjectRepositories(wi.params.target):
            if repo in wi.fields.exclude_repos:
                continue
            else:
                trg_url = "%s/%s/%s" % (
                    self.reposerver, wi.params.target.replace(":", ":/"), repo)
                break

        self.log.info("urls: %s and %s" % (src_url, trg_url))

        if wi.params.mode == "short":
            report = repo_diff.generate_short_diff([src_url], [trg_url])
        elif wi.params.mode == "long":
            report = repo_diff.generate_report([src_url], [trg_url])
        else:
            raise RuntimeError("unknown report mode %s" % wi.params.mode)

        wi.result = True
        if report:
            self.log.info(report)
            wi.result = False
            wi.fields.msg.append(
                "Changes in project %s compared to %s, please check." %
                (wi.params.source, wi.params.target))
            wi.fields.msg.extend(report.split("\n"))

        short_diff = repo_diff.short_diff([src_url], [trg_url])
        if short_diff:
            wi.fields.repodiff = {
                'src_project': wi.params.source,
                'tgt_project': wi.params.target,
                'diff': short_diff
            }
    def handle_wi(self, wi):
        if not wi.params.source or not wi.params.target:
            raise RuntimeError("Missing mandatory parameters source and target")
        if not wi.fields.msg:
            wi.fields.msg = []

        for repo in self.obs.getProjectRepositories(wi.params.source):
            if repo in wi.fields.exclude_repos:
                continue
            else:
                src_url = "%s/%s/%s" % ( self.reposerver, wi.params.source.replace(":",":/"), repo)
                break
        for repo in self.obs.getProjectRepositories(wi.params.target):
            if repo in wi.fields.exclude_repos:
                continue
            else:
                trg_url = "%s/%s/%s" % ( self.reposerver, wi.params.target.replace(":",":/"), repo)
                break

        self.log.info("urls: %s and %s" % (src_url, trg_url))

        if wi.params.mode == "short":
            report = repo_diff.generate_short_diff([src_url], [trg_url])
        elif wi.params.mode == "long":
            report = repo_diff.generate_report([src_url], [trg_url])
        else:
            raise RuntimeError("unknown report mode %s" % wi.params.mode)

        wi.result = True
        if report:
            self.log.info(report)
            wi.result = False
            wi.fields.msg.append("Changes in project %s compared to %s, please check." % (wi.params.source, wi.params.target))
            wi.fields.msg.extend(report.split("\n"))

        short_diff = repo_diff.short_diff([src_url], [trg_url])
        if short_diff:
            wi.fields.repodiff = {'src_project':wi.params.source,
                                  'tgt_project':wi.params.target,
                                  'diff':short_diff}
예제 #3
0
    opts.archlist = archlist

    return opts


if __name__ == "__main__":
    if not sys.stdout.isatty():
        import codecs, locale
        sys.stdout = codecs.getwriter(locale.getpreferredencoding())(
            sys.stdout)

    opts = parseArgs()

    try:
        if opts.short:
            report = repo_diff.generate_short_diff(opts.new, opts.old)
        else:
            report = repo_diff.generate_report(opts.new,
                                               opts.old,
                                               quiet=opts.quiet,
                                               archlist=opts.archlist,
                                               size=opts.size,
                                               rebuilds=opts.rebuilds,
                                               commits=opts.commits)
    except RuntimeError, e:
        print e
        sys.exit(1)

    print report
    sys.exit(0)
예제 #4
0
    opts.archlist = archlist

    return opts


if __name__ == "__main__":
    if not sys.stdout.isatty():
        import codecs, locale

        sys.stdout = codecs.getwriter(locale.getpreferredencoding())(sys.stdout)

    opts = parseArgs()

    try:
        if opts.short:
            report = repo_diff.generate_short_diff(opts.new, opts.old)
        else:
            report = repo_diff.generate_report(
                opts.new,
                opts.old,
                quiet=opts.quiet,
                archlist=opts.archlist,
                size=opts.size,
                rebuilds=opts.rebuilds,
                commits=opts.commits,
            )
    except RuntimeError, e:
        print e
        sys.exit(1)

    print report