From: Michael Tremer Date: Wed, 3 May 2023 09:12:12 +0000 (+0000) Subject: repos: Allow to include source packages X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=316ffaa3ff9e5651596df69f228e9736228725ea;p=pbs.git repos: Allow to include source packages Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/config.py b/src/buildservice/config.py index 34e5eaf0..a7ea57bb 100644 --- a/src/buildservice/config.py +++ b/src/buildservice/config.py @@ -12,7 +12,7 @@ log = logging.getLogger("pbs.config") class PakfireConfig(base.Object): def init(self, distro=None, repos=None, vendor=None, contact=None, - arch=None, mirrored=True): + arch=None, include_source=False, mirrored=True): self.distro = distro self.repos = set() @@ -23,6 +23,9 @@ class PakfireConfig(base.Object): # Architecture self.arch = arch + # Should the configuration include the source repositories? + self.include_source = include_source + # Should the repositories use any mirrors? self.mirrored = mirrored @@ -101,6 +104,7 @@ class PakfireConfig(base.Object): # Add the repository configurations for repo in self.repos: - repo.write_config(config, local=local, mirrored=self.mirrored) + repo.write_config(config, local=local, + include_source=self.include_source, mirrored=self.mirrored) return config diff --git a/src/buildservice/repository.py b/src/buildservice/repository.py index a351bb40..7f922e3b 100644 --- a/src/buildservice/repository.py +++ b/src/buildservice/repository.py @@ -287,17 +287,25 @@ class Repository(base.DataObject): "mirrorlist?arch=%{arch}" )) - def write_config(self, config, local=False, mirrored=True): + def write_config(self, config, include_source=False, **kwargs): + # Write the default configuration + self._write_config(config, self.slug, "%{arch}", **kwargs) + + # Add another entry for the source repository + if include_source: + self._write_config(config, "%s-source" % self.slug, "src", **kwargs) + + def _write_config(self, config, name, arch, local=False, mirrored=True): # Disable mirroring if local or not mirrored if local or not self.mirrored: mirrored = False - config["repo:%s" % self.slug] = { + config["repo:%s" % name] = { # Description "description" : "%s - %s" % (self.distro.name, self.name), # Base URL - "baseurl" : "file://%s" % self.local_path("%{arch}") if local else self.download_url, + "baseurl" : "file://%s" % self.local_path(arch) if local else self.download_url, # Key "key" : self.key.public_key or "",