]> git.ipfire.org Git - pbs.git/commitdiff
distro: Overwrite vendor/contact for user repositories
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 25 Oct 2022 10:13:35 +0000 (10:13 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 25 Oct 2022 10:13:35 +0000 (10:13 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/config.py
src/buildservice/distribution.py
src/buildservice/repository.py

index 0f738ceb41b689c0c9fe9d3a563c69b2ef9c7b81..74024639dab6fb055ba36fa408a1ec865b5e233e 100644 (file)
@@ -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
index 066cee47aae68ea245c97c039068950137b4bcca..316de0ebcb7372127ab1dc31a77493eaa7c7a9e8 100644 (file)
@@ -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
index a6869e76fef97427b29f373ff4eedca9f1e97871..bae89846140df48f980f95d98ee9ed1f112c54e3 100644 (file)
@@ -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