예제 #1
0
    def do_run(self):

        # clean the rpmbuild temp dir
        rmtree(self.pkg['zypper.rpm.tmpdir'])

        # copy the spec file
        specdir = self.pkg['zypper.rpm.tmpdir.specs']
        mkdir(specdir)
        shutil.copy(self.pkg['zypper.specfile'], specdir);

        # create source tarball from git repo
        if (not self.pkg.git_repo().archive(
                output=abspath(self.pkg['zypper.tarball.pathname']),
                prefix=self.pkg['zypper.tarball.prefix'])):
            self.fail("zypper failed: git-archive call failed")

        # create source rpm
        if (call(["rpmbuild", "--target", self.target['arch'], "-bs", self.pkg['zypper.specfile']])):
            self.fail("zypper build failed: rpmbuild call failed")

        # copy the source rpm
        zyprepo_src = abspath(self.target['target.zyprepo']+'/srpm')
        mkdir(zyprepo_src)
        for s in glob(self.pkg['zypper.rpm.tmpdir']+'/SRPMS/*.src.rpm'):
            shutil.copy(s, zyprepo_src)

        # run the build in container
        container = self.target['container']
        if container not in self.containers:
            self.fail("unsupported container type: "+repr(container))

        ret = self.containers[container]()
        self.statfile.set(self.pkg.git_repo().get_head_commit())
        return ret
예제 #2
0
 def import_initial_tree(self, tree, branch, msg, parent=None):
     temp_index = self.get_tmpindex()
     if self.load_index(tree, temp_index):
         treeish = self.write_tree(temp_index)
         commit = self.commit_tree(treeish, msg, parent)
         ret = self.create_branch(branch, commit)
     else:
         ret = False
     rmtree(temp_index)
     return ret
예제 #3
0
 def extract_tree(self, workdir, treeish):
     tmpindex = self.get_tmpindex()
     ret = self.read_tree(tmpindex, treeish) and self.checkout_index(
         workdir, tmpindex)
     rmtree(tmpindex)
     return ret