Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spike out a change to allow overriding the source package requirement. #122

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
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
19 changes: 12 additions & 7 deletions scripts/aptly/aptly_importer.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ def __init__(self, input_file):
self.method = self.config['method']
self.name = self.config['name']
self.suites = self.config['suites']
if 'override_sources_required' in self.config:
self.override_sources_required = self.config['override_sources_required']
else:
self.override_sources_required = False
except KeyError as e:
self.__error(f"{e} key was not found in file {input_file}")

Expand Down Expand Up @@ -313,13 +317,14 @@ def run(self):
for dist in self.config.suites:
# 1. Create aptly mirrors from yaml configuration file
self.__create_aptly_mirror(dist)
# 2. Be sure mirror has all source packages
self.__log(f'Check all source packages exist')
if not self.aptly.exists_all_source_packages(Aptly.ArtifactType.MIRROR,
self.__get_mirror_name(dist)):
self.__remove_all_generated_mirrors()
self.__error(f'{self.__get_mirror_name(dist)} does not have a source package. Removing generated mirrors')
self.__log_ok('All source packages exist in the mirror')
# 2. Be sure mirror has all source packages unless the requirement is overridden.
if not self.config.override_sources_required:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It always logs that it's verifying the sources. For this case it would be good to log that it's explicitly skipping the check based on the config.

self.__log(f'Check all source packages exist')
if not self.aptly.exists_all_source_packages(Aptly.ArtifactType.MIRROR,
self.__get_mirror_name(dist)):
self.__remove_all_generated_mirrors()
self.__error(f'{self.__get_mirror_name(dist)} does not have a source package. Removing generated mirrors')
self.__log_ok('All source packages exist in the mirror')
if self.only_mirror_creation:
return True
# 2. Import from mirrors to local repositories
Expand Down