]> git.ipfire.org Git - pbs.git/commitdiff
releases: Mirror all stable releases
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 11 Feb 2025 09:59:49 +0000 (09:59 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 11 Feb 2025 09:59:49 +0000 (09:59 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/__init__.py
src/buildservice/releases.py

index 370312b37b560d8793f447b331536823ef97f404..0ccead36996c1c27b093c57682b9b5807271fe33 100644 (file)
@@ -573,9 +573,30 @@ class Backend(object):
                        "--include=.timestamp",
                ]
 
+               paths = []
+
+               # Add all stable releases
+               async for distro in self.distros:
+                       releases = await distro.get_releases()
+
+                       for release in releases:
+                               if not release.stable:
+                                       continue
+
+                               paths.append(
+                                       release.local_path(),
+                               )
+
                # Add all mirrored repositories
                async for repo in await self.repos.mirrored:
-                       path = os.path.relpath(repo.local_path(), self.basepath)
+                       paths.append(
+                               repo.local_path(),
+                       )
+
+               # Add all paths
+               for path in paths:
+                       # Make the path relative (again)
+                       path = os.path.relpath(path, self.basepath)
 
                        commandline.append("--include=%s***" % path)
 
index ed955d7b50c8610e967b0220f284d5c776c9d168..df07029931b881d1988027afa01ff4b5c878bb4b 100644 (file)
@@ -158,3 +158,26 @@ class Release(database.Base, database.BackendMixin, database.SoftDeleteMixin):
                        images.append(image)
 
                return images
+
+       # Path
+
+       @property
+       def path(self):
+               """
+                       Make the path
+               """
+               return "%s/%s" % (self.distro.slug, self.slug)
+
+       # Local Path
+
+       def local_path(self, arch=None):
+               """
+                       Path to the releases
+               """
+               path = self.backend.path("releases", self.path)
+
+               # Append the architecture
+               if arch:
+                       path = os.path.join(path, arch)
+
+               return path