# Then add all repositories for this build.
for repo in self.get_build_repos():
- conf = repo.get_conf(local=local)
+ conf = repo.get_config(local=local)
confs.append(conf)
return "\n\n".join(confs)
"mirrorlist?arch=%{arch}"
))
- def get_conf(self, local=False):
+ def get_config(self, local=False):
lines = [
- "[repo:%s]" % self.identifier,
+ "[repo:%s]" % self.slug,
"description = %s - %s" % (self.distro.name, self.summary),
"enabled = 1",
"baseurl = %s/%%{arch}" % (self.path if local else self.url),
return self.data.url
@property
- def identifier(self):
+ def slug(self):
return self.name.lower()
@property
def distro(self):
return self.pakfire.distros.get_by_id(self.data.distro_id)
- def get_conf(self, local=False):
+ def get_config(self, local=False):
lines = [
- "[repo:%s]" % self.identifier,
+ "[repo:%s]" % self.slug,
"description = %s - %s" % (self.distro.name, self.name),
"enabled = 1",
"baseurl = %s" % self.url,
</div>
{% end %}
+ <a class="secondary small expanded button" href="/distros/{{ distro.slug }}/repos/{{ repo.slug }}.repo">
+ {{ _("Download Configuration") }}
+ </a>
+
<div class="callout">
<h5>{{ _("Statistics") }}</h5>
(r"/distros", distributions.IndexHandler),
(r"/distros/([A-Za-z0-9\-\.]+)", distributions.ShowHandler),
(r"/distros/([A-Za-z0-9\-\.]+)/repos/([A-Za-z0-9\-]+)", repos.ShowHandler),
+ (r"/distros/([A-Za-z0-9\-\.]+)/repos/([A-Za-z0-9\-]+)\.repo", repos.ConfigHandler),
(r"/distros/([A-Za-z0-9\-\.]+)/repos/([A-Za-z0-9\-]+)/builds", repos.BuildsHandler),
- (r"/distro/([A-Za-z0-9\-\.]+)/repo/([A-Za-z0-9\-]+)\.repo",
- RepositoryConfHandler),
(r"/distro/([A-Za-z0-9\-\.]+)/repo/([A-Za-z0-9\-]+)/mirrorlist",
RepositoryMirrorlistHandler),
(r"/distro/([A-Za-z0-9\-\.]+)/repo/([A-Za-z0-9\-]+)/edit",
self.render("repository-edit.html", distro=distro, repo=repo)
-class RepositoryConfHandler(base.BaseHandler):
- def get(self, distro, repo):
- distro = self.backend.distros.get_by_slug(distro)
- if not distro:
- raise tornado.web.HTTPError(404)
-
- repo = distro.get_repo(repo)
- if not repo:
- raise tornado.web.HTTPError(404)
-
- # This is a plaintext file.
- self.set_header("Content-Type", "text/plain")
-
- # Write the header.
- self.write("# Downloaded from the pakfire build service on %s.\n\n" \
- % datetime.datetime.utcnow())
- self.write(repo.get_conf())
- self.finish()
-
-
class RepositoryMirrorlistHandler(base.BaseHandler):
def get(self, distro, repo):
distro = self.backend.distros.get_by_slug(distro)
self.render("repos/builds.html", repo=repo, distro=repo.distro)
+class ConfigHandler(base.BaseHandler):
+ def get(self, distro_slug, repo_slug):
+ # Find the distribution
+ distro = self.backend.distros.get_by_slug(distro_slug)
+ if not distro:
+ raise tornado.web.HTTPError(404, "Could not find distro: %s" % distro_slug)
+
+ # Find the repository
+ repo = distro.get_repo(repo_slug)
+ if not repo:
+ raise tornado.web.HTTPError(404, "Could not find repo: %s" % repo_slug)
+
+ # This is plain text
+ self.set_header("Content-Type", "text/plain")
+
+ # Generate configuration
+ config = repo.get_config()
+
+ # Send it to the client
+ self.finish(config)
+
+
class ListModule(ui_modules.UIModule):
def render(self, repos):
return self.render_string("repos/modules/list.html", repos=repos)