def IsInstallable(self): """Determine if a binary package can be installed in the currently configured SDK. Currently only packages built with the same SDK major version are installable. """ return self.BUILD_SDK_VERSION == naclports.GetSDKVersion()
def InstalledInfoContents(self): """Generate content of the .info file to install based on source pkg_info file and current build configuration.""" with open(self.info) as f: info_content = f.read() info_content += 'BUILD_CONFIG=%s\n' % self.config.config_name info_content += 'BUILD_ARCH=%s\n' % self.config.arch info_content += 'BUILD_TOOLCHAIN=%s\n' % self.config.toolchain info_content += 'BUILD_SDK_VERSION=%s\n' % naclports.GetSDKVersion() return info_content
def Installable(self, package_name, config): """Returns True if the index contains the given package and it is installable in the currently configured SDK.""" info = self.packages.get((package_name, config)) if not info: return False version = naclports.GetSDKVersion() if info['BUILD_SDK_VERSION'] != version: naclports.Trace('Prebuilt package was built with different SDK version: ' '%s vs %s' % (info['BUILD_SDK_VERSION'], version)) return False return True
def main(args): parser = argparse.ArgumentParser(description=__doc__) parser.add_argument('revision', metavar='REVISION', help='naclports revision to to scan for.') parser.add_argument('-v', '--verbose', action='store_true', help='Output extra information.') parser.add_argument('-l', '--cache-listing', action='store_true', help='Cached output of gsutil -le (for testing).') parser.add_argument('--skip-md5', action='store_true', help='Assume on-disk files are up-to-date (for testing).') args = parser.parse_args(args) if args.verbose: naclports.SetVerbose(True) sdk_version = naclports.GetSDKVersion() Log('Scanning packages built for pepper_%s at revsion %s' % (sdk_version, args.revision)) base_path = '%s/builds/pepper_%s/%s/packages' % (naclports.GS_BUCKET, sdk_version, args.revision) gs_url = 'gs://' + base_path listing_file = os.path.join(naclports.NACLPORTS_ROOT, 'lib', 'listing.txt') if args.cache_listing and os.path.exists(listing_file): Log('Using pre-cached gs listing: %s' % listing_file) with open(listing_file) as f: listing = f.read() else: Log("Searching for packages at: %s" % gs_url) cmd = ['gsutil', 'ls', '-le', gs_url] Trace("Running: %s" % str(cmd)) try: listing = subprocess.check_output(cmd) except subprocess.CalledProcessError as e: naclports.Error(e) return 1 all_files = ParseGsUtilLs(listing) if args.cache_listing and not os.path.exists(listing_file): with open(listing_file, 'w') as f: f.write(listing) Log('Found %d packages [%s]' % (len(all_files), FormatSize(sum(f.size for f in all_files)))) binaries = DownloadFiles(all_files, not args.skip_md5) index_file = os.path.join(naclports.NACLPORTS_ROOT, 'lib', 'prebuilt.txt') Log('Generating %s' % index_file) naclports.package_index.WriteIndex(index_file, binaries) Log('Done') return 0
def main(args): usage = 'Usage: %proc [options] <revision>' parser = optparse.OptionParser(description=__doc__, usage=usage) parser.add_option('-v', '--verbose', action='store_true', help='Output extra information.') parser.add_option('-l', '--cache-listing', action='store_true', help='Cached output of gsutil -le (for testing).') parser.add_option('--skip-md5', action='store_true', help='Assume on-disk files are up-to-date (for testing).') options, args = parser.parse_args(args) if options.verbose: naclports.verbose = True if len(args) != 1: parser.error('Expected exactly one argument. See --help.') ports_revision = args[0] sdk_version = naclports.GetSDKVersion() Log('Scanning packages built for pepper_%s at revsion %s' % (sdk_version, ports_revision)) base_path = '%s/builds/pepper_%s/%s/packages' % (naclports.GS_BUCKET, sdk_version, ports_revision) gs_url = 'gs://' + base_path listing_file = os.path.join(naclports.NACLPORTS_ROOT, 'lib', 'listing.txt') if options.cache_listing and os.path.exists(listing_file): Log('Using pre-cached gs listing: %s' % listing_file) with open(listing_file) as f: listing = f.read() else: try: listing = subprocess.check_output(['gsutil', 'ls', '-le', gs_url]) except subprocess.CalledProcessError as e: naclports.Error(e) return 1 all_files = ParseGsUtilLs(listing) if options.cache_listing and not os.path.exists(listing_file): with open(listing_file, 'w') as f: f.write(listing) Log('Found %d packages [%s]' % (len(all_files), FormatSize(sum(f.size for f in all_files)))) binaries = DownloadFiles(all_files, not options.skip_md5) index_file = os.path.join(naclports.NACLPORTS_ROOT, 'lib', 'prebuilt.txt') Log('Generating %s' % index_file) naclports.package_index.WriteIndex(index_file, binaries) Log('Done') return 0