Example #1
0
def FixupCanned(partitions):
    all_projects = [p for p in naclports.PackageIterator()]
    all_names = [p.basename for p in all_projects if not p.DISABLED]

    # Blank the last partition and fill it with anything not in the first two.
    partitions[-1] = []
    covered = set()
    for partition in partitions[:-1]:
        for item in partition:
            covered.add(item)

    for item in all_names:
        if item not in covered:
            partitions[-1].append(item)

    # Order by dependencies.
    partitions[-1] = GetBuildOrder(partitions[-1])

    # Check that all the items still exist.
    for i, partition in enumerate(partitions):
        for item in partition:
            if item not in all_names:
                raise Error('non-existent package in partion %d: %s' %
                            (i, item))

    # Check that partitions include all of their dependencies.
    for i, partition in enumerate(partitions):
        deps = GetDependencies(partition)
        for dep in deps:
            if not dep in partition:
                raise Error('dependency missing from partition %d: %s' %
                            (i, dep))

    return partitions
Example #2
0
def main(args):
    global options
    parser = optparse.OptionParser()
    parser.add_option('-v',
                      '--verbose',
                      action='store_true',
                      help='Output extra information.')
    options, _ = parser.parse_args(args)
    count = 0

    package_names = [
        os.path.basename(p.root) for p in naclports.PackageIterator()
    ]

    for package in naclports.PackageIterator():
        if not package.CheckDeps(package_names):
            return 1
        count += 1

    print "Verfied dependencies for %d packages" % count
    return 0
Example #3
0
def main(args):
    global options
    parser = optparse.OptionParser()
    parser.add_option('-v',
                      '--verbose',
                      action='store_true',
                      help='Output extra information.')
    options, _ = parser.parse_args(args)
    rtn = 0

    for package in naclports.PackageIterator():
        rtn |= CheckLicense(package)

    return rtn
Example #4
0
def main(args):
    parser = optparse.OptionParser()
    parser.add_option('-n',
                      '--dry-run',
                      action='store_true',
                      help="Don't actually upload anything")
    parser.add_option('--check',
                      action='store_true',
                      help="Verify that the mirror is up-to-date.")
    options, _ = parser.parse_args(args)

    ports_root = os.path.dirname(SCRIPT_DIR)
    listing = subprocess.check_output(['gsutil', 'ls', MIRROR_GS])
    listing = listing.splitlines()
    listing = [os.path.basename(l) for l in listing]

    def CheckMirror(package):
        basename = package.GetArchiveFilename()
        if not basename:
            return

        if basename in listing:
            # already mirrored
            return

        if options.check:
            print 'update_mirror: Archive missing from mirror: %s' % basename
            sys.exit(1)

        # Download upstream URL
        package.Download(mirror=False)

        # Upload to gs
        url = '%s/%s' % (MIRROR_GS, basename)
        print "Uploading to mirror: %s" % url
        cmd = [
            'gsutil', 'cp', '-a', 'public-read',
            package.DownloadLocation(), url
        ]
        if options.dry_run:
            print cmd
        else:
            subprocess.check_call(cmd)

    for package in naclports.PackageIterator():
        CheckMirror(package)

    return 0
Example #5
0
def main(args):
    global options
    parser = optparse.OptionParser()
    parser.add_option('-v',
                      '--verbose',
                      action='store_true',
                      help='Output extra information.')
    options, _ = parser.parse_args(args)
    count = 0

    for package in naclports.PackageIterator():
        package.Download()
        if not package.Verify(True):
            return 1

        count = count + 1

    print "Verfied checksums for %d packages" % count
    return 0
Example #6
0
def main(args):
    global options
    parser = optparse.OptionParser()
    parser.add_option('-v',
                      '--verbose',
                      action='store_true',
                      help='Output extra information.')
    options, _ = parser.parse_args(args)
    rtn = False

    count = 0
    for package in naclports.PackageIterator():
        rtn |= CheckLicense(package)
        count += 1

    if not rtn:
        print "Verfied licenses for %d packages" % count

    return rtn
Example #7
0
def main(args):
  parser = optparse.OptionParser()
  parser.add_option('-n', '--dry-run', action='store_true',
                    help="Don't actually upload anything")
  options, _ = parser.parse_args(args)

  ports_root = os.path.dirname(SCRIPT_DIR)
  listing = subprocess.check_output(['gsutil', 'ls', MIRROR_GS])
  listing = listing.splitlines()
  listing = [os.path.basename(l) for l in listing]

  def CheckMirror(package):
    basename = package.GetArchiveFilename()
    if basename in listing:
      # already mirrored
      return

    # Download upstream URL
    print 'Downloading: %s' % package.URL
    remote = urllib.urlopen(package.URL)
    with open(basename, 'w') as tmp:
      tmp.write(remote.read())

    # Upload to gs
    url = '%s/%s' % (MIRROR_GS, basename)
    print "Uploading to mirror: %s" % url
    cmd = ['gsutil', 'cp', '-a', 'public-read', basename, url]
    if options.dry_run:
      print cmd
    else:
      subprocess.check_call(cmd)

  for package in naclports.PackageIterator():
    CheckMirror(package)

  return 0
Example #8
0
def main(args):
    global options
    parser = optparse.OptionParser(description=__doc__)
    parser.add_option('-v',
                      '--verbose',
                      action='store_true',
                      help='Output extra information.')
    options, _ = parser.parse_args(args)
    rtn = 0

    print '#summary List of ports available in naclports.'
    print '= List of available !NaCl ports ='
    print ''
    print 'Port are listed in alphabetical order, with links to the upstream'
    print 'source archive and the patch used when building for !NaCl.'
    print 'This listing is auto-generated by the'
    print '[%s/build_tools/generate_port_list.py generate_port_list.py]' % SRC_URL
    print 'script.'
    print ''
    print('|| *Name* || *Upstream Archive* || *!NaCl Patch* || ' +
          '*Libc* || *Disabled On* ||')
    total = 0
    for package in sorted(naclports.PackageIterator()):
        if not package.URL:
            continue
        patch = os.path.join(package.root, 'nacl.patch')
        if os.path.exists(patch):
            relative_path = os.path.relpath(patch, NACLPORTS_ROOT)
            size = os.path.getsize(patch)
            if size < 1024:
                patch = '[%s/%s %d B]' % (SRC_URL, relative_path, size)
            else:
                patch = '[%s/%s %d KiB]' % (SRC_URL, relative_path,
                                            size / 1024)
        else:
            patch = '_none_'
        url = '[%s %s]' % (package.URL, package.GetArchiveFilename())
        package_url = '[%s/%s %s]' % (
            SRC_URL, os.path.relpath(package.root,
                                     NACLPORTS_ROOT), package.PACKAGE_NAME)
        libc = getattr(package, 'LIBC', '')
        if libc:
            libc += '-only'
        disabled_arch = getattr(package, 'DISABLED_ARCH', '')
        print '|| %-70s || %-70s || %s || %s || %s ||' % (
            package_url, url, patch, libc, disabled_arch)
        total += 1
    print '\n_Total = %d_\n' % total

    print '= Local Ports (not based on upstream sources) =\n'
    total = 0
    for package in naclports.PackageIterator():
        if package.URL:
            continue
        package_url = '[%s/%s %s]' % (
            SRC_URL, os.path.relpath(package.root,
                                     NACLPORTS_ROOT), package.PACKAGE_NAME)
        print '|| %-70s ||' % package_url
        total += 1
    print '\n_Total = %d_\n' % total

    return rtn