From: Michael Tremer Date: Mon, 17 Oct 2022 17:12:32 +0000 (+0000) Subject: builds: Drop old state/manage handlers X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cb3df1a70eb9b0748901f8f4ba17e1d5a2788a7f;p=pbs.git builds: Drop old state/manage handlers I have no idea what these are doing now and how to implement them again... Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 8afbc4fe..0fdf6403 100644 --- a/Makefile.am +++ b/Makefile.am @@ -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 \ diff --git a/src/buildservice/distribution.py b/src/buildservice/distribution.py index efbc2272..ab6ef3c3 100644 --- a/src/buildservice/distribution.py +++ b/src/buildservice/distribution.py @@ -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 diff --git a/src/buildservice/repository.py b/src/buildservice/repository.py index 23f4c502..3e795541 100644 --- a/src/buildservice/repository.py +++ b/src/buildservice/repository.py @@ -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 index b6340573..00000000 --- a/src/templates/build-manage.html +++ /dev/null @@ -1,90 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ _("Manage build %s") % build.name }}{% end block %} - -{% block body %} - - - {% if not build.all_jobs_finished %} -
-

{{ _("Not all jobs are finished") }}

-

- {{ _("Not all jobs of this build are finished, yet.") }} - {{ _("It is strongly discouraged to push this build into the next repository.") }} -

-

- {{ _("However, the build will be automatically unpushed if one or more build jobs fail.") }} -

-
- {% end %} - -
-
-
- {% raw xsrf_form_html() %} - - -
- - {% if mode == "admin" %} - {{ _("Push to a repository") }} - {% elif build.repo %} - {{ _("Push to next repository") }} - {% else %} - {{ _("Push to first repository") }} - {% end %} - - -
- -
- {% if mode == "admin" %} - - {% elif next_repo %} - - - {{ next_repo.name }} - - {{ next_repo.summary }} - {% end %} - -

- {{ _("This is the target repository for the build.") }} -

-
-
- -
- - {{ _("Unpush") }} - {{ _("Cancel") }} -
-
-
-
-
- - {% if current_user and current_user.is_admin() %} -
-
- {% if mode == "admin" %} - {{ _("Switch to user mode") }} - {% else %} - {{ _("Switch to admin mode") }} - {% end %} -
-
- {% end %} -{% end block %} diff --git a/src/templates/build-state.html b/src/templates/build-state.html deleted file mode 100644 index 07677e89..00000000 --- a/src/templates/build-state.html +++ /dev/null @@ -1,133 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ _("Build") }}: {{ build.name }}{% end block %} - -{% block body %} - - - {% module BuildHeadline(build) %} - {% module BuildStateWarnings(build) %} - - - - - -
- {{ _("The state of a build can be either building, testing, stable, obsolete or broken.") }} -
- - - - {% if current_user and build.has_perm(current_user) %} - {% if build.state in ("building", "testing", "stable") %} -
- {% raw xsrf_form_html() %} - - - - - - {% if build.repo %} - - - - {% end %} - - - - -
-

{{ _("Mark build as obsolete") }}

-

- {{ _("If a package is updated by an other package it should be marked as obsolete.") }} - {{ _("For obsolete builds, there will be no test jobs created and it is recommended to remove them from the repositories soon.") }} -

-
- - {{ _("Remove build from the repository it is currently in?") }} -
- - -
-
- {% end %} - - {% if build.state == "broken" %} -
- {% raw xsrf_form_html() %} - - - - - - - -
-

{{ _("Unbreak this build") }}

- -

- {{ _("In case this build has accidentially be marked as broken, it is possible to recover that state.") }} -

-
- - -
-
- {% else %} -
- {% raw xsrf_form_html() %} - - - - - - - -
-

{{ _("Mark build as broken") }}

- -

- {{ _("If a package does not build or contains serious 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.") }} -

-
- - -
-
- {% end %} -
 
- {% end %} - - {% if build.repo %} - - - - -
- {{ _("Current repository") }}: - {{ build.repo.name }} - {{ _("since %s") % locale.format_date(build.repo_time, relative=False) }} -
- {% end %} -{% end block %} diff --git a/src/web/__init__.py b/src/web/__init__.py index af25bc17..1fcb3077 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -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), diff --git a/src/web/builds.py b/src/web/builds.py index 6582164b..29c1c2ba 100644 --- a/src/web/builds.py +++ b/src/web/builds.py @@ -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)