]> git.ipfire.org Git - pbs.git/commitdiff
builds: Drop old state/manage handlers
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 17 Oct 2022 17:12:32 +0000 (17:12 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 17 Oct 2022 17:13:56 +0000 (17:13 +0000)
I have no idea what these are doing now and how to implement them
again...

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
Makefile.am
src/buildservice/distribution.py
src/buildservice/repository.py
src/templates/build-manage.html [deleted file]
src/templates/build-state.html [deleted file]
src/web/__init__.py
src/web/builds.py

index 8afbc4fe78bc8610c17a97038ff68fa5a683aae3..0fdf6403c9185551664419604e1618d079347635 100644 (file)
@@ -156,8 +156,6 @@ webdir = $(buildservicedir)/web
 
 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 \
index efbc22724802c1059e7be125d9baa17a7bfb4558..ab6ef3c3ccb3eb39756291863697706536de872e 100644 (file)
@@ -193,13 +193,6 @@ class Distribution(base.DataObject):
 
                return repo
 
-       @property
-       def first_repo(self):
-               repos = self.repositories
-
-               if repos:
-                       return self.repositories[-1]
-
        @property
        def log(self):
                return [] # TODO
index 23f4c502493e506769ac134e78fd6713059266bf..3e795541eb814e9022e0d77e20c601383c235bfc 100644 (file)
@@ -453,20 +453,6 @@ class Repository(base.DataObject):
                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):
                """
diff --git a/src/templates/build-manage.html b/src/templates/build-manage.html
deleted file mode 100644 (file)
index b634057..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-{% 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 %}
diff --git a/src/templates/build-state.html b/src/templates/build-state.html
deleted file mode 100644 (file)
index 07677e8..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-{% 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;">&nbsp;</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 %}
index af25bc17b78757a0ef2523a036597727e1496dc3..1fcb3077f52db5801cf3ce1dbbc1c17b4d81573b 100644 (file)
@@ -138,9 +138,7 @@ class Application(tornado.web.Application):
                        (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),
 
index 6582164bd35d2128e6023b3061a53dbc02771441..29c1c2bad88ebcf0e2c876842cc2baf188faa302 100644 (file)
@@ -93,43 +93,6 @@ class UnwatchHandler(base.BaseHandler):
                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):
@@ -157,63 +120,6 @@ class BuildDetailCommentHandler(base.BaseHandler):
                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)