Пример #1
0
    def batch_build(cls,
                    user,
                    copr,
                    packages,
                    chroot_names=None,
                    **build_options):
        new_builds = []

        batch = models.Batch()
        db.session.add(batch)

        for package in packages:
            git_hashes = {}
            skip_import = False
            source_build = None

            if (package.source_type == helpers.BuildSourceEnum('upload')
                    or package.source_type == helpers.BuildSourceEnum('link')):
                source_build = package.last_build()

                if not source_build or not source_build.build_chroots[
                        0].git_hash:
                    raise exceptions.NoPackageSourceException(
                        "Could not get latest git hash for {}".format(
                            package.name))

                for chroot_name in chroot_names:
                    git_hashes[chroot_name] = source_build.build_chroots[
                        0].git_hash
                skip_import = True

            new_build = builds_logic.BuildsLogic.create_new(
                user,
                copr,
                package.source_type,
                package.source_json,
                chroot_names,
                git_hashes=git_hashes,
                skip_import=skip_import,
                batch=batch,
                **build_options)

            if source_build:
                new_build.package_id = source_build.package_id
                new_build.pkg_version = source_build.pkg_version

            new_builds.append(new_build)

        return new_builds
Пример #2
0
    def add_builds(self, rpms, module):
        blocked_by_id = None
        for group in self.get_build_batches(rpms):
            batch = models.Batch()
            batch.blocked_by_id = blocked_by_id
            db.session.add(batch)
            for pkgname, rpm in group.items():
                clone_url = self.get_clone_url(pkgname, rpm)
                build = builds_logic.BuildsLogic.create_new_from_scm(self.user, self.copr, scm_type="git",
                                                                     clone_url=clone_url, committish=rpm.peek_ref(),
                                                                     chroot_names=self.platform_chroots)
                build.batch = batch
                build.batch_id = batch.id
                build.module_id = module.id
                db.session.add(build)

            # Every batch needs to by blocked by the previous one
            blocked_by_id = batch.id
Пример #3
0
 def f_batches(self):
     self.batch1 = models.Batch()
     self.batch2 = models.Batch()
     self.batch3 = models.Batch()
     self.batch4 = models.Batch()