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

skip EOL distros by default, add option to include them #647

Merged
merged 3 commits into from
Jan 14, 2019
Merged
Show file tree
Hide file tree
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
8 changes: 7 additions & 1 deletion src/rosdep2/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,11 @@ def _rosdep_main(args):
'whether sudo is used for a specific installer, '
"e.g. '--as-root pip:false' or '--as-root \"pip:no homebrew:yes\"'. "
'Can be specified multiple times.')
parser.add_option('--include-eol-distros', dest='include_eol_distros',
default=False, action='store_true',
help="Affects the 'update' verb. "
'If specified end-of-life distros are being '
'fetched too.')

options, args = parser.parse_args(args)
if options.print_version or options.print_all_versions:
Expand Down Expand Up @@ -592,7 +597,8 @@ def update_error_handler(data_source, exc):
# nothing we wanna do under Windows
pass
update_sources_list(success_handler=update_success_handler,
error_handler=update_error_handler)
error_handler=update_error_handler,
skip_eol_distros=not options.include_eol_distros)
print('updated cache in %s' % (sources_cache_dir))
except InvalidData as e:
print('ERROR: invalid sources list file:\n\t%s' % (e), file=sys.stderr)
Expand Down
11 changes: 9 additions & 2 deletions src/rosdep2/sources_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ def _generate_key_from_urls(urls):


def update_sources_list(sources_list_dir=None, sources_cache_dir=None,
success_handler=None, error_handler=None):
success_handler=None, error_handler=None,
skip_eol_distros=False):
"""
Re-downloaded data from remote sources and store in cache. Also
update the cache index based on current sources.
Expand All @@ -452,6 +453,7 @@ def update_sources_list(sources_list_dir=None, sources_cache_dir=None,
:param error_handler: fn(DataSource, DownloadFailure) to call
if a particular source fails. This hook is mainly for
printing errors to console.
:param skip_eol_distros: skip downloading sources for EOL distros

:returns: list of (`DataSource`, cache_file_path) pairs for cache
files that were updated, ``[str]``
Expand Down Expand Up @@ -485,11 +487,16 @@ def update_sources_list(sources_list_dir=None, sources_cache_dir=None,
# In compliance with REP137 and REP143
print('Query rosdistro index %s' % get_index_url())
for dist_name in sorted(get_index().distributions.keys()):
distribution = get_index().distributions[dist_name]
if skip_eol_distros:
if distribution.get('distribution_status') == 'end-of-life':
print('Skip end-of-life distro "%s"' % dist_name)
continue
print('Add distro "%s"' % dist_name)
rds = RosDistroSource(dist_name)
rosdep_data = get_gbprepo_as_rosdep_data(dist_name)
# dist_files can either be a string (single filename) or a list (list of filenames)
dist_files = get_index().distributions[dist_name]['distribution']
dist_files = distribution['distribution']
key = _generate_key_from_urls(dist_files)
retval.append((rds, write_cache_file(sources_cache_dir, key, rosdep_data)))
sources.append(rds)
Expand Down