Skip to content
Snippets Groups Projects
Commit 8885a030 authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[scripts.mirror] Allow whitelisting to take precedence

parent c2a129e5
No related branches found
No related tags found
No related merge requests found
Pipeline #51284 failed
...@@ -199,22 +199,12 @@ def mirror( ...@@ -199,22 +199,12 @@ def mirror(
local_packages = get_local_contents(dest_dir, arch) local_packages = get_local_contents(dest_dir, arch)
logger.info("%d packages available in local mirror", len(local_packages)) logger.info("%d packages available in local mirror", len(local_packages))
# by default, download everything
remote_packages = set(remote_package_info.keys()) remote_packages = set(remote_package_info.keys())
to_download = set(remote_package_info.keys())
if blacklist is not None and os.path.exists(blacklist): # remove stuff we already downloaded
globs_to_remove = set(load_glob_list(blacklist)) to_download -= local_packages
else:
globs_to_remove = set()
# in the remote packages, subset those that need to be downloaded
# according to our own interest
to_download = blacklist_filter(
remote_packages - local_packages, globs_to_remove
)
if whitelist is not None and os.path.exists(whitelist):
globs_to_consider = set(load_glob_list(whitelist))
to_download = whitelist_filter(to_download, globs_to_consider)
# if the user passed a cut date, only download packages that are newer # if the user passed a cut date, only download packages that are newer
# or at the same date than the proposed date # or at the same date than the proposed date
...@@ -245,6 +235,19 @@ def mirror( ...@@ -245,6 +235,19 @@ def mirror(
) )
to_download -= too_old to_download -= too_old
if blacklist is not None and os.path.exists(blacklist):
globs_to_remove = set(load_glob_list(blacklist))
else:
globs_to_remove = set()
# in the remote packages, subset those that need to be downloaded
# according to our own interest
to_download = blacklist_filter(to_download, globs_to_remove)
if whitelist is not None and os.path.exists(whitelist):
globs_to_consider = set(load_glob_list(whitelist))
to_download = whitelist_filter(to_download, globs_to_consider)
# in the local packages, subset those that we no longer need, be it # in the local packages, subset those that we no longer need, be it
# because they have been removed from the remote repository, or because # because they have been removed from the remote repository, or because
# we decided to blacklist them. # we decided to blacklist them.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment