Beispiel #1
0
    def run(self):
        # pylint: disable=E1101
        unprocessed = self.db.query(Build)\
                             .filter_by(deps_processed=False)\
                             .filter(Build.repo_id != None)\
                             .options(joinedload(Build.package))\
                             .order_by(Build.repo_id).all()
        # TODO repo_id
        self.group = util.get_build_group()

        # do this before processing to avoid multiple runs of createrepo
        for build in unprocessed:
            self.srpm_cache.get_srpm(build.package.name, build.epoch,
                                     build.version, build.release)
        srpm_repo = self.srpm_cache.get_repodata()

        for repo_id, builds in itertools.groupby(unprocessed,
                                                 lambda build: build.repo_id):
            builds = list(builds)
            if repo_id is not None:
                self.prepare_sack(repo_id)
                if self.sack:
                    util.add_repos_to_sack('srpm', {'src': srpm_repo},
                                           self.sack)
                    for build in builds:
                        self.process_build(build)
            self.db.query(Build).filter(Build.id.in_([b.id for b in builds]))\
                                .update({'deps_processed': True},
                                        synchronize_session=False)
            self.db.commit()
Beispiel #2
0
 def prepare_sack(self, repo_id):
     for_arch = util.config['dependency']['for_arch']
     sack = hawkey.Sack(arch=for_arch)
     repos = self.repo_cache.get_repos(repo_id)
     if repos:
         util.add_repos_to_sack(repo_id, repos, sack)
         return sack
Beispiel #3
0
 def prepare_sack(self, repo_id):
     for_arch = util.config['dependency']['for_arch']
     sack = dnf.sack.Sack(arch=for_arch)
     repos = self.repo_cache.get_repos(repo_id)
     if repos:
         util.add_repos_to_sack(repo_id, repos, sack)
         self.sack = sack
Beispiel #4
0
    def process_builds(self):
        # pylint: disable=E1101
        unprocessed = self.db.query(Build)\
                             .filter_by(deps_processed=False)\
                             .filter(Build.repo_id != None)\
                             .order_by(Build.repo_id).all()
        # TODO repo_id
        group = util.get_build_group()

        # do this before processing to avoid multiple runs of createrepo
        for build in unprocessed:
            self.srpm_cache.get_srpm(build.package.name, build.epoch,
                                     build.version, build.release)
        srpm_repo = self.srpm_cache.get_repodata()

        for repo_id, builds in itertools.groupby(unprocessed,
                                                 lambda build: build.repo_id):
            if repo_id is not None:
                sack = self.prepare_sack(repo_id)
                if sack:
                    util.add_repos_to_sack('srpm', {'src': srpm_repo}, sack)
                    for build in builds:
                        self.process_build(build, sack, group)
            self.db.commit()