From: Michael Tremer Date: Tue, 21 Jun 2022 15:57:34 +0000 (+0000) Subject: arches: Drop them X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=321b7ff8ca22b40b22b191fe9adf848d042258c2;p=pbs.git arches: Drop them Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 21d7e0a6..4a3cde79 100644 --- a/Makefile.am +++ b/Makefile.am @@ -75,7 +75,6 @@ dist_configs_DATA = \ buildservice_PYTHON = \ src/buildservice/__init__.py \ src/buildservice/__version__.py \ - src/buildservice/arches.py \ src/buildservice/aws.py \ src/buildservice/base.py \ src/buildservice/bugtracker.py \ diff --git a/src/buildservice/__init__.py b/src/buildservice/__init__.py index 08f47b8b..7a1eae2c 100644 --- a/src/buildservice/__init__.py +++ b/src/buildservice/__init__.py @@ -6,7 +6,6 @@ import logging import os import pakfire -from . import arches from . import aws from . import bugtracker from . import builders @@ -48,7 +47,6 @@ class Backend(object): # Global pakfire settings (from database). self.settings = settings.Settings(self) - self.arches = arches.Arches(self) self.aws = aws.AWS(self) self.builds = builds.Builds(self) self.cache = cache.Cache(self) diff --git a/src/buildservice/arches.py b/src/buildservice/arches.py deleted file mode 100644 index 69f00eba..00000000 --- a/src/buildservice/arches.py +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/python - -from . import base - -_priorities = { - "noarch" : 0, - - # 64 bit - "x86_64" : 1, - "aarch64" : 2, - - # 32 bit - "i686" : 3, - "armv7hl" : 4, - "armv5tel" : 5, -} - -def priority(arch): - try: - return _priorities[arch] - except KeyError: - return 99 - -class Arches(base.Object): - def __iter__(self): - res = self.db.query("SELECT name FROM arches \ - WHERE NOT name = ANY(%s)", ["noarch", "src"]) - - return iter(sorted((a.name for a in res), key=priority)) - - def exists(self, name): - # noarch doesn't really exist - if name == "noarch": - return False - - res = self.db.get("SELECT 1 FROM arches \ - WHERE name = %s", name) - - if res: - return True - - return False - - def expand(self, arches): - if arches == "all": - return list(self) - - res = [] - for arch in arches.split(): - if self.exists(arch): - res.append(arch) - - return res diff --git a/src/buildservice/builds.py b/src/buildservice/builds.py index 3238872d..aa07332e 100644 --- a/src/buildservice/builds.py +++ b/src/buildservice/builds.py @@ -675,13 +675,13 @@ class Build(base.DataObject): arches = self.supported_arches # Create a new job for every given archirecture. - for arch in self.backend.arches.expand(arches): - # Don't create jobs for src - if arch == "src": - continue - - job = self.add_job(arch, **kwargs) - jobs.append(job) + #for arch in self.backend.arches.expand(arches): + # # Don't create jobs for src + # if arch == "src": + # continue + # + # job = self.add_job(arch, **kwargs) + # jobs.append(job) # Return all newly created jobs. return jobs diff --git a/src/buildservice/jobs.py b/src/buildservice/jobs.py index 45dd1e30..bcd01851 100644 --- a/src/buildservice/jobs.py +++ b/src/buildservice/jobs.py @@ -12,7 +12,6 @@ import pakfire.config log = logging.getLogger("builds") log.propagate = 1 -from . import arches from . import base from . import logs from . import users diff --git a/src/database.sql b/src/database.sql index 1dc682fe..103aef59 100644 --- a/src/database.sql +++ b/src/database.sql @@ -36,39 +36,6 @@ SET default_tablespace = ''; SET default_table_access_method = heap; --- --- Name: arches; Type: TABLE; Schema: public; Owner: pakfire --- - -CREATE TABLE public.arches ( - id integer NOT NULL, - name text NOT NULL -); - - -ALTER TABLE public.arches OWNER TO pakfire; - --- --- Name: arches_id_seq; Type: SEQUENCE; Schema: public; Owner: pakfire --- - -CREATE SEQUENCE public.arches_id_seq - START WITH 1 - INCREMENT BY 1 - NO MINVALUE - NO MAXVALUE - CACHE 1; - - -ALTER TABLE public.arches_id_seq OWNER TO pakfire; - --- --- Name: arches_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: pakfire --- - -ALTER SEQUENCE public.arches_id_seq OWNED BY public.arches.id; - - -- -- Name: builder_stats; Type: TABLE; Schema: public; Owner: pakfire -- @@ -1504,13 +1471,6 @@ ALTER TABLE public.users_permissions_id_seq OWNER TO pakfire; ALTER SEQUENCE public.users_permissions_id_seq OWNED BY public.users_permissions.id; --- --- Name: arches id; Type: DEFAULT; Schema: public; Owner: pakfire --- - -ALTER TABLE ONLY public.arches ALTER COLUMN id SET DEFAULT nextval('public.arches_id_seq'::regclass); - - -- -- Name: builders id; Type: DEFAULT; Schema: public; Owner: pakfire -- @@ -1735,14 +1695,6 @@ ALTER TABLE ONLY public.users_emails ALTER COLUMN id SET DEFAULT nextval('public ALTER TABLE ONLY public.users_permissions ALTER COLUMN id SET DEFAULT nextval('public.users_permissions_id_seq'::regclass); --- --- Name: arches arches_name; Type: CONSTRAINT; Schema: public; Owner: pakfire --- - -ALTER TABLE ONLY public.arches - ADD CONSTRAINT arches_name UNIQUE (name); - - -- -- Name: distributions distributions_pkey; Type: CONSTRAINT; Schema: public; Owner: pakfire -- @@ -1751,14 +1703,6 @@ ALTER TABLE ONLY public.distributions ADD CONSTRAINT distributions_pkey PRIMARY KEY (id); --- --- Name: arches idx_2197943_primary; Type: CONSTRAINT; Schema: public; Owner: pakfire --- - -ALTER TABLE ONLY public.arches - ADD CONSTRAINT idx_2197943_primary PRIMARY KEY (id); - - -- -- Name: builders idx_2197954_primary; Type: CONSTRAINT; Schema: public; Owner: pakfire -- @@ -2445,14 +2389,6 @@ ALTER TABLE ONLY public.filelists ADD CONSTRAINT filelists_pkg_id FOREIGN KEY (pkg_id) REFERENCES public.packages(id); --- --- Name: jobs jobs_arch; Type: FK CONSTRAINT; Schema: public; Owner: pakfire --- - -ALTER TABLE ONLY public.jobs - ADD CONSTRAINT jobs_arch FOREIGN KEY (arch) REFERENCES public.arches(name); - - -- -- Name: jobs jobs_build_id; Type: FK CONSTRAINT; Schema: public; Owner: pakfire -- @@ -2589,14 +2525,6 @@ ALTER TABLE ONLY public.mirrors_history ADD CONSTRAINT mirrors_history_user_id FOREIGN KEY (user_id) REFERENCES public.users(id); --- --- Name: packages packages_arch; Type: FK CONSTRAINT; Schema: public; Owner: pakfire --- - -ALTER TABLE ONLY public.packages - ADD CONSTRAINT packages_arch FOREIGN KEY (arch) REFERENCES public.arches(name); - - -- -- Name: packages packages_commit_id; Type: FK CONSTRAINT; Schema: public; Owner: pakfire -- diff --git a/src/web/distributions.py b/src/web/distributions.py index b85e484a..de5a365a 100644 --- a/src/web/distributions.py +++ b/src/web/distributions.py @@ -28,8 +28,7 @@ class DistributionEditHandler(base.BaseHandler): if not distro: raise tornado.web.HTTPError(404, "Distro not found") - self.render("distro-edit.html", distro=distro, - arches=self.backend.arches, sources=self.sources) + self.render("distro-edit.html", distro=distro, sources=self.sources) @tornado.web.authenticated def post(self, name): @@ -53,16 +52,8 @@ class DistributionEditHandler(base.BaseHandler): # Update the tag. distro.tag = tag - # Update architectures. - arches = [] - for arch in self.get_arguments("arches", []): - # Check if arch exists - if not self.backend.arches.exists(arch): - continue - - arches.append(arch) - - distro.arches = arches + # Update architectures + distro.arches = self.get_arguments("arches", []) self.redirect("/distribution/%s" % distro.sname) diff --git a/src/web/handlers.py b/src/web/handlers.py index 3924ebd2..4837da76 100644 --- a/src/web/handlers.py +++ b/src/web/handlers.py @@ -127,9 +127,8 @@ class RepositoryMirrorlistHandler(base.BaseHandler): # This is a plaintext file. self.set_header("Content-Type", "text/plain") - arch = self.get_argument("arch", None) - if not arch or not self.backend.arches.exists(arch): - raise tornado.web.HTTPError(400, "You must specify a valid architecture") + # Fetch architecture + arch = self.get_argument("arch") ret = { "type" : "mirrorlist",