From: Michael Tremer Date: Mon, 8 May 2023 14:05:36 +0000 (+0000) Subject: jobs: Drop buildroots X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ddc9de88e390d49bd7356c969cce90ec71f47fd7;p=pbs.git jobs: Drop buildroots Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 0e90e1a4..7dec3625 100644 --- a/Makefile.am +++ b/Makefile.am @@ -148,7 +148,6 @@ webdir = $(buildservicedir)/web dist_templates_DATA = \ src/templates/base.html \ src/templates/index.html \ - src/templates/jobs-buildroot.html \ src/templates/log.html \ src/templates/login.html \ src/templates/queue.html \ diff --git a/src/buildservice/jobs.py b/src/buildservice/jobs.py index bad681fd..49318761 100644 --- a/src/buildservice/jobs.py +++ b/src/buildservice/jobs.py @@ -792,27 +792,6 @@ class Job(base.DataObject): else: return datetime.datetime.utcnow() - self.started_at - def save_buildroot(self, pkgs): - # Cleanup old stuff first (for rebuilding packages) - self.db.execute("DELETE FROM jobs_buildroots WHERE job_id = %s", self.id) - - for pkg_name, pkg_uuid in pkgs: - self.db.execute("INSERT INTO jobs_buildroots(job_id, pkg_uuid, pkg_name) \ - VALUES(%s, %s, %s)", self.id, pkg_name, pkg_uuid) - - @lazy_property - def buildroot(self): - rows = self.db.query("SELECT * FROM jobs_buildroots \ - WHERE jobs_buildroots.job_id = %s ORDER BY pkg_name", self.id) - - pkgs = [] - for row in rows: - # Search for this package in the packages table. - pkg = self.backend.packages.get_by_uuid(row.pkg_uuid) - pkgs.append((row.pkg_name, row.pkg_uuid, pkg)) - - return pkgs - def pakfire(self, **kwargs): """ Generate the Pakfire configuration for this job diff --git a/src/database.sql b/src/database.sql index 91c87f1c..9661805f 100644 --- a/src/database.sql +++ b/src/database.sql @@ -421,17 +421,6 @@ CREATE VIEW public.job_queue AS WHERE ((jobs.deleted_at IS NULL) AND (jobs.started_at IS NULL) AND (jobs.finished_at IS NULL) AND (jobs.depcheck_succeeded IS TRUE)); --- --- Name: jobs_buildroots; Type: TABLE; Schema: public; Owner: - --- - -CREATE TABLE public.jobs_buildroots ( - job_id integer NOT NULL, - pkg_uuid uuid NOT NULL, - pkg_name text NOT NULL -); - - -- -- Name: jobs_id_seq; Type: SEQUENCE; Schema: public; Owner: - -- @@ -1586,22 +1575,6 @@ CREATE INDEX jobs_arch ON public.jobs USING btree (arch); CREATE INDEX jobs_build_id ON public.jobs USING btree (build_id) WHERE (deleted_at IS NULL); --- --- Name: jobs_buildroots_job_id; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX jobs_buildroots_job_id ON public.jobs_buildroots USING btree (job_id); - -ALTER TABLE public.jobs_buildroots CLUSTER ON jobs_buildroots_job_id; - - --- --- Name: jobs_buildroots_pkg_uuid; Type: INDEX; Schema: public; Owner: - --- - -CREATE INDEX jobs_buildroots_pkg_uuid ON public.jobs_buildroots USING btree (pkg_uuid); - - -- -- Name: jobs_finished_at; Type: INDEX; Schema: public; Owner: - -- @@ -1933,14 +1906,6 @@ ALTER TABLE ONLY public.jobs ADD CONSTRAINT jobs_builder_id FOREIGN KEY (builder_id) REFERENCES public.builders(id); --- --- Name: jobs_buildroots jobs_buildroots_job_id; Type: FK CONSTRAINT; Schema: public; Owner: - --- - -ALTER TABLE ONLY public.jobs_buildroots - ADD CONSTRAINT jobs_buildroots_job_id FOREIGN KEY (job_id) REFERENCES public.jobs(id); - - -- -- Name: jobs jobs_deleted_by; Type: FK CONSTRAINT; Schema: public; Owner: - -- diff --git a/src/templates/jobs-buildroot.html b/src/templates/jobs-buildroot.html deleted file mode 100644 index b93d3c95..00000000 --- a/src/templates/jobs-buildroot.html +++ /dev/null @@ -1,96 +0,0 @@ -{% extends "base.html" %} - -{% block title %}{{ _("Job buildroot")}}: {{ job.name }}{% end block %} - -{% block body %} - - - -
-
-

- {{ _("Build job")}}: {{ job.name }}
- {{ _("Buildroot") }} -

-
-
- - -
-
-
- - - - - - - - - - - - - -
{{ _("Packages") }}{{ len(buildroot) }}
{{ _("Buildroot size") }}{{ format_size(buildroot_size) }}
{{ _("Download size") }}{{ format_size(download_size) }}
-
-
-
- -
-
-

- {{ _("The packages listed below were used to build %s.") % job.name }} -

-
-
- -
-
-
- - - {% for name, uuid, pkg in buildroot %} - - {% if pkg %} - - - - {% else %} - - - - {% end %} - - {% end %} - -
- {{ pkg.friendly_name }} - - {{ pkg.summary }} - - {{ format_size(pkg.filesize) }} - - {{ name }} - - ({{ uuid }}) - - {{ _("N/A") }} -
-
-
-
-{% end block %} diff --git a/src/web/__init__.py b/src/web/__init__.py index 778e5a7b..8d896e49 100644 --- a/src/web/__init__.py +++ b/src/web/__init__.py @@ -145,7 +145,6 @@ class Application(tornado.web.Application): (r"/jobs/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/abort", jobs.AbortHandler), (r"/jobs/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/log", jobs.LogHandler), (r"/jobs/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/retry", jobs.RetryHandler), - (r"/job/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/buildroot", jobs.JobBuildrootHandler), (r"/api/v1/jobs/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})", jobs.APIv1ControlHandler), (r"/api/v1/jobs/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/finished", diff --git a/src/web/jobs.py b/src/web/jobs.py index fae68cbf..f15621eb 100644 --- a/src/web/jobs.py +++ b/src/web/jobs.py @@ -170,28 +170,6 @@ class LogHandler(base.BaseHandler): self.write(line) -class JobBuildrootHandler(base.BaseHandler): - def get(self, uuid): - job = self.backend.jobs.get_by_uuid(uuid) - if not job: - raise tornado.web.HTTPError(404, "Job not found: %s" % uuid) - - # Calculate the download size and buildroot size. - download_size = 0 - buildroot_size = 0 - - for name, uuid, pkg in job.buildroot: - if not pkg: - continue - - download_size += pkg.filesize - buildroot_size += pkg.size - - self.render("jobs-buildroot.html", job=job, build=job.build, - buildroot=job.buildroot, download_size=download_size, - buildroot_size=buildroot_size) - - class AbortHandler(base.BaseHandler): @tornado.web.authenticated def get(self, uuid):