Skip to content

Commit b1da152

Browse files
committed
Add flag to toggle publish of legacy release files.
1 parent a376801 commit b1da152

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

pulp_deb/app/serializers/publication_serializers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class AptPublicationSerializer(PublicationSerializer):
4343
view_name="signing-services-detail",
4444
required=False,
4545
)
46+
publish_legacy_release_files = BooleanField(help_text="Whether or not to publish Legacy per-component-and-architecture Release files.", default=False)
4647

4748
def validate(self, data):
4849
"""
@@ -59,6 +60,7 @@ class Meta:
5960
"structured",
6061
"signing_service",
6162
"publish_upstream_release_fields",
63+
"publish_legacy_release_files",
6264
)
6365
model = AptPublication
6466

pulp_deb/app/tasks/publishing.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def publish(
8282
repository_version_pk,
8383
simple,
8484
structured,
85+
publish_legacy_release_files,
8586
signing_service_pk=None,
8687
publish_upstream_release_fields=None,
8788
):
@@ -106,19 +107,21 @@ def publish(
106107

107108
log.info(
108109
_(
109-
"Publishing: repository={repo}, version={ver}, simple={simple}, structured={structured}"
110+
"Publishing: repository={repo}, version={ver}, simple={simple}, structured={structured}, publish_legacy_release_files={publish_legacy_release_files}"
110111
).format( # noqa
111112
repo=repo_version.repository.name,
112113
ver=repo_version.number,
113114
simple=simple,
114115
structured=structured,
116+
publish_legacy_release_files=publish_legacy_release_files,
115117
)
116118
)
117119
with tempfile.TemporaryDirectory(".") as temp_dir:
118120
with AptPublication.create(repo_version, pass_through=False) as publication:
119121
publication.simple = simple
120122
publication.structured = structured
121123
publication.signing_service = signing_service
124+
publication.publish_legacy_release_files = publish_legacy_release_files
122125
repository = AptRepository.objects.get(pk=repo_version.repository.pk)
123126

124127
if simple:
@@ -325,7 +328,8 @@ def __init__(self, parent, component):
325328
"Release",
326329
)
327330

328-
self.release_file_paths[architecture] = _write_legacy_release_file(self, architecture)
331+
if self.parent.publication.publish_legacy_release_files:
332+
self.release_file_paths[architecture] = _write_legacy_release_file(self, architecture)
329333

330334

331335
# Source indicies file

pulp_deb/app/viewsets/publication.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ def create(self, request):
215215
publish_upstream_release_fields = serializer.validated_data.get(
216216
"publish_upstream_release_fields"
217217
)
218+
publish_legacy_release_files = serializer.validated_data.get("publish_legacy_release_files")
218219

219220
result = dispatch(
220221
func=tasks.publish,
@@ -225,6 +226,7 @@ def create(self, request):
225226
"structured": structured,
226227
"signing_service_pk": getattr(signing_service, "pk", None),
227228
"publish_upstream_release_fields": publish_upstream_release_fields,
229+
"publish_legacy_release_files": publish_legacy_release_files,
228230
},
229231
)
230232
return OperationPostponedResponse(result, request)

0 commit comments

Comments
 (0)