dist_templates_DATA = \
src/templates/base.html \
- src/templates/build-manage.html \
- src/templates/build-state.html \
src/templates/distro-edit.html \
src/templates/distro-source-commit-detail.html \
src/templates/distro-source-commit-reset.html \
return repo
- @property
- def first_repo(self):
- repos = self.repositories
-
- if repos:
- return self.repositories[-1]
-
@property
def log(self):
return [] # TODO
if log:
self._log_build("removed", build, from_repo=self, user=user)
- def move_build(self, build, to_repo, user=None, log=True):
- self.db.execute("UPDATE repositories_builds SET repo_id = %s, time_added = NOW() \
- WHERE repo_id = %s AND build_id = %s", to_repo.id, self.id, build.id)
-
- # Force regenerating the index
- self.update_forced = True
-
- # Update bug status.
- build._update_bugs_helper(to_repo)
-
- if log:
- self._log_build("moved", build, from_repo=self, to_repo=to_repo,
- user=user)
-
@lazy_property
def builds(self):
"""
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}{{ _("Manage build %s") % build.name }}{% end block %}
-
-{% block body %}
- <div class="page-header">
- <h1>
- {{ _("Manage build") }}: {{ build.name }}
- <small>- {{ _("Distribution") }}: {{ distro.name }}</small>
- </h1>
- </div>
-
- {% if not build.all_jobs_finished %}
- <div class="alert alert-block alert-warning">
- <h4 class="alert-heading">{{ _("Not all jobs are finished") }}</h4>
- <p>
- {{ _("Not all jobs of this build are finished, yet.") }}
- {{ _("It is <strong>strongly discouraged</strong> to push this build into the next repository.") }}
- </p>
- <p>
- {{ _("However, the build will be automatically unpushed if one or more build jobs fail.") }}
- </p>
- </div>
- {% end %}
-
- <div class="row">
- <div class="span6 offset3">
- <form class="form-horizontal" method="POST" action="">
- {% raw xsrf_form_html() %}
- <input type="hidden" name="action" value="push" />
-
- <fieldset>
- <legend>
- {% if mode == "admin" %}
- {{ _("Push to a repository") }}
- {% elif build.repo %}
- {{ _("Push to next repository") }}
- {% else %}
- {{ _("Push to first repository") }}
- {% end %}
- </legend>
-
- <div class="control-group">
- <label class="control-label" for="repo_push">{{ _("New repository") }}</label>
- <div class="controls">
- {% if mode == "admin" %}
- <select id="repo_push" name="repo">
- {% for repo in distro.repositories %}
- {% if not build.repo == repo %}
- <option value="{{ repo.identifier }}" {% if repo == next_repo %}selected="selected"{% end %}>
- {{ repo.name }} - {{ repo.summary }}
- </option>
- {% end %}
- {% end %}
- </select>
- {% elif next_repo %}
- <input type="hidden" name="repo" value="{{ next_repo.identifier }}" />
-
- <a href="/distro/{{ distro.identifier }}/repo/{{ next_repo.identifier }}">{{ next_repo.name }}</a>
- - {{ next_repo.summary }}
- {% end %}
-
- <p class="help-block">
- {{ _("This is the target repository for the build.") }}
- </p>
- </div>
- </div>
-
- <div class="form-actions">
- <button type="submit" class="btn btn-primary">{{ _("Push") }}</button>
- <a class="btn btn-danger" href="/build/{{ build.uuid }}/unpush">{{ _("Unpush") }}</a>
- <a class="btn" href="/build/{{ build.uuid }}">{{ _("Cancel") }}</a>
- </div>
- </fieldset>
- </form>
- </div>
- </div>
-
- {% if current_user and current_user.is_admin() %}
- <div class="row">
- <div class="span6 offset3">
- {% if mode == "admin" %}
- <a class="btn pull-right" href="?mode=user">{{ _("Switch to user mode") }}</a>
- {% else %}
- <a class="btn pull-right" href="?mode=admin">{{ _("Switch to admin mode") }}</a>
- {% end %}
- </div>
- </div>
- {% end %}
-{% end block %}
+++ /dev/null
-{% extends "base.html" %}
-
-{% block title %}{{ _("Build") }}: {{ build.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/{{ build.pkg.name }}">{{ build.pkg.name }}</a>
- <span class="divider">/</span>
- </li>
- <li>
- <a href="/build/{{ build.uuid }}">{{ build.pkg.friendly_version }}</a>
- <span class="divider">/</span>
- </li>
- <li class="active">
- <a href="/build/{{ build.uuid }}/state">{{ _("State") }}</a>
- </li>
- </ul>
-
- {% module BuildHeadline(build) %}
- {% module BuildStateWarnings(build) %}
-
- <table class="form form2">
- <tr>
- <td class="col1" colspan="2">
- {{ _("The state of a build can be either building, testing, stable, obsolete or broken.") }}
- </td>
- </tr>
- </table>
-
- <!-- XXX add some more information about what every single state means -->
-
- {% if current_user and build.has_perm(current_user) %}
- {% if build.state in ("building", "testing", "stable") %}
- <form method="POST" action="">
- {% raw xsrf_form_html() %}
- <table class="form form2">
- <tr>
- <td class="col1" colspan="2">
- <h2>{{ _("Mark build as obsolete") }}</h2>
- <p>
- {{ _("If a package is updated by an other package it should be marked as <em>obsolete</em>.") }}
- {{ _("For obsolete builds, there will be no test jobs created and it is recommended to remove them from the repositories soon.") }}
- </p>
- </td>
- </tr>
-
- {% if build.repo %}
- <tr>
- <td class="col1" colspan="2">
- <input type="checkbox" name="rem_from_repo" checked="checked" />
- {{ _("Remove build from the repository it is currently in?") }}
- </td>
- </tr>
- {% end %}
-
- <tr>
- <td colspan="2" class="buttons">
- <input type="hidden" name="state" value="obsolete" />
- <input type="submit" value="{{ _("Mark build as obsolete") }}" />
- </td>
- </tr>
- </table>
- </form>
- {% end %}
-
- {% if build.state == "broken" %}
- <form method="POST" action="">
- {% raw xsrf_form_html() %}
- <table class="form form2">
- <tr>
- <td class="col1" colspan="2">
- <h2>{{ _("Unbreak this build") }}</h2>
-
- <p>
- {{ _("In case this build has accidentially be marked as broken, it is possible to recover that state.") }}
- </p>
- </td>
- </tr>
- <tr>
- <td colspan="2" class="buttons">
- <input type="hidden" name="state" value="unbreak" />
- <input type="submit" value="{{ _("Unbreak this build") }}" />
- </td>
- </tr>
- </table>
- </form>
- {% else %}
- <form method="POST" action="">
- {% raw xsrf_form_html() %}
- <table class="form form2">
- <tr>
- <td class="col1" colspan="2">
- <h2>{{ _("Mark build as broken") }}</h2>
-
- <p>
- {{ _("If a package does not build or contains <em>serious</em> bugs, it should be marked as broken.") }}
- {{ _("Those builds can not be added into any repositories and are removed from all repositories they may currently be in.") }}
- </p>
- </td>
- </tr>
- <tr>
- <td colspan="2" class="buttons">
- <input type="hidden" name="state" value="broken" />
- <input type="submit" value="{{ _("Mark build as broken") }}" />
- </td>
- </tr>
- </table>
- </form>
- {% end %}
- <div style="clear: both;"> </div>
- {% end %}
-
- {% if build.repo %}
- <table class="form form2">
- <tr>
- <td class="col1" colspan="2">
- {{ _("Current repository") }}:
- <a href="/distro/{{ build.distro.identifier }}/repo/{{ build.repo.identifier }}">{{ build.repo.name }}</a>
- {{ _("since %s") % locale.format_date(build.repo_time, relative=False) }}
- </td>
- </tr>
- </table>
- {% end %}
-{% end block %}
(r"/builds/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/delete", builds.DeleteHandler),
(r"/builds/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/watch", builds.WatchHandler),
(r"/builds/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/unwatch", builds.UnwatchHandler),
- (r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/manage", builds.BuildManageHandler),
(r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/comment", builds.BuildDetailCommentHandler),
- (r"/build/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/state", builds.BuildStateHandler),
(r"/queue", jobs.QueueHandler),
self.redirect("/builds/%s" % build.uuid)
-class BuildStateHandler(base.BaseHandler):
- def get(self, uuid):
- build = self.backend.builds.get_by_uuid(uuid)
- if not build:
- raise tornado.web.HTTPError(404, "No such build: %s" % uuid)
-
- self.render("build-state.html", build=build)
-
- @tornado.web.authenticated
- def post(self, uuid):
- build = self.backend.builds.get_by_uuid(uuid)
- if not build:
- raise tornado.web.HTTPError(404, "No such build: %s" % uuid)
-
- # Check if user has the right to perform this action.
- if not build.has_perm(self.current_user):
- raise tornado.web.HTTPError(403, "User is not allowed to perform this action")
-
- # Check if given state is valid.
- state = self.get_argument("state", None)
- if not state in ("broken", "unbreak", "obsolete"):
- raise tornado.web.HTTPError(400, "Invalid argument given: %s" % state)
-
- # XXX this is not quite accurate
- if state == "unbreak":
- state = "stable"
-
- rem_from_repo = self.get_argument("rem_from_repo", False)
- if rem_from_repo == "on":
- rem_from_repo = True
-
- # Perform the state change.
- #build.update_state(state, user=self.current_user, remove=rem_from_repo)
-
- self.redirect("/build/%s" % build.uuid)
-
-
class BuildDetailCommentHandler(base.BaseHandler):
@tornado.web.authenticated
def post(self, uuid):
self.redirect("/build/%s" % build.uuid)
-class BuildManageHandler(base.BaseHandler):
- @tornado.web.authenticated
- def get(self, uuid):
- build = self.backend.builds.get_by_uuid(uuid)
- if not build:
- raise tornado.web.HTTPError(404, "Build not found: %s" % uuid)
-
- mode = "user"
- if self.current_user.is_admin():
- mode = self.get_argument("mode", "user")
-
- # Get the next repo.
- if build.repo:
- next_repo = build.repo.__next__
- else:
- next_repo = build.distro.first_repo
-
- self.render("build-manage.html", mode=mode, build=build,
- distro=build.distro, repo=build.repo, next_repo=next_repo)
-
- @tornado.web.authenticated
- def post(self, uuid):
- build = self.backend.builds.get_by_uuid(uuid)
- if not build:
- raise tornado.web.HTTPError(404, "Build not found: %s" % uuid)
-
- # check for sufficient permissions
- if not build.has_perm(self.current_user):
- raise tornado.web.HTTPError(403)
-
- action = self.get_argument("action")
- assert action in ("push", "unpush")
-
- current_repo = build.repo
-
- if action == "unpush":
- current_repo.rem_build(build, user=self.current_user)
-
- elif action == "push":
- repo_name = self.get_argument("repo")
- next_repo = build.distro.get_repo(repo_name)
-
- if not next_repo:
- raise tornado.web.HTTPError(404, "No such repository: %s" % next_repo)
-
- if not self.current_user.is_admin():
- if not distro.repo.__next__ == next_repo:
- raise tornado.web.HTTPError(403)
-
- if current_repo:
- current_repo.move_build(build, next_repo, user=self.current_user)
- else:
- next_repo.add_build(build, user=self.current_user)
-
- self.redirect("/build/%s" % build.uuid)
-
-
class ListModule(ui_modules.UIModule):
def render(self, builds):
return self.render_string("builds/modules/list.html", builds=builds)