return builds
- def get_by_name(self, name, type=None, public=None, user=None):
+ def get_by_name(self, name, type=None, public=None, user=None, limit=None, offset=None):
args = [name,]
conditions = [
"packages.name = %s",
or_conditions.append("builds.owner_id = %s")
args.append(user.id)
- query = "SELECT builds.id AS id FROM builds \
+ query = "SELECT builds.* AS id FROM builds \
JOIN packages ON builds.pkg_id = packages.id"
if or_conditions:
if conditions:
query += " WHERE %s" % " AND ".join(conditions)
- query += " ORDER BY packages.name,packages.epoch,packages.version,packages.release,id ASC"
+ if type == "release":
+ query += " ORDER BY packages.name,packages.epoch,packages.version,packages.release,id ASC"
+ elif type == "scratch":
+ query += " ORDER BY time_created DESC"
+
+ if limit:
+ if offset:
+ query += " LIMIT %s,%s"
+ args.extend([offset, limit])
+ else:
+ query += " LIMIT %s"
+ args.append(limit)
- return sorted([Build(self.pakfire, b.id) for b in self.db.query(query, *args)])
+ return [Build(self.pakfire, b.id, b) for b in self.db.query(query, *args)]
def get_latest_by_name(self, name, type=None, public=None):
query = "\
background-color: white;
}
+.well-build-state-stable {
+ border-color: #468847;
+}
+
+.well-build-state-unstable {
+ border-color: #f89406;
+}
+
+.well-build-type-scratch, .well-build-state-testing {
+ border-color: #b94a48;
+}
+
p.huge {
font-size: 4em;
font-weight: bold;
<li class="media">
<div class="media-body">
- <div class="well">
+ <div class="well {% if build.type == "release" %}well-build-state-{{ build.repo.type }}{% elif build.type == "scratch" %}well-build-type-scratch{% end %}">
<h4>
<a class="{% if build.is_broken() %}line-through{% end %}" href="/build/{{ build.uuid }}">{{ build.name }}</a>
- {% if build.repo %}
+ {% if build.type == "release" and build.repo %}
<small class="pull-right">
<a href="/distro/{{ build.repo.distro.identifier }}/repo/{{ build.repo.name }}">
{{ build.repo.distro.name }} ‐
{% end %}
</a>
</small>
+ {% elif build.type == "scratch" %}
+ <span class="label label-important pull-right">
+ {{ _("Scratch build") }}
+ </span>
{% end %}
</h4>
<hr>
- {% if build.commit %}
- {% module CommitMessage(build.commit) %}
+ {% if build.type == "release" %}
+ {% if build.commit %}
+ {% module CommitMessage(build.commit) %}
- <hr>
+ <hr>
- <p class="muted">
- {{ _("Author") }} {% module Maintainer(build.commit.author) %}
- ‐
- {{ _("Commit") }} <a href="/distro/{{ build.distro.identifier }}/source/{{ build.pkg.commit.source.identifier }}/{{ build.pkg.commit.revision }}">{{ build.pkg.commit.revision[:7] }}</a>
+ <p class="muted">
+ {{ _("Author") }} {% module Maintainer(build.commit.author) %}
+ <span class="pull-right">{{ locale.format_date(build.created, shorter=True) }}</span>
+ </p>
+ {% else %}
+ <p class="muted">
+ {{ _("No commit message.") }}
+ <span class="pull-right">{{ locale.format_date(build.created, shorter=True) }}</span>
+ </p>
+ {% end %}
- <span class="pull-right">{{ locale.format_date(build.created, shorter=True) }}</span>
- </p>
- {% else %}
+ {% elif build.type == "scratch" %}
<p class="muted">
- {{ _("No commit message.") }}
+ {{ _("Owner") }} {% module Maintainer(build.owner) %}
+
<span class="pull-right">{{ locale.format_date(build.created, shorter=True) }}</span>
</p>
{% end %}
--- /dev/null
+{% extends "../../base.html" %}
+
+{% block title %}{{ _("Scratch builds") }}: {{ pkg.name }}{% end block %}
+
+{% block body %}
+ <ul class="breadcrumb">
+ <li>
+ <a href="/">{{ _("Home") }}</a>
+ <span class="divider">/</span>
+ </li>
+ <li>
+ <a href="/packages">{{ _("Packages") }}</a>
+ <span class="divider">/</span>
+ </li>
+ <li>
+ <a href="/package/{{ pkg.name }}">{{ pkg.name }}</a>
+ <span class="divider">/</span>
+ </li>
+ <li class="active">
+ <a href="/package/{{ pkg.name }}/builds/scratch">{{ _("Scratch builds") }}</a>
+ </li>
+ </ul>
+
+ <div class="page-header">
+ <h2>
+ {{ pkg.name }}<br>
+ <small>{{ pkg.summary }}</small>
+ </h2>
+ </div>
+
+ {% if builds %}
+ {% module Changelog(builds=builds) %}
+ {% else %}
+ <p class="muted ac">
+ {{ _("There are no scratch builds for this package.") }}
+ </p>
+ {% end %}
+{% end block %}
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-03-02 13:03+0100\n"
+"POT-Creation-Date: 2013-03-02 14:36+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
-#: backend/builds.py:1086
+#: backend/builds.py:1098
#, python-format
msgid "%(user_name)s commented on %(build_name)s"
msgstr ""
#: backend/logs.py:118 backend/logs.py:187 backend/logs.py:248
#: backend/logs.py:322 data/templates/builders/detail.html:161
#: data/templates/builders/list.html:59 data/templates/jobs-detail.html:82
-#: data/templates/mirrors-list.html:72 web/__init__.py:306
+#: data/templates/mirrors-list.html:72 web/__init__.py:307
msgid "Unknown"
msgstr ""
#: data/templates/package-detail.html:12
#: data/templates/package-properties.html:12
#: data/templates/packages-list.html:12
+#: data/templates/packages/builds/scratch.html:12
#: data/templates/packages/builds/times.html:12
#: data/templates/packages/changelog.html:12
#: data/templates/packages/view-file.html:12
#: data/templates/package-detail.html:8
#: data/templates/package-properties.html:8
#: data/templates/packages-list.html:8
+#: data/templates/packages/builds/scratch.html:8
#: data/templates/packages/builds/times.html:8
#: data/templates/packages/changelog.html:8
#: data/templates/packages/view-file.html:8
#: data/templates/build-detail.html:98
#: data/templates/distro-source-commit-detail.html:55
-#: data/templates/modules/changelog/entry.html:31
+#: data/templates/modules/changelog/entry.html:36
#: data/templates/modules/commits-table.html:5
msgid "Author"
msgstr ""
#: data/templates/build-detail.html:100
#: data/templates/distro-source-commit-detail.html:3
-#: data/templates/modules/changelog/entry.html:33
#: data/templates/modules/commits-table.html:4
#: data/templates/package-detail.html:137
msgid "Commit"
msgstr ""
#: data/templates/build-detail.html:103
-#: data/templates/modules/changelog/entry.html:39
+#: data/templates/modules/changelog/entry.html:41
msgid "No commit message."
msgstr ""
#: data/templates/builders/detail.html:117
#: data/templates/package-detail-list.html:30
+#: data/templates/packages/builds/scratch.html:3
+#: data/templates/packages/builds/scratch.html:20
msgid "Scratch builds"
msgstr ""
msgstr ""
#: data/templates/mirrors-edit.html:57 data/templates/mirrors-list.html:43
+#: data/templates/modules/changelog/entry.html:48
#: data/templates/uploads-list.html:25
msgid "Owner"
msgstr ""
msgstr ""
#: data/templates/modules/build-headline.html:11
+#: data/templates/modules/changelog/entry.html:22
msgid "Scratch build"
msgstr ""
msgid "Show all packages"
msgstr ""
+#: data/templates/packages/builds/scratch.html:35
+msgid "There are no scratch builds for this package."
+msgstr ""
+
#: data/templates/packages/builds/times.html:3
msgid "Package build times"
msgstr ""
msgid "User is allowed to create scratch builds?"
msgstr ""
-#: web/__init__.py:326
+#: web/__init__.py:327
#, python-format
msgid "%(min)d min"
msgstr ""
-#: web/__init__.py:328
+#: web/__init__.py:329
#, python-format
msgid "%(hrs)d:%(min)02d hrs"
msgstr ""
-#: web/__init__.py:335
+#: web/__init__.py:336
#, python-format
msgid "%dh"
msgstr ""
-#: web/__init__.py:339
+#: web/__init__.py:340
#, python-format
msgid "%dm"
msgstr ""
-#: web/__init__.py:341
+#: web/__init__.py:342
#, python-format
msgid "%ds"
msgstr ""
(r"/package/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/download(.*)", PackageFileDownloadHandler),
(r"/package/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/view(.*)", PackageFileViewHandler),
(r"/package/([\w\-\+]+)", PackageNameHandler),
+ (r"/package/([\w\-\+]+)/builds/scratch", PackageScratchBuildsHandler),
(r"/package/([\w\-\+]+)/builds/times", PackageBuildsTimesHandler),
(r"/package/([\w\-\+]+)/changelog", PackageChangelogHandler),
(r"/package/([\w\-\+]+)/properties", PackagePropertiesHandler),
latest_build=latest_build, pkg=latest_build.pkg, bugs=bugs)
+class PackageScratchBuildsHandler(BaseHandler):
+ def get(self, name):
+ offset = self.get_argument("offset", 0)
+ limit = self.get_argument("limit", 10)
+
+ scratch_builds = self.pakfire.builds.get_by_name(name, type="scratch",
+ public=self.public, limit=limit, offset=offset)
+
+ if scratch_builds:
+ latest_build = scratch_builds[0]
+ else:
+ release_builds = self.pakfire.builds.get_by_name(name, type="release", public=self.public, limit=1)
+ if not release_builds:
+ raise tornado.web.HTTPError(404, "Could not find any build with this name: %s" % name)
+
+ latest_build = release_builds[0]
+
+ self.render("packages/builds/scratch.html", builds=scratch_builds,
+ pkg=latest_build.pkg)
+
+
class PackageChangelogHandler(BaseHandler):
def get(self, name):
limit = self.get_argument("limit", 10)