Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 24 additions & 26 deletions pulp_deb/app/tasks/synchronizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,22 @@ async def _handle_distribution(self, distribution):
stored_distribution = "flat-repo" if is_flat else distribution

log.info(_('Downloading Release file for distribution: "{}"').format(distribution))


# Retrieve and interpret any 'No-Support-for-Architecture-all' value:
# We will refer to the presence of 'No-Support-for-Architecture-all: Packages' in a Release
# file as indicating "hybrid format". For more info, see:
# https://wiki.debian.org/DebianRepository/Format#No-Support-for-Architecture-all
no_support_for_arch_all = release_file_dict.get("No-Support-for-Architecture-all", "")
if no_support_for_arch_all.strip() == "Packages":
hybrid_format = True
elif not no_support_for_arch_all:
hybrid_format = False
else:
raise UnknownNoSupportForArchitectureAllValue(
release_file.relative_path, no_support_for_arch_all
)

# Create release_file
if is_flat:
upstream_file_dir = distribution.strip("/")
Expand Down Expand Up @@ -689,6 +705,14 @@ async def _handle_distribution(self, distribution):
architectures = filter_arch_tokens(
release_file.architectures, self.remote.architectures, distribution
)
# For hybrid-format repos, remove "all" from the component processing list
# (it will be handled separately in _handle_component)
if hybrid_format:
architectures = [
(base_arch, pub_arch, variant)
for (base_arch, pub_arch, variant) in architectures
if base_arch != "all"
]

for base_arch, published_arch, variant in architectures:
release_architecture_dc = DeclarativeContent(
Expand All @@ -701,20 +725,6 @@ async def _handle_distribution(self, distribution):
)
await self.put(release_architecture_dc)

# Retrieve and interpret any 'No-Support-for-Architecture-all' value:
# We will refer to the presence of 'No-Support-for-Architecture-all: Packages' in a Release
# file as indicating "hybrid format". For more info, see:
# https://wiki.debian.org/DebianRepository/Format#No-Support-for-Architecture-all
no_support_for_arch_all = release_file_dict.get("No-Support-for-Architecture-all", "")
if no_support_for_arch_all.strip() == "Packages":
hybrid_format = True
elif not no_support_for_arch_all:
hybrid_format = False
else:
raise UnknownNoSupportForArchitectureAllValue(
release_file.relative_path, no_support_for_arch_all
)

# collect file references in new dict
file_references = defaultdict(deb822.Deb822Dict)
for digest_name in ["SHA512", "SHA256", "SHA1", "MD5sum"]:
Expand Down Expand Up @@ -792,18 +802,6 @@ async def _handle_component(
[x for x in release_file.architectures.split() if x != "all"]
)

# Putting this here because it fixes an issue where debian packages with the parameter
# architectures='all' are missing after sync/publish. It is not really clear why and
# needs investigation once there are tests for this issue. Best guess it hasis something do
# with the asynchronous handling of the tasks and removing something from a dict without
# a copy.
if hybrid_format:
architectures = [
(base_arch, pub_arch, variant)
for (base_arch, pub_arch, variant) in architectures
if base_arch != "all"
]

pending_tasks = []
# Handle package indices
for base_arch, index_arch, variant in architectures:
Expand Down