class Builds(base.Object):
+ def _get_build(self, query, *args):
+ res = self.db.get(query, *args)
+
+ if res:
+ return Build(self.backend, res.id, data=res)
+
+ def _get_builds(self, query, *args):
+ res = self.db.query(query, *args)
+
+ for row in res:
+ yield Build(self.backend, row.id, data=row)
+
def get_by_id(self, id, data=None):
return Build(self.pakfire, id, data=data)
return cmp(self.pkg, other.pkg)
+ def __iter__(self):
+ jobs = self.backend.jobs._get_jobs("SELECT * FROM jobs \
+ WHERE build_id = %s", self.id)
+
+ return iter(sorted(jobs))
+
@classmethod
def create(cls, pakfire, pkg, type="release", owner=None, distro=None, public=True):
assert type in ("release", "scratch", "test")
# Cleanup uploads
"cleanup-uploads" : self.backend.uploads.cleanup,
+ # List repository
+ "list-repository" : self._list_repository,
+
# Sends all queued messages
"process-message-queue" : self.backend.messages.process_queue,
# Exit with error code
sys.exit(r or 0)
+ def _list_repository(self, distro_name, repo_name, arch):
+ # Get distribution
+ distro = self.backend.distros.get_by_name(distro_name)
+ if not distro:
+ print >>sys.stderr, "Could not find distribution: %s" % distro_name
+ return 2
+
+ # Get repository
+ repo = distro.get_repo(repo_name)
+ if not repo:
+ print >>sys.stderr, "Could not find repository: %s" % repo_name
+ return 2
+
+ # Iterate through all of it
+ for build in repo:
+ for job in build:
+ if not job.type == "build":
+ continue
+
+ if not job.arch in (arch, "noarch"):
+ continue
+
+ for pkg in job:
+ print pkg
+
# main
cli = Cli()