示例#1
0
 def __init__(self, package_name, recipe, tags, dep_tag=None):
     log(2, "Creating package %s %s" % (package_name, tags))
     self.package_name = package_name
     self.recipe = recipe
     self.full_name = "%s: %s" % (self.recipe.recipe_name, package_name)
     self.tags = tags
     self.depends = self.calculate_deps(recipe.depends, dep_tag)
     self.build_depends = self.calculate_deps(recipe.build_depends, dep_tag)
示例#2
0
 def build_package(self, force):
     if not force and self.built():
         return
     else:
         log(0, "[%s] Installing build dependencies" % self.full_name)
         for package in self.build_depends:
             package.install_package(buzzy.config.force_all)
         log(0, "[%s] Building" % self.full_name)
         self.perform_build()
示例#3
0
 def install_package(self, force):
     if not force and self.installed():
         return
     else:
         log(0, "[%s] Installing run-time dependencies" % self.full_name)
         for package in self.depends:
             package.install_package(buzzy.config.force_all)
         self.build_package(force)
         log(0, "[%s] Installing" % self.full_name)
         self.perform_install()
示例#4
0
def _if_run(pretty_name, cmd, **kw):
    """
    Run a command in a subprocess and return whether it exits successfully.
    Ignore any output.
    """

    log(1, "$ %s" % " ".join(cmd))

    try:
        subprocess.check_output(cmd, stderr=subprocess.STDOUT, **kw)
        return True
    except OSError:
        raise BuzzyError("Error running %s" % pretty_name)
    except subprocess.CalledProcessError:
        return False
示例#5
0
def _run(pretty_name, cmd, **kw):
    """
    Run a command in a subprocess, capturing the output.  If the process
    succeeds, don't print anything out.  If it fails, print out the output and
    raise an error.
    """

    log(1, "$ %s" % " ".join(cmd))

    try:
        if buzzy.config.verbosity >= 1:
            subprocess.check_call(cmd, **kw)
        else:
            subprocess.check_output(cmd, stderr=subprocess.STDOUT, **kw)
    except OSError:
        raise BuzzyError("Error running %s" % pretty_name)
    except subprocess.CalledProcessError as e:
        raise BuzzyError("Error running %s" % pretty_name, e.output)
示例#6
0
 def perform_build(self):
     log(0, "[%s]   Cleaning build directory" % self.full_name)
     self.clean_build_path()
     log(0, "[%s]   Creating PKGBUILD file" % self.full_name)
     self.make_pkgbuild()
     log(0, "[%s]   Building package" % self.full_name)
     buzzy.utils.run(["makepkg", "-s", "-f"], cwd=self.build_path)
     log(0, "[%s]   Updating repository database" % self.full_name)
     buzzy.utils.run(["repo-add", "-d", repo_db,
                      self.package_path()])
     buzzy.utils.run(["repo-add", "-d", "-f", repo_files_db,
                      self.package_path()])
示例#7
0
 def installed(self):
     result = buzzy.utils.if_run(["pacman", "-T", self.package_spec()])
     if result:
         log(0, "[%s] Package is already installed" % self.full_name)
     return result
示例#8
0
 def built(self):
     result = os.path.exists(self.package_path())
     if result:
         log(0, "[%s] Package is already built" % self.full_name)
     return result