示例#1
0
 def __init__(self, cmd, args):
     CommandBase.__init__(self,
         cmd, args,
         load_recipes=True,
         require_prefix=True,
     )
     Requirer.__init__(self)
     self.packages = []
     if self.args.all:
         self.packages = recipe_manager.recipe_manager.list_all()
     else:
         self.packages = self.inventory.get_packages()
示例#2
0
 def __init__(self, cmd, args):
     CommandBase.__init__(
         self,
         cmd,
         args,
         load_recipes=True,
         require_prefix=True,
     )
     Requirer.__init__(self)
     self.packages = []
     if self.args.all:
         self.packages = recipe_manager.recipe_manager.list_all()
     else:
         self.packages = self.inventory.get_packages()
示例#3
0
 def __init__(self):
     Requirer.__init__(self)
     self.cfg = config_manager
     self.log = pb_logging.logger.getChild("Fetcher.{}".format(self.url_type))
示例#4
0
 def __init__(self, skip_names=None):
     Requirer.__init__(self)
     Deployer.__init__(self, skip_names)
     self.tarfiledeployer = TarfileDeployer(skip_names)
示例#5
0
文件: deploy.py 项目: johan--/pybombs
 def __init__(self, skip_names=None):
     Requirer.__init__(self)
     Deployer.__init__(self, skip_names)
     self.tarfiledeployer = TarfileDeployer(skip_names)
示例#6
0
文件: source.py 项目: vosgus/pybombs
    def run_build(
        self,
        recipe,
        make_clean=False,
        nuke_builddir=False,
        warn_if_builddir_exists=False,
        fail_if_builddir_missing=False,
    ):
        """
        Goes through the actual steps of configuring, building and installing
        a source package.

        Assumes source dir is in place (fetch was successful).

        Does not return a value, only raises PBException if something goes
        wrong ("net g'meckert isch lob genug").
        """
        Requirer().assert_requirements(['build-essential'])
        if nuke_builddir:
            make_clean = False
        get_state = lambda: (self.inventory.get_state(recipe.id) or 0)
        set_state = lambda state: self.inventory.set_state(
            recipe.id, state) or self.inventory.save()
        # Set up the build dir
        pkg_src_dir = os.path.normpath(
            os.path.join(self.prefix.src_dir, recipe.id))
        builddir = os.path.normpath(
            os.path.join(pkg_src_dir, recipe.installdir))
        self.log.debug("Using build directory: {0}".format(builddir))
        # The package source dir must exist, or something is wrong.
        if not os.path.isdir(pkg_src_dir):
            set_state(0)
            raise PBException(
                "There should be a source dir in {0}, but there isn't.".format(
                    pkg_src_dir))
        if builddir == pkg_src_dir:
            if nuke_builddir:
                # We can't nuke the build dir for in-tree builds, so fall back
                # to make clean:
                nuke_builddir = False
                make_clean = True
        else:  # If the build dir is separate:
            if os.path.exists(builddir):
                if nuke_builddir:
                    self.log.info("Removing old build directory.")
                    shutil.rmtree(builddir)
                    os.mkdir(builddir)
                elif warn_if_builddir_exists:
                    self.log.warn(
                        "Build dir already exists: {}".format(builddir))
            else:
                if fail_if_builddir_missing:
                    self.log.error(
                        "Can't update package {0}, build directory seems to be missing."
                        .format(recipe.id))
                    exit(1)
                os.mkdir(builddir)
        os.chdir(builddir)
        recipe.vars['builddir'] = builddir
        ### Run the build process
        if get_state() < self.inventory.STATE_CONFIGURED:
            self.configure(recipe)
            set_state(self.inventory.STATE_CONFIGURED)
        else:
            self.log.debug("Package {} is already configured.".format(
                recipe.id))
        if get_state() < self.inventory.STATE_BUILT:
            if make_clean:
                self.make_clean(recipe)
            self.make(recipe)
            set_state(self.inventory.STATE_BUILT)
        else:
            self.log.debug("Package {} is already built.".format(recipe.id))
        if get_state() < self.inventory.STATE_INSTALLED:
            self.make_install(recipe)
            set_state(self.inventory.STATE_INSTALLED)
        else:
            self.log.debug("Package {} is already installed.".format(
                recipe.id))