예제 #1
0
파일: mock.py 프로젝트: ryanduan/logalis
    def __init__(self, profile, build):
        """initializer

        profile is a path to a profile directory
        build is a path to a buildroot directory
        """
        self.builder = Build(build)
        self.profile = Profile(profile)
예제 #2
0
파일: port.py 프로젝트: ryanduan/logalis
 def build_source_rpm(self, build, profile):
     builder = Build(build)
     profile = Profile(profile)
     builder.setup_source(self.pkg.dir)
     self.prepare_sourceballs()
     builder.build_source_rpm(self.pkg.dir, profile)
     builder.fetch_rpms(profile.result_dir)
예제 #3
0
파일: mock.py 프로젝트: ryanduan/logalis
class Mock(Builder):
    """wrapper around mock for integrating with profiles and packages"""

    def __init__(self, profile, build):
        """initializer

        profile is a path to a profile directory
        build is a path to a buildroot directory
        """
        self.builder = Build(build)
        self.profile = Profile(profile)

    def build(self, package):
        pkg = DirFactory(package)

        srpm_name = pkg.get_srpm_name(self.profile)
        mock_cfg = self.profile.mock_cfg
        result_dir = self.profile.result_dir
        config_dir = self.profile.mock_cfg_dir
        log.debug("mock_cfg is " + mock_cfg)
        log.debug("result_dir is " + result_dir)
        log.debug("config_dir is " + config_dir)
        cmd = ["mock", "-r", mock_cfg, "--configdir=%s" % config_dir, "--resultdir=%s" % result_dir, srpm_name]
        log.debug("cmd is " + str(cmd))
        with pwd(result_dir):
            with log_file("mock.log") as mock_out:
                p = Popen(cmd, stdout=mock_out, stderr=mock_out)
                log.info("mock compiling %s... please wait" % srpm_name)
                p.communicate()

    def build_rpm(self, package):
        """builds an rpm from some package"""
        pkg = DirFactory(package)

        self.builder.setup_source(package)
        self.builder.build_source_rpm(package, self.profile)
        self.builder.fetch_rpms(self.profile.result_dir)

        self.build(package)

    def close(self):
        self.builder.close()
        self.profile.close()