def make_report(destdir, source_repo, binary_repo=None): repo = Repository(source_repo) printu(_("Scanning source repository...\n")) repo.scan() if binary_repo: printu(_("Scanning binary packages...\n")) repo.scan_bins(binary_repo) html = HTML(destdir) repo.report_html(html) for p in packagers.values(): p.report_html(html) for p in packages.values(): p.report_html(html) for p in sources.values(): p.report_html(html)
def processPisi(self, path): p = pisi.package.Package(path) p.extract_files(["metadata.xml", "files.xml"], ".") md = pisi.metadata.MetaData() md.read("metadata.xml") self.total_installed_size += md.package.installedSize if packages.has_key(md.package.name): # FIXME: check version/release match too? packages[md.package.name].installed_size = md.package.installedSize else: printu("Binary package '%s' has no source package in repository %s\n" % (path, self.path)) fd = pisi.files.Files() fd.read("files.xml") for f in fd.list: if self.installed_sizes.has_key(f.type): # Emtpy directories and symlinks has None size if not f.size is None: self.installed_sizes[f.type] += int(f.size) else: self.installed_sizes[f.type] = int(f.size)
def __init__(self): # first construct a parser for common options # this is really dummy self.parser = PreParser(version="%prog " + pisi.__version__) try: args = self.parser.parse_args() if len(args)==0: # more explicit than using IndexError printu(_('No command given')) self.die() cmd_name = args[0] except ParserError: printu(_('Command line parsing error')) self.die() self.command = Command.get_command(cmd_name) if not self.command: printu(_("Unrecognized command: %s") % cmd_name) self.die()
def usage(): printu(_("Usage: repostats.py [OPTIONS] source-repo-path [binary-repo-path]\n")) printu(" -t, --test-only: %s" % _("Dont generate the web site.\n")) sys.exit(0)
except: usage() if args == []: usage() do_web = True for o, v in opts: if o in ("-h", "--help"): usage() if o in ("-t", "--test-only"): do_web = False repo = Repository(args[0]) printu(_("Scanning source repository...\n")) repo.scan() if len(args) > 1: printu(_("Scanning binary packages...\n")) repo.scan_bins(args[1]) if errors: printu("***\n") printu(_("Encountered %d errors! Fix them immediately!\n") % len(errors)) for e in errors: printu(e) printu("\n") printu("\n") printu("***\n")
def report(self): printu(_("Repository Statistics:\n")) # general stats printu(_(" Total of %d source packages, and %d binary packages.\n") % ( self.nr_sources, self.nr_packages)) printu(_(" There are %d patches applied.\n") % self.nr_patches) # problems if missing: printu(_(" Missing packages (%d):\n") % len(missing)) for m in missing.values(): printu(" %s\n" % m.name) # trivia printu(_(" Top five most patched source:\n")) for p in self.mostpatched.get_list(5): printu(" %4d %s\n" % (p[1], p[0])) printu(_(" Top five longest action.py scripts:\n")) for p in self.longpy.get_list(5): printu(" %4d %s\n" % (p[1], p[0])) # lists printu(_(" COMAR scripts:\n")) for cs in self.cscripts.get_list(): printu(" %4d %s\n" % (cs[1], cs[0])) people = self.people.get_list() printu(_(" Packagers (%d):\n") % len(people)) for p in people: printu(" %4d %s\n" % (p[1], p[0])) licenses = self.licenses.get_list() printu(_(" Licenses (%d):\n") % len(licenses)) for p in licenses: printu(" %4d %s\n" % (p[1], p[0]))
def report(self): printu(_("Packager: %s <%s>\n") % (self.name, self.email)) if self.errors: printu(_(" Errors:\n")) for e in self.errors: printu(" %s\n" % e) printu(_(" Source packages (%d):\n") % len(self.sources)) for s in self.sources: printu(" %s\n" % s) printu(_(" Updates (%d):\n") % len(self.updates)) for s in self.updates: printu(" %s (%s): %s\n" % s)
except: usage() if args == []: usage() do_web = True for o, v in opts: if o in ("-h", "--help"): usage() if o in ("-t", "--test-only"): do_web = False repo = Repository(args[0]) printu(_("Scanning source repository...\n")) repo.scan() if len(args) > 1: printu(_("Scanning binary packages...\n")) repo.scan_bins(args[1]) if do_web: if not os.path.exists("paksite/packager"): os.makedirs("paksite/packager") if not os.path.exists("paksite/binary"): os.makedirs("paksite/binary") if not os.path.exists("paksite/source"): os.makedirs("paksite/source") file("paksite/stil.css", "w").write(css_template)
def usage(): printu(_("Usage: repostats.py [OPTIONS] source-repo-path [binary-repo-path]\n")) printu(" -o, --output <dir> %s\n" % _("HTML output directory.")) sys.exit(0)
def die(self): printu('\n' + self.parser.format_help()) sys.exit(1)
def usage(): printu( _("Usage: repostats.py [OPTIONS] source-repo-path [binary-repo-path]\n" )) printu(" -o, --output <dir> %s\n" % _("HTML output directory.")) sys.exit(0)
"missing": "\n".join(miss), "errors": e } template_write("paksite/index.html", "repo", dict) srclist = map(lambda x: "<a href='./source-%s.html'>%s</a>" % (x, x), sources) srclist.sort() dict = { "source_list": "<br>".join(srclist) } template_write("paksite/sources.html", "sources", dict) # command line driver if len(sys.argv) < 2: printu(_("Usage: repostats.py source-repo-path [ command [arg] ]\n")) sys.exit(0) repo = Repository(sys.argv[1]) printu(_("Scanning source repository...\n")) repo.scan() if errors: printu("***\n") printu(_("Encountered %d errors! Fix them immediately!\n") % len(errors)) for e in errors: printu(e) printu("\n") printu("***\n") if len(sys.argv) > 2:
def report(self): source = self.source.spec.source printu(_("Binary package: %s\n") % self.name) printu(_(" Version %s release %s\n") % (source.version, source.release)) printu(_(" Packager: %s <%s>\n") % ( source.packager.name, source.packager.email)) printu(_(" Build dependencies:\n")) for d in source.buildDeps: printu(" %s\n" % d.package) printu(_(" Runtime dependencies:\n")) for d in self.pakspec.runtimeDeps: printu(" %s\n" % d.package) if self.revBuildDeps: printu(_(" Reverse build dependencies:\n")) for d in self.revBuildDeps: printu(" %s\n" % d) if self.revRuntimeDeps: printu(_(" Reverse runtime dependencies:\n")) for d in self.revRuntimeDeps: printu(" %s\n" % d)
def die(self): #raise Error('') printu('\n' + self.parser.format_help()) sys.exit(1)