def requestBuildPackage(): parser = OptionParser() parser.add_option("--release", "-r", metavar="RELEASE", dest="release_name", help="Specify release.", default=None) parser.add_option("--architecture", "-a", metavar="ARCHITECTURE", dest="architecture_name", help="Specify architecture", default=None) parser.add_option("--repository", "-d", metavar="REPOSITORY NAME", dest="repository", help="Specify repository to use for bootstrap", default="cms") parser.add_option("--upload-tmp-repository", metavar="REPOSITORY SUFFIX", dest="tmpRepository", help="Specify repository suffix to use for upload", default=getuser()) parser.add_option("--pkgtools", metavar="TAG", dest="pkgtools", help="Specify PKGTOOLS version to use.", default=None) parser.add_option("--cmsdist", metavar="TAG", dest="cmsdist", help="Specify CMSDIST version to use.", default=None) parser.add_option("--sync-back", metavar="BOOL", dest="syncBack", action="store_true", help="Specify whether or not to sync back the repository after upload", default=False) parser.add_option("--ignore-compilation-errors", "-k", metavar="BOOL", dest="ignoreErrors", help="When supported by the spec, ignores compilation errors and still packages the available build products", action="store_true", default=False) parser.add_option("--testbed", metavar="BOOL", dest="useTestBed", help="Use the testbed tag collector to ", action="store_true", default=False) parser.add_option("--continuations", metavar="SPEC", dest="continuations", help="Specify a comma separated list of task:architecture which need to be scheduled after if this task succeeds", default="") parser.add_option("--debug", metavar="BOOL", dest="debug", help="Add cmsbuild debug information", action="store_true", default=False) opts, args = parser.parse_args() if len(args) != 2: print "You need to specify a package" sys.exit(1) if not opts.repository: print "Please specify a repository" sys.exit(1) options = {} options["build-task"] = "build-package" options["real_release_name"] = expandDates(opts.release_name) options["release_name"] = re.sub("_[A-Z]+_X", "_X", options["real_release_name"]) options["architecture_name"] = opts.architecture_name options["repository"] = expandDates(opts.repository) options["tmpRepository"] = expandDates(opts.tmpRepository) options["syncBack"] = opts.syncBack options["package"] = expandDates(args[1]) options["continuations"] = opts.continuations options["ignoreErrors"] = opts.ignoreErrors options["debug"] = opts.debug if opts.useTestBed: options["tcBaseURL"] = TESTBED_URL options["request_type"] = "TASK-%s" % hash(expandDates(args[1] + options["real_release_name"]))[0:8] if opts.cmsdist and opts.continuations: print format("WARNING: you have specified --pkgtools to overwrite the PKGTOOLS tag coming from tag collector.\n" "However, this will happen only for %(package)s, continuations will still fetch those from the tagcolletor.", package=options["package"]) if opts.cmsdist and opts.continuations: print package("WARNING: you have specified --pkgtools to overwrite the PKGTOOLS tag coming from tag collector.\n" "However, this will happen only for %(package)s, continuations will still fetch those from the tagcolletor.", package=options["package"]) cmsdistTagUrl = "http://cmstags.cern.ch/tc/public/ReleaseExternalsXML?" + urllib.urlencode({"release": options["release_name"], "architecture": options["architecture_name"]}) try: data = urlopen(cmsdistTagUrl).read() except: print "Unable to find release %s for %s." % (options["release_name"], options["architecture_name"]) sys.exit(1) p = xml.parsers.expat.ParserCreate() tags = {} def start_element(name, attrs): if name != "external": return tags[str(attrs["external"].strip())] = str(attrs["tag"].strip()) p.StartElementHandler = start_element p.Parse(data) options.update(tags) if opts.pkgtools: options["PKGTOOLS"] = sanitize(opts.pkgtools) if opts.cmsdist: options["CMSDIST"] = sanitize(opts.cmsdist) if not options.get("CMSDIST"): print "Unable to find CMSDIST for releases %s on %s" % (options["release_name"], options["architecture_name"]) sys.exit(1) if not options.get("PKGTOOLS"): print "Unable to find PKGTOOLS for releases %s on %s" % (options["release_name"], options["architecture_name"]) sys.exit(1) tagCollectorAPI.createTaskRequest(**options)
def requestBuildPackage(): parser = OptionParser() parser.add_option("--release", "-r", metavar="RELEASE", dest="release_name", help="Specify release.", default=None) parser.add_option("--architecture", "-a", metavar="ARCHITECTURE", dest="architecture_name", help="Specify architecture", default=None) parser.add_option("--repository", "-d", metavar="REPOSITORY NAME", dest="repository", help="Specify repository to use for bootstrap", default="cms") parser.add_option("--upload-tmp-repository", metavar="REPOSITORY SUFFIX", dest="tmpRepository", help="Specify repository suffix to use for upload", default=getuser()) parser.add_option("--pkgtools", metavar="TAG", dest="pkgtools", help="Specify PKGTOOLS version to use.", default=None) parser.add_option("--cmsdist", metavar="TAG", dest="cmsdist", help="Specify CMSDIST version to use.", default=None) parser.add_option( "--sync-back", metavar="BOOL", dest="syncBack", action="store_true", help="Specify whether or not to sync back the repository after upload", default=False) parser.add_option( "--ignore-compilation-errors", "-k", metavar="BOOL", dest="ignoreErrors", help= "When supported by the spec, ignores compilation errors and still packages the available build products", action="store_true", default=False) parser.add_option("--testbed", metavar="BOOL", dest="useTestBed", help="Use the testbed tag collector to ", action="store_true", default=False) parser.add_option( "--continuations", metavar="SPEC", dest="continuations", help= "Specify a comma separated list of task:architecture which need to be scheduled after if this task succeeds", default="") parser.add_option("--debug", metavar="BOOL", dest="debug", help="Add cmsbuild debug information", action="store_true", default=False) opts, args = parser.parse_args() if len(args) != 2: print "You need to specify a package" sys.exit(1) if not opts.repository: print "Please specify a repository" sys.exit(1) options = {} options["build-task"] = "build-package" options["real_release_name"] = expandDates(opts.release_name) options["release_name"] = re.sub("_[A-Z]+_X", "_X", options["real_release_name"]) options["architecture_name"] = opts.architecture_name options["repository"] = expandDates(opts.repository) options["tmpRepository"] = expandDates(opts.tmpRepository) options["syncBack"] = opts.syncBack options["package"] = expandDates(args[1]) options["continuations"] = opts.continuations options["ignoreErrors"] = opts.ignoreErrors options["debug"] = opts.debug if opts.useTestBed: options["tcBaseURL"] = TESTBED_URL options["request_type"] = "TASK-%s" % hash( expandDates(args[1] + options["real_release_name"]))[0:8] if opts.cmsdist and opts.continuations: print format( "WARNING: you have specified --pkgtools to overwrite the PKGTOOLS tag coming from tag collector.\n" "However, this will happen only for %(package)s, continuations will still fetch those from the tagcolletor.", package=options["package"]) if opts.cmsdist and opts.continuations: print package( "WARNING: you have specified --pkgtools to overwrite the PKGTOOLS tag coming from tag collector.\n" "However, this will happen only for %(package)s, continuations will still fetch those from the tagcolletor.", package=options["package"]) cmsdistTagUrl = "http://cmstags.cern.ch/tc/public/ReleaseExternalsXML?" + urllib.urlencode( { "release": options["release_name"], "architecture": options["architecture_name"] }) try: data = urlopen(cmsdistTagUrl).read() except: print "Unable to find release %s for %s." % ( options["release_name"], options["architecture_name"]) sys.exit(1) p = xml.parsers.expat.ParserCreate() tags = {} def start_element(name, attrs): if name != "external": return tags[str(attrs["external"].strip())] = str(attrs["tag"].strip()) p.StartElementHandler = start_element p.Parse(data) options.update(tags) if opts.pkgtools: options["PKGTOOLS"] = sanitize(opts.pkgtools) if opts.cmsdist: options["CMSDIST"] = sanitize(opts.cmsdist) if not options.get("CMSDIST"): print "Unable to find CMSDIST for releases %s on %s" % ( options["release_name"], options["architecture_name"]) sys.exit(1) if not options.get("PKGTOOLS"): print "Unable to find PKGTOOLS for releases %s on %s" % ( options["release_name"], options["architecture_name"]) sys.exit(1) tagCollectorAPI.createTaskRequest(**options)
except: print "Unable to find release %s for %s." % (options["release_name"], options["architecture_name"]) sys.exit(1) p = xml.parsers.expat.ParserCreate() tags = {} def start_element(name, attrs): if name != "external": return tags[str(attrs["external"].strip())] = str(attrs["tag"].strip()) p.StartElementHandler = start_element p.Parse(data) options.update(tags) if opts.useTestBed: options["tcBaseURL"] = TESTBED_URL options["request_type"] = "TASK-%s" % hash(options["package"])[0:8] tagCollectorAPI.createTaskRequest(**options) def listTasks(): # Get the first task from the list # Check if we know what to do # Mark it as started # Start doing it parser = OptionParser(usage="%prog list [options]") parser.add_option("--match-arch", metavar="REGEX", dest="matchArch", help="Limit architectures to those matching REGEX", default=".*") parser.add_option("--match-release", metavar="REGEX", dest="matchRelease", help="Limit releases to those matching REGEX", default=".*") parser.add_option("--testbed", metavar="BOOL", dest="useTestBed", help="Use the testbed tag collector to ", action="store_true", default=False) opts, args = parser.parse_args() options = {"release_pattern": opts.matchRelease, "architecture_pattern": opts.matchArch} if opts.useTestBed: options["tcBaseURL"] = TESTBED_URL
sys.exit(1) p = xml.parsers.expat.ParserCreate() tags = {} def start_element(name, attrs): if name != "external": return tags[str(attrs["external"].strip())] = str(attrs["tag"].strip()) p.StartElementHandler = start_element p.Parse(data) options.update(tags) if opts.useTestBed: options["tcBaseURL"] = TESTBED_URL options["request_type"] = "TASK-%s" % hash(options["package"])[0:8] tagCollectorAPI.createTaskRequest(**options) def listTasks(): # Get the first task from the list # Check if we know what to do # Mark it as started # Start doing it parser = OptionParser(usage="%prog list [options]") parser.add_option("--match-arch", metavar="REGEX", dest="matchArch", help="Limit architectures to those matching REGEX", default=".*") parser.add_option("--match-release", metavar="REGEX",