def getNightlyLocalesForChunk(appName, sourceRepo, platform, chunks, thisChunk, hg="https://hg.mozilla.org"): possibleLocales = getPlatformLocales( getAllLocales(appName, sourceRepo, hg=hg), (platform,) )[platform] return getLocalesForChunk(possibleLocales, chunks, thisChunk)
def getReleaseLocalesForChunk(productName, appName, version, buildNumber, sourceRepo, platform, chunks, thisChunk, hg='https://hg.mozilla.org'): possibleLocales = getPlatformLocales( getShippedLocales(productName, appName, version, buildNumber, sourceRepo, hg), (platform,) )[platform] return getLocalesForChunk(possibleLocales, chunks, thisChunk)
def getReleaseLocalesForChunk(productName, appName, version, buildNumber, sourceRepo, platform, chunks, thisChunk, hg='https://hg.mozilla.org'): possibleLocales = getPlatformLocales( getShippedLocales(productName, appName, version, buildNumber, sourceRepo, hg), (platform, ))[platform] return getLocalesForChunk(possibleLocales, chunks, thisChunk)
def createSnippets(brandName, product, appName, version, appVersion, oldVersion, oldAppVersion, buildNumber, oldBuildNumber, platforms, channels, oldBaseSnippetDir, stageServer, hg, sourceRepo, generatePartials): errs = [] snippets = ['complete.txt'] if generatePartials: snippets.append('partial.txt') previousCandidateIDs = findOldBuildIDs(product, version, buildNumber, platforms, server=stageServer) oldShippedLocales = getShippedLocales(product, appName, oldVersion, oldBuildNumber, sourceRepo, hg) shippedLocales = getShippedLocales(product, appName, version, buildNumber, sourceRepo, hg) for platform in previousCandidateIDs.keys(): update_platforms = buildbot2updatePlatforms(platform) oldVersionBuildID = getBuildID(platform, product, oldVersion, oldBuildNumber, server=stageServer) oldPlatformLocales = getPlatformLocales(oldShippedLocales, (platform, ))[platform] platformLocales = getPlatformLocales(shippedLocales, (platform, ))[platform] commonLocales = getCommonLocales(platformLocales, oldPlatformLocales) for chan in channels: baseSnippetDir = getSnippetDirname(oldBaseSnippetDir, chan) if not os.path.exists(baseSnippetDir): errs.append( "Can't generate snippets for %s because %s doesn't exist" % (chan, baseSnippetDir)) continue for buildID in previousCandidateIDs[platform]: for locale in commonLocales: for update_platform in update_platforms: try: oldFile = os.path.join(baseSnippetDir, brandName, oldAppVersion, update_platform, oldVersionBuildID, locale, chan, 'complete.txt') oldCompleteSnippet = open(oldFile).read() except Exception, e: errs.append("Error reading from %s\n%s" % \ (oldFile, e)) continue newDir = os.path.join(baseSnippetDir, brandName, appVersion, update_platform, buildID, locale, chan) try: os.makedirs(newDir) log.info("Creating snippets for %s" % newDir) for f in snippets: newFile = os.path.join(newDir, f) log.info(" %s" % f) writeSnippet(newFile, oldCompleteSnippet) except OSError, e: errs.append("Error creating %s\n%s" % (newDir, e)) except Exception, e: errs.append("Hit error creating %s\n%s" % \ (newFile, e)) for l in [ l for l in platformLocales if l not in commonLocales ]: log.debug( "WARNING: %s not in oldVersion for %s, did not generate snippets for it" % (l, platform))
def createSnippets( brandName, product, appName, version, appVersion, oldVersion, oldAppVersion, buildNumber, oldBuildNumber, platforms, channels, oldBaseSnippetDir, stageServer, hg, sourceRepo, generatePartials): errs = [] snippets = ['complete.txt'] if generatePartials: snippets.append('partial.txt') previousCandidateIDs = findOldBuildIDs(product, version, buildNumber, platforms, server=stageServer) oldShippedLocales = getShippedLocales(product, appName, oldVersion, oldBuildNumber, sourceRepo, hg) shippedLocales = getShippedLocales(product, appName, version, buildNumber, sourceRepo, hg) for platform in previousCandidateIDs.keys(): update_platforms = buildbot2updatePlatforms(platform) oldVersionBuildID = getBuildID(platform, product, oldVersion, oldBuildNumber, server=stageServer) oldPlatformLocales = getPlatformLocales(oldShippedLocales, (platform,))[platform] platformLocales = getPlatformLocales(shippedLocales, (platform,))[platform] commonLocales = getCommonLocales(platformLocales, oldPlatformLocales) for chan in channels: baseSnippetDir = getSnippetDirname(oldBaseSnippetDir, chan) if not os.path.exists(baseSnippetDir): errs.append("Can't generate snippets for %s because %s doesn't exist" % (chan, baseSnippetDir)) continue for buildID in previousCandidateIDs[platform]: for locale in commonLocales: for update_platform in update_platforms: try: oldFile = os.path.join(baseSnippetDir, brandName, oldAppVersion, update_platform, oldVersionBuildID, locale, chan, 'complete.txt') oldCompleteSnippet = open(oldFile).read() except Exception, e: errs.append("Error reading from %s\n%s" % (oldFile, e)) continue newDir = os.path.join(baseSnippetDir, brandName, appVersion, update_platform, buildID, locale, chan) try: os.makedirs(newDir) log.info("Creating snippets for %s" % newDir) for f in snippets: newFile = os.path.join(newDir, f) log.info(" %s" % f) writeSnippet(newFile, oldCompleteSnippet) except OSError, e: errs.append("Error creating %s\n%s" % (newDir, e)) except Exception, e: errs.append("Hit error creating %s\n%s" % (newFile, e)) for l in [l for l in platformLocales if l not in commonLocales]: log.debug("WARNING: %s not in oldVersion for %s, did not generate snippets for it" % (l, platform))
def main(): """ Parse options and run download loop """ parser = OptionParser(__doc__) parser.set_defaults( product="firefox", hgurl="http://hg.mozilla.org", repo_path="build/buildbot-configs", source_repo_key="mozilla" ) parser.add_option("-p", "--product", dest="product", help="product name") parser.add_option("-r", "--repo-path", dest="repo_path", help="configs repo path") parser.add_option("-l", "--hgurl", dest="hgurl", help="hg URL prefix") parser.add_option("-P", "--platform", dest="platform", help="platform being signed on") parser.add_option("--source-repo-key", dest="source_repo_key", help="Which sourceRepository entry to pull sourceRepoPath from") parser.add_option("-V", "--verify", dest="verify", action="store_true", help="Just verify that the deliverables are present") options, args = parser.parse_args() if len(args) < 6: parser.error("") version = args[0] unsigned_dir = args[1] ssh_key = args[2] stage_username = args[3] stage_host = args[4] release_config_file = args[5] prefix = "%s/%s/raw-file/%s_%s_RELEASE/%s" release_config_url = prefix % ( options.hgurl, options.repo_path, options.product.upper(), version.replace(".", "_"), release_config_file, ) release_config = extract_config_info(release_config_url) allplatforms = release_config['enUSPlatforms'] # If we explicitly specify the platform we're signing on, use the # download_platform_map to count the other platform deliverables that # will be downloaded and signed on this signing platform if options.platform: # only look at platforms that are also in the release configs allplatforms = [p for p in download_platform_map[options.platform] if p in release_config['enUSPlatforms']] log.info("Looking for builds on : %s" % allplatforms) platform_locales = getPlatformLocales(getShippedLocales( release_config['productName'], release_config['appName'], release_config['version'], release_config['buildNumber'], release_config['sourceRepositories'][options.source_repo_key]['path'], options.hgurl), allplatforms) if options.verify: if not check_unsigned_dir( unsigned_dir, platform_locales, allplatforms, release_config.get('signedPlatforms', ('win32',)), release_config['doPartnerRepacks']): log.fatal("Error, missing signing deliverables") exit(1) else: log.info("All Deliverables Present") exit() while not check_unsigned_dir( unsigned_dir, platform_locales, allplatforms, release_config.get('signedPlatforms', ('win32',)), release_config['doPartnerRepacks']): download_builds(ssh_key, stage_username, stage_host, release_config) time.sleep(10)
def main(): """ Parse options and run download loop """ parser = OptionParser(__doc__) parser.set_defaults(product="firefox", hgurl="http://hg.mozilla.org", repo_path="build/buildbot-configs", source_repo_key="mozilla") parser.add_option("-p", "--product", dest="product", help="product name") parser.add_option("-r", "--repo-path", dest="repo_path", help="configs repo path") parser.add_option("-l", "--hgurl", dest="hgurl", help="hg URL prefix") parser.add_option("-P", "--platform", dest="platform", help="platform being signed on") parser.add_option( "--source-repo-key", dest="source_repo_key", help="Which sourceRepository entry to pull sourceRepoPath from") parser.add_option("-V", "--verify", dest="verify", action="store_true", help="Just verify that the deliverables are present") options, args = parser.parse_args() if len(args) < 6: parser.error("") version = args[0] unsigned_dir = args[1] ssh_key = args[2] stage_username = args[3] stage_host = args[4] release_config_file = args[5] prefix = "%s/%s/raw-file/%s_%s_RELEASE/%s" release_config_url = prefix % ( options.hgurl, options.repo_path, options.product.upper(), version.replace(".", "_"), release_config_file, ) release_config = extract_config_info(release_config_url) allplatforms = release_config['enUSPlatforms'] # If we explicitly specify the platform we're signing on, use the # download_platform_map to count the other platform deliverables that # will be downloaded and signed on this signing platform if options.platform: # only look at platforms that are also in the release configs allplatforms = [ p for p in download_platform_map[options.platform] if p in release_config['enUSPlatforms'] ] log.info("Looking for builds on : %s" % allplatforms) platform_locales = getPlatformLocales( getShippedLocales( release_config['productName'], release_config['appName'], release_config['version'], release_config['buildNumber'], release_config['sourceRepositories'][ options.source_repo_key]['path'], options.hgurl), allplatforms) if options.verify: if not check_unsigned_dir( unsigned_dir, platform_locales, allplatforms, release_config.get('signedPlatforms', ('win32', )), release_config['doPartnerRepacks']): log.fatal("Error, missing signing deliverables") exit(1) else: log.info("All Deliverables Present") exit() while not check_unsigned_dir( unsigned_dir, platform_locales, allplatforms, release_config.get('signedPlatforms', ('win32', )), release_config['doPartnerRepacks']): download_builds(ssh_key, stage_username, stage_host, release_config) time.sleep(10)