예제 #1
0
 def label(cls, label, destination):
     logging.info("Checking out '%(label)s'", dict(label=label))
     if not os.path.isdir(destination):
         os.makedirs(destination)
     myUIDandGID = ["--myUIDandGIDcheckout"] if os.getuid() != 0 else []
     run.run([
         "osmosis", "checkout", destination, label,
         "--MD5", "--removeUnknownFiles", "--putIfMissing",
         "--objectStores=" + config.objectStoresOsmosisParameter()] + myUIDandGID)
예제 #2
0
 def _exists(self, objectStore, label):
     output = run.run([
         "osmosis", "listlabels", "^" + label + "$",
         "--objectStores=" + objectStore
     ])
     lines = output.strip().split('\n')
     return len(lines) > 1 or len(lines[0]) > 0
예제 #3
0
 def go(self):
     if len(self._requirements) == 0:
         logging.info("No upseto requirements to fulfill")
         return
     matching = []
     for basename, hash in self._requirements:
         requirementLabel = requirementlabel.RequirementLabel(
             basename=basename, product="build", hash=hash)
         matching.append(requirementLabel.matching())
     logging.info("Checking out '%(labels)s'", dict(labels=matching))
     for label in matching:
         logging.info("Checking out '%(label)s'", dict(label=label))
         run.run([
             "osmosis", "checkout", "..", label,
             "--MD5", "--putIfMissing",
             "--objectStores=" + config.objectStoresOsmosisParameter()])
 def go(self):
     if len(self._requirements) == 0:
         logging.info("No upseto requirements to fulfill")
         return
     matching = []
     for basename, hash in self._requirements:
         requirementLabel = requirementlabel.RequirementLabel(
             basename=basename, product="build", hash=hash)
         matching.append(requirementLabel.matching())
     logging.info("Checking out '%(labels)s'", dict(labels=matching))
     for label in matching:
         logging.info("Checking out '%(label)s'", dict(label=label))
         run.run([
             "osmosis", "checkout", "..", label, "--MD5", "--putIfMissing",
             "--objectStores=" + config.objectStoresOsmosisParameter()
         ])
예제 #5
0
 def _list(self, objectStore):
     output = run.run([
         "osmosis", "listlabels", '^' + self._labelExpression + '$',
         "--objectStores", objectStore
     ])
     if output.strip() == "":
         return []
     return output.strip().split('\n')
예제 #6
0
 def _mount(cls):
     output = run.run(["mount"])
     result = []
     for line in output.strip().split("\n"):
         fields = line.split(" ")
         assert fields[1] == "on", "'mount' output line is in wrong format"
         result.append(dict(type=fields[4], path=fields[2]))
     return result
예제 #7
0
 def go(self):
     existing = run.run([
         "osmosis", "listlabels", self._label, "--objectStores",
         config.LOCAL_OSMOSIS
     ])
     if len(existing.strip()) > 0:
         logging.info(
             "label '%(label)s' already exists in local osmosis object store",
             dict(label=self._label))
         return
     if not config.WITH_OFFICIAL_OBJECT_STORE:
         raise Exception(
             "No official object store in configuration to fetch out of")
     logging.info("fetching label '%(label)s' from official object store",
                  dict(label=self._label))
     run.run([
         "osmosis", "transfer", self._label, "--objectStores",
         config.OFFICIAL_OSMOSIS, "--transferDestination",
         config.LOCAL_OSMOSIS
     ])
예제 #8
0
 def __init__(self, product, directory):
     self._product = product
     self._directory = directory
     git = gitwrapper.GitWrapper(os.getcwd())
     self._basename = git.originURLBasename()
     if config.OFFICIAL_BUILD:
         self._state = 'officialcandidate'
     elif config.CLEAN:
         self._state = 'cleancandidate'
     else:
         self._state = 'dirty'
     self._label = label.label(basename=self._basename,
                               product=self._product,
                               hash=git.hash(),
                               state=self._state)
     if config.OFFICIAL_BUILD or config.CLEAN:
         run.run([
             "python", "-m", "upseto.main", "checkRequirements",
             "--allowNoManifest", "--unsullied", "--gitClean"
         ])
예제 #9
0
 def _hasLabel(self, objectStore):
     output = run.run([
         "osmosis", "listlabels", '^' + self._toLabel + '$', "--objectStores", objectStore])
     return len(output.split('\n')) > 1
예제 #10
0
 def _approve(self, objectStore):
     run.run(["osmosis", "renamelabel", self._fromLabel, self._toLabel, "--objectStores", objectStore])
예제 #11
0
 def _checkin(self, objectStore):
     run.run([
         "osmosis", "checkin", self._directory, self._label, "--MD5",
         "--objectStores", objectStore
     ])
예제 #12
0
 def _existing(self, objectStore):
     output = run.run([
         "osmosis", "listlabels",
         self._regex(), "--objectStores=" + objectStore
     ])
     return set(output.split("\n"))
예제 #13
0
 def _exists(self, objectStore):
     output = run.run(["osmosis", "listlabels", "^%s$" % self._label, "--objectStores=" + objectStore])
     return self._label in output
