]> git.ipfire.org Git - pbs.git/commitdiff
repos: Drop auxiliary repos and replace with custom distro config
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 25 Jun 2022 15:01:26 +0000 (15:01 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 25 Jun 2022 15:01:26 +0000 (15:01 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/distribution.py
src/buildservice/repository.py
src/database.sql

index f4c1a18e7f92052739ee4f19207d846e72b4ecf9..cbc08a18a085bf8ffeb35c86851e3b86351251d5 100644 (file)
@@ -5,9 +5,6 @@ import logging
 from . import base
 from . import packages
 from . import sources
-
-from .repository import Repository, RepositoryAux
-
 from .decorators import *
 
 class Distributions(base.Object):
@@ -74,6 +71,12 @@ class Distribution(base.DataObject):
                        "contact = %s" % self.contact,
                ]
 
+               # Add any custom configuration
+               if self.custom_config:
+                       lines += (
+                               "### CUSTOM CONFIG ###", self.custom_config, "### CUSTOM CONFIG END ###",
+                       )
+
                return "\n".join(lines)
 
        @property
@@ -122,6 +125,16 @@ class Distribution(base.DataObject):
 
        tag = property(get_tag, set_tag)
 
+       # Custom Configuration
+
+       def get_custom_config(self):
+               return self.data.custom_config
+
+       def set_custom_config(self, custom_config):
+               self._set_attribute("custom_config", custom_config or "")
+
+       custom_config = property(get_custom_config, set_custom_config)
+
        @lazy_property
        def repos(self):
                repos = self.backend.repos._get_repositories("""
@@ -143,20 +156,6 @@ class Distribution(base.DataObject):
        # XXX legacy
        repositories = repos
 
-       @lazy_property
-       def repositories_aux(self):
-               _repos = self.db.query("SELECT id FROM repositories_aux \
-                       WHERE status = 'enabled' AND distro_id = %s", self.id)
-
-               repos = []
-               for repo in _repos:
-                       repo = RepositoryAux(self.pakfire, repo.id)
-                       repo._distro = self
-
-                       repos.append(repo)
-
-               return sorted(repos)
-
        def get_repo(self, slug):
                repo = self.backend.repos._get_repository("""
                        SELECT
@@ -188,9 +187,6 @@ class Distribution(base.DataObject):
                        if repo.enabled_for_builds:
                                repos.append(repo)
 
-               # Add all aux. repositories.
-               repos += self.repositories_aux
-
                return repos
 
        @property
index b72c0990894b12b37024009ef2309b83ec552436..4850c874cc39333e568fb35960cd7a09c11b5cb9 100644 (file)
@@ -448,38 +448,3 @@ class Repository(base.DataObject):
                })
 
                return self.pakfire.repos.get_history(**kwargs)
-
-
-class RepositoryAux(base.DataObject):
-       table = "repositories_aux"
-
-       @property
-       def name(self):
-               return self.data.name
-
-       @property
-       def description(self):
-               return self.data.description or ""
-
-       @property
-       def url(self):
-               return self.data.url
-
-       @property
-       def slug(self):
-               return self.name.lower()
-
-       @property
-       def distro(self):
-               return self.pakfire.distros.get_by_id(self.data.distro_id)
-
-       def get_config(self, local=False):
-               lines = [
-                       "[repo:%s]" % self.slug,
-                       "description = %s - %s" % (self.distro.name, self.name),
-                       "enabled = 1",
-                       "baseurl = %s" % self.url,
-                       "priority = 0",
-               ]
-
-               return "\n".join(lines)
index d07f555103cd79090ac1a604951e7344483d2f5d..7e60f3df59a63b8a98603a31e6e2717e4889e5a0 100644 (file)
@@ -405,7 +405,8 @@ CREATE TABLE public.distributions (
     tag text NOT NULL,
     deleted boolean DEFAULT false NOT NULL,
     arches text[] DEFAULT ARRAY[]::text[] NOT NULL,
-    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL
+    created_at timestamp without time zone DEFAULT CURRENT_TIMESTAMP NOT NULL,
+    custom_config text DEFAULT ''::text NOT NULL
 );
 
 
@@ -1088,7 +1089,7 @@ CREATE TABLE public.repositories (
     id integer NOT NULL,
     name text NOT NULL,
     slug text,
-    description text NOT NULL,
+    description text DEFAULT ''::text NOT NULL,
     distro_id integer NOT NULL,
     parent_id integer,
     key_id integer,
@@ -1104,43 +1105,6 @@ CREATE TABLE public.repositories (
 
 ALTER TABLE public.repositories OWNER TO pakfire;
 
---
--- Name: repositories_aux; Type: TABLE; Schema: public; Owner: pakfire
---
-
-CREATE TABLE public.repositories_aux (
-    id integer NOT NULL,
-    name text NOT NULL,
-    description text,
-    url text NOT NULL,
-    distro_id integer NOT NULL,
-    status text DEFAULT 'disabled'::text NOT NULL
-);
-
-
-ALTER TABLE public.repositories_aux OWNER TO pakfire;
-
---
--- Name: repositories_aux_id_seq; Type: SEQUENCE; Schema: public; Owner: pakfire
---
-
-CREATE SEQUENCE public.repositories_aux_id_seq
-    START WITH 1
-    INCREMENT BY 1
-    NO MINVALUE
-    NO MAXVALUE
-    CACHE 1;
-
-
-ALTER TABLE public.repositories_aux_id_seq OWNER TO pakfire;
-
---
--- Name: repositories_aux_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: pakfire
---
-
-ALTER SEQUENCE public.repositories_aux_id_seq OWNED BY public.repositories_aux.id;
-
-
 --
 -- Name: repositories_builds; Type: TABLE; Schema: public; Owner: pakfire
 --
@@ -1666,13 +1630,6 @@ ALTER TABLE ONLY public.queue_delete ALTER COLUMN id SET DEFAULT nextval('public
 ALTER TABLE ONLY public.repositories ALTER COLUMN id SET DEFAULT nextval('public.repositories_id_seq'::regclass);
 
 
---
--- Name: repositories_aux id; Type: DEFAULT; Schema: public; Owner: pakfire
---
-
-ALTER TABLE ONLY public.repositories_aux ALTER COLUMN id SET DEFAULT nextval('public.repositories_aux_id_seq'::regclass);
-
-
 --
 -- Name: repositories_builds id; Type: DEFAULT; Schema: public; Owner: pakfire
 --
@@ -1881,14 +1838,6 @@ ALTER TABLE ONLY public.queue_delete
     ADD CONSTRAINT idx_2198155_primary PRIMARY KEY (id);
 
 
---
--- Name: repositories_aux idx_2198179_primary; Type: CONSTRAINT; Schema: public; Owner: pakfire
---
-
-ALTER TABLE ONLY public.repositories_aux
-    ADD CONSTRAINT idx_2198179_primary PRIMARY KEY (id);
-
-
 --
 -- Name: repositories_builds idx_2198189_primary; Type: CONSTRAINT; Schema: public; Owner: pakfire
 --
@@ -2588,14 +2537,6 @@ ALTER TABLE ONLY public.packages
     ADD CONSTRAINT packages_commit_id FOREIGN KEY (commit_id) REFERENCES public.sources_commits(id);
 
 
---
--- Name: repositories_aux repositories_aux_distro_id; Type: FK CONSTRAINT; Schema: public; Owner: pakfire
---
-
-ALTER TABLE ONLY public.repositories_aux
-    ADD CONSTRAINT repositories_aux_distro_id FOREIGN KEY (distro_id) REFERENCES public.distributions(id);
-
-
 --
 -- Name: repositories_builds repositories_builds_build_id; Type: FK CONSTRAINT; Schema: public; Owner: pakfire
 --