Пример #1
0
def main(argv):
    parser = argparse.ArgumentParser(
        description='Produce archive of generated sources')
    parser.add_argument('outputfile', help='File to write output to')
    args = parser.parse_args(argv)

    objdir_abspath = mozpath.abspath(buildconfig.topobjdir)

    def is_valid_entry(entry):
        if isinstance(entry[1], BaseFile):
            entry_abspath = mozpath.abspath(entry[1].path)
        else:
            entry_abspath = mozpath.abspath(entry[1])
        if not entry_abspath.startswith(objdir_abspath):
            print("Warning: omitting generated source [%s] from archive" % entry_abspath,
                  file=sys.stderr)
            return False
        return True

    files = dict(filter(is_valid_entry, get_generated_sources()))
    with open(args.outputfile, 'wb') as fh:
        create_tar_gz_from_files(fh, files, compresslevel=5)
Пример #2
0
def main():
    parser = OptionParser(
        usage=
        "usage: %prog [options] <dump_syms binary> <symbol store path> <debug info files>"
    )
    parser.add_option(
        "-c",
        "--copy",
        action="store_true",
        dest="copy_debug",
        default=False,
        help=
        "Copy debug info files into the same directory structure as symbol files"
    )
    parser.add_option(
        "-a",
        "--archs",
        action="store",
        dest="archs",
        help=
        "Run dump_syms -a <arch> for each space separated cpu architecture in ARCHS (only on OS X)"
    )
    parser.add_option(
        "-s",
        "--srcdir",
        action="append",
        dest="srcdir",
        default=[],
        help="Use SRCDIR to determine relative paths to source files")
    parser.add_option(
        "-v",
        "--vcs-info",
        action="store_true",
        dest="vcsinfo",
        help="Try to retrieve VCS info for each FILE listed in the output")
    parser.add_option(
        "-i",
        "--source-index",
        action="store_true",
        dest="srcsrv",
        default=False,
        help=
        "Add source index information to debug files, making them suitable for use in a source server."
    )
    parser.add_option("--install-manifest",
                      action="append",
                      dest="install_manifests",
                      default=[],
                      help="""Use this install manifest to map filenames back
to canonical locations in the source repository. Specify
<install manifest filename>,<install destination> as a comma-separated pair.
""")
    (options, args) = parser.parse_args()

    #check to see if the pdbstr.exe exists
    if options.srcsrv:
        pdbstr = os.environ.get("PDBSTR_PATH")
        if not os.path.exists(pdbstr):
            print(
                "Invalid path to pdbstr.exe - please set/check PDBSTR_PATH.\n",
                file=sys.stderr)
            sys.exit(1)

    if len(args) < 3:
        parser.error("not enough arguments")
        exit(1)

    try:
        manifests = validate_install_manifests(options.install_manifests)
    except (IOError, ValueError) as e:
        parser.error(str(e))
        exit(1)
    file_mapping = make_file_mapping(manifests)
    # Any paths that get compared to source file names need to go through normpath.
    generated_files = {
        normpath(os.path.join(buildconfig.topobjdir, f)): f
        for (f, _) in get_generated_sources()
    }
    _, bucket = get_s3_region_and_bucket()
    dumper = GetPlatformSpecificDumper(dump_syms=args[0],
                                       symbol_path=args[1],
                                       copy_debug=options.copy_debug,
                                       archs=options.archs,
                                       srcdirs=options.srcdir,
                                       vcsinfo=options.vcsinfo,
                                       srcsrv=options.srcsrv,
                                       generated_files=generated_files,
                                       s3_bucket=bucket,
                                       file_mapping=file_mapping)

    dumper.Process(args[2])