예제 #14
0
 def _existing(self, objectStore):
     output = run.run(["osmosis", "listlabels", self._regex(), "--objectStores=" + objectStore])
     return set(output.split("\n"))
예제 #15
0
    localize.Localize(label=args.label).go()
elif args.cmd == "fulfillrequirements":
    fulfillrequirements.FulfillRequirements().go()
elif args.cmd == "checkrequirements":
    checkrequirements.CheckRequirements().go()
elif args.cmd == "addrequirement":
    mani = manifest.Manifest.fromLocalDirOrNew()
    if args.basename:
        originURL = mani.findRequirementByBasename(args.basename)['originURL']
        logging.info(
            "Basename '%(basename)s' matches originURL '%(originURL)s'",
            dict(basename=args.basename, originURL=originURL))
    else:
        originURL = args.originURL
    if args.master:
        hash = run.run(["git", "ls-remote", originURL,
                        "HEAD"]).strip().split("\t")[0]
        logging.info("Latest hash is '%(hash)s'", dict(hash=hash))
    else:
        hash = args.hash
    mani.addRequirement(originURL=originURL, hash=hash)
    mani.save()
elif args.cmd == "removerequirement":
    mani = manifest.Manifest.fromLocalDir()
    mani.delRequirementByBasename(basename=args.originURLBasename)
    mani.save()
elif args.cmd == "printobjectstores":
    print config.objectStoresOsmosisParameter()
elif args.cmd == "printlabel":
    if args.thisProject:
        print thisprojectlabel.ThisProjectLabel(args.product).label()
    else:
예제 #16
0
 def _list(self, objectStore):
     output = run.run([
         "osmosis", "listlabels", '^' + self._labelExpression + '$', "--objectStores", objectStore])
     if output.strip() == "":
         return []
     return output.strip().split('\n')
예제 #17
0
 def _eraseLabel(self, objectStore, label):
     run.run(["osmosis", "eraselabel", label, "--objectStores", objectStore])
예제 #18
0
 def _eraseLabel(self, objectStore, label):
     run.run(
         ["osmosis", "eraselabel", label, "--objectStores", objectStore])
예제 #19
0
 def _exists(self, objectStore, label):
     output = run.run(["osmosis", "listlabels", "^" + label + "$", "--objectStores=" + objectStore])
     lines = output.strip().split('\n')
     return len(lines) > 1 or len(lines[0]) > 0
예제 #20
0
파일: main.py 프로젝트: Stratoscale/solvent
    localize.Localize(
        label=args.label).go()
elif args.cmd == "fulfillrequirements":
    fulfillrequirements.FulfillRequirements().go()
elif args.cmd == "checkrequirements":
    checkrequirements.CheckRequirements().go()
elif args.cmd == "addrequirement":
    mani = manifest.Manifest.fromLocalDirOrNew()
    if args.basename:
        originURL = mani.findRequirementByBasename(args.basename)['originURL']
        logging.info("Basename '%(basename)s' matches originURL '%(originURL)s'", dict(
            basename=args.basename, originURL=originURL))
    else:
        originURL = args.originURL
    if args.master:
        hash = run.run(["git", "ls-remote", originURL, "HEAD"]).strip().split("\t")[0]
        logging.info("Latest hash is '%(hash)s'", dict(hash=hash))
    else:
        hash = args.hash
    mani.addRequirement(originURL=originURL, hash=hash)
    mani.save()
elif args.cmd == "removerequirement":
    mani = manifest.Manifest.fromLocalDir()
    mani.delRequirementByBasename(basename=args.originURLBasename)
    mani.save()
elif args.cmd == "printobjectstores":
    print config.objectStoresOsmosisParameter()
elif args.cmd == "printlabel":
    if args.thisProject:
        print thisprojectlabel.ThisProjectLabel(args.product).label()
    else:
예제 #21
0
changeStateCmd = subparsers.add_parser("changestate")
changeStateCmd.add_argument("--basename", default=None)
changeStateCmd.add_argument("--hash", default=None)
changeStateCmd.add_argument("--product", required=True)
changeStateCmd.add_argument("--fromState", required=True)
changeStateCmd.add_argument("--toState", required=True)
parser.add_argument("--configurationFile", default="/etc/solvent.conf")
args = parser.parse_args()

config.load(args.configurationFile)
if args.cmd == "changestate":
    hash = args.hash
    if hash is None:
        git = gitwrapper.GitWrapper(os.getcwd())
        hash = git.hash()
    basename = args.basename
    if basename is None:
        git = gitwrapper.GitWrapper(os.getcwd())
        basename = git.originURLBasename()
    fromLabel = label.label(basename=basename, product=args.product, hash=hash, state=args.fromState)
    toLabel = label.label(basename=basename, product=args.product, hash=hash, state=args.toState)
    run.run([
        "osmosis", "renamelabel", fromLabel, toLabel,
        "--objectStores=" + config.LOCAL_OSMOSIS])
    if config.WITH_OFFICIAL_OBJECT_STORE:
        run.run([
            "osmosis", "renamelabel", fromLabel, toLabel,
            "--objectStores=" + config.OFFICIAL_OSMOSIS])
else:
    raise AssertionError("No such command")