From 4dbbf5002be64adada8dffe9a44fb5d89df8ec5e Mon Sep 17 00:00:00 2001 From: Danny Eiselt Date: Thu, 20 Feb 2025 11:54:42 +0100 Subject: [PATCH] added: per-architecture Release file creation Signed-off-by: Danny Eiselt --- pulp_deb/app/tasks/publishing.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/pulp_deb/app/tasks/publishing.py b/pulp_deb/app/tasks/publishing.py index 7c3d301f..a8277c8c 100644 --- a/pulp_deb/app/tasks/publishing.py +++ b/pulp_deb/app/tasks/publishing.py @@ -279,6 +279,7 @@ def __init__(self, parent, component): self.plain_component = os.path.basename(component) self.package_index_files = {} self.source_index_file_info = None + self.release_file_paths = {} for architecture in self.parent.architectures: package_index_path = os.path.join( @@ -293,6 +294,21 @@ def __init__(self, parent, component): open(package_index_path, "wb"), package_index_path, ) + release_path = os.path.join( + "dists", + self.parent.dists_subfolder, + self.plain_component, + "binary-{}".format(architecture), + "Release", + ) + with open(release_path, "w") as file: + file.write("Origin: {}\n".format(self.parent._release.origin)) + file.write("Label: {}\n".format(self.parent._release.label)) + file.write("Suite: {}\n".format(self.parent._release.suite)) + file.write("Architecture: {}\n".format(architecture)) + file.write("Component: {}\n".format(self.plain_component)) + self.release_file_paths[architecture] = release_path + # Source indicies file source_index_path = os.path.join( "dists", @@ -396,6 +412,13 @@ def finish(self): gz_source_index.save() self.parent.add_metadata(source_index) self.parent.add_metadata(gz_source_index) + # Publish per-component/architecture Release files + for release_path in self.release_file_paths.values(): + log.info(f"finish: Release path '{release_path}'") + release = PublishedMetadata.create_from_file( + publication=self.parent.publication, file=File(open(release_path, "rb")) + ) + self.parent.add_metadata(release) class _ReleaseHelper: @@ -407,6 +430,7 @@ def __init__( release, signing_service=None, ): + self._release = release self.publication = publication self.distribution = distribution = release.distribution self.dists_subfolder = distribution.strip("/") if distribution != "/" else "flat-repo"