Example #1
0
    def CheckMirror(package):
        naclports.Trace('Checking %s' % package.NAME)
        basename = package.GetArchiveFilename()
        if not basename:
            return

        if basename in listing:
            # already mirrored
            return

        if options.check:
            Log('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)
        Log("Uploading to mirror: %s" % url)
        cmd = [
            'gsutil', 'cp', '-a', 'public-read',
            package.DownloadLocation(), url
        ]
        if options.dry_run:
            Log(cmd)
        else:
            subprocess.check_call(cmd)
Example #2
0
def main(args):
    parser = optparse.OptionParser(description=__doc__)
    parser.add_option('-v',
                      '--verbose',
                      action='store_true',
                      help='Output extra information.')
    options, _ = parser.parse_args(args)
    if options.verbose:
        naclports.Trace.verbose = True
    count = 0

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

        count += 1

    print "Verfied checksums for %d packages" % count
    return 0
Example #3
0
def CmdPkgDownload(package, options):
    """Download sources for given package(s)"""
    package.Download()
Example #4
0
def CmdPkgExtract(package, options):
    """Extact source archive for package(s)"""
    package.Download()
    package.Extract()