From: Michael Tremer Date: Tue, 25 Oct 2022 10:13:35 +0000 (+0000) Subject: distro: Overwrite vendor/contact for user repositories X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7c9054399f47f89c645dfed9f3293b862052335;p=pbs.git distro: Overwrite vendor/contact for user repositories Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/config.py b/src/buildservice/config.py index 0f738ceb..74024639 100644 --- a/src/buildservice/config.py +++ b/src/buildservice/config.py @@ -12,10 +12,14 @@ from . import base log = logging.getLogger("pakfire.buildservice.config") class PakfireConfig(base.Object): - def init(self, distro=None, repos=None): + def init(self, distro=None, repos=None, vendor=None, contact=None): self.distro = distro self.repos = set() + # Overwritten for user repositories + self.vendor = vendor + self.contact = contact + # Add all repositories belonging to the distribution if self.distro: for repo in self.distro.repos: @@ -68,7 +72,8 @@ class PakfireConfig(base.Object): # Add the distro configuration if self.distro: - config = self.distro._make_config(local=local) + config = self.distro._make_config(local=local, + vendor=self.vendor, contact=self.contact) parts.append(config) # Add the repository configurations diff --git a/src/buildservice/distribution.py b/src/buildservice/distribution.py index 066cee47..316de0eb 100644 --- a/src/buildservice/distribution.py +++ b/src/buildservice/distribution.py @@ -78,7 +78,7 @@ class Distribution(base.DataObject): def __str__(self): return self.name - def _make_config(self, local=False): + def _make_config(self, local=False, vendor=None, contact=None): try: name, release = self.name.split() except: @@ -91,8 +91,8 @@ class Distribution(base.DataObject): "release = %s" % release, "slogan = %s" % self.slogan, "", - "vendor = %s" % self.vendor, - "contact = %s" % self.contact, + "vendor = %s" % (vendor or self.vendor), + "contact = %s" % (contact or self.contact), ] # Add any custom configuration diff --git a/src/buildservice/repository.py b/src/buildservice/repository.py index a6869e76..bae89846 100644 --- a/src/buildservice/repository.py +++ b/src/buildservice/repository.py @@ -588,7 +588,13 @@ class Repository(base.DataObject): """ Returns a Pakfire configuration for this repository """ - # XXX add any custom vendor/contact + # Overwrite the distro's vendor/contact for user repositories + if self.owner: + kwargs |= { + "vendor" : "%s" % self.owner, + "contact" : self.owner.email, + } + return self.backend.pakfire(distro=self.distro, repos=[self], **kwargs) # Write repository