from . import base
from . import packages
from . import sources
-
-from .repository import Repository, RepositoryAux
-
from .decorators import *
class Distributions(base.Object):
"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
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("""
# 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
if repo.enabled_for_builds:
repos.append(repo)
- # Add all aux. repositories.
- repos += self.repositories_aux
-
return repos
@property
})
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)
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
);
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,
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
--
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
--
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
--
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
--