Skip to content

Commit

Permalink
skip EOL distros by default, add option to include them (#647)
Browse files Browse the repository at this point in the history
* skip EOL distros by default, add option to include them

* add param doc

* invert param logic to keep API behavior
  • Loading branch information
dirk-thomas authored Jan 14, 2019
1 parent 74e473f commit ae0e89a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
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

0 comments on commit ae0e89a

Please sign in to comment.