Example #1
0
    def show(self):

        if len(self.things_todo) == 0:
            die("you must specify something to show")
        if len(self.recipes_todo) > 0:
            die("you cannot show world")

        thing = oelite.item.OEliteItem(self.things_todo[0])
        recipe = self.cookbook.get_recipe(type=thing.type,
                                          name=thing.name,
                                          version=thing.version,
                                          strict=False)
        if not recipe:
            die("Cannot find %s" % (thing))

        if self.options.task:
            if self.options.task.startswith("do_"):
                task = self.options.task
            else:
                task = "do_" + self.options.task
            self.runq = OEliteRunQueue(self.config, self.cookbook)
            self.runq._add_recipe(recipe, task)
            task = self.cookbook.get_task(recipe=recipe, name=task)
            task.prepare(self.runq)
            meta = task.meta()
        else:
            meta = recipe.meta

        #meta.dump(pretty=False, nohash=False, flags=True,
        #          ignore_flags=("filename", "lineno"),
        meta.dump(pretty=True,
                  nohash=(not self.options.nohash),
                  only=(self.things_todo[1:] or None))

        return 0
Example #2
0
    def bake(self):

        self.setup_tmpdir()
        oelite.profiling.init(self.config)

        # task(s) to do
        if self.options.task:
            tasks_todo = self.options.task
        elif "OE_DEFAULT_TASK" in self.config:
            tasks_todo = self.config.get("OE_DEFAULT_TASK", 1)
        else:
            #tasks_todo = "all"
            tasks_todo = "build"
        self.tasks_todo = tasks_todo.split(",")

        if self.options.rebuild:
            self.options.rebuild = max(self.options.rebuild)
            self.options.prebake = False
        else:
            self.options.rebuild = None
        if self.options.relax:
            self.options.relax = max(self.options.relax)
        else:
            default_relax = self.config.get("DEFAULT_RELAX", 1)
            if default_relax and default_relax != "0":
                self.options.relax = int(default_relax)
            else:
                self.options.relax = None

        # init build quue
        self.runq = OEliteRunQueue(self.config, self.cookbook,
                                   self.options.rebuild, self.options.relax)

        # first, add complete dependency tree, with complete
        # task-to-task and task-to-package/task dependency information
        debug("Building dependency tree")
        rusage = oelite.profiling.Rusage("Building dependency tree")
        for task in self.tasks_todo:
            task = oelite.task.task_name(task)
            try:
                for thing in self.recipes_todo:
                    if not self.runq.add_recipe(thing, task):
                        die("No such recipe: %s" % (thing))
                for thing in self.things_todo:
                    thing = oelite.item.OEliteItem(thing)
                    if not self.runq.add_something(thing, task):
                        die("No such thing: %s" % (thing))
            except RecursiveDepends, e:
                die("dependency loop: %s\n\t--> %s" %
                    (e.args[1], "\n\t--> ".join(e.args[0])))
            except NoSuchTask, e:
                die("No such task: %s: %s" % (thing, e.__str__()))