Commit a2952e62 authored by Jochen Sprickerhof's avatar Jochen Sprickerhof

Merge tag 'upstream/0.11.0'

Upstream version 0.11.0
parents cf2008ab c3a0d964
......@@ -8,7 +8,7 @@ setup(
packages=['rosdep2', 'rosdep2.platforms'],
package_dir={'': 'src'},
install_requires=['catkin_pkg', 'rospkg', 'rosdistro >= 0.3.0', 'PyYAML >= 3.1'],
install_requires=['catkin_pkg', 'rospkg', 'rosdistro >= 0.4.0', 'PyYAML >= 3.1'],
setup_requires=['nose >= 1.0'],
__version__ = '0.10.33'
__version__ = '0.11.0'
......@@ -173,6 +173,7 @@ class RosDistroSource(DataSource):
def __init__(self, distro):
self.type = TYPE_GBPDISTRO
self.tags = [distro]
# In this case self.url is a list if REP-143 is being used
self.url = get_index().distributions[distro]['distribution']
self.origin = None
......@@ -319,7 +320,7 @@ def download_default_sources_list(url=DEFAULT_SOURCES_LIST_URL):
data =
if not data:
raise InvalidSourceFile("cannot download defaults file: empty contents")
raise RuntimeError("cannot download defaults file: empty contents")
# parse just for validation
return data
......@@ -402,6 +403,17 @@ def parse_sources_list(sources_list_dir=None):
return sources_list
def _generate_key_from_urls(urls):
# urls may be a list of urls or a single string
assert isinstance(urls, (list, basestring))
except NameError:
assert isinstance(urls, (list, str))
# We join the urls by the '^' character because it is not allowed in urls
return '^'.join(urls if isinstance(urls, list) else [urls])
def update_sources_list(sources_list_dir=None, sources_cache_dir=None,
success_handler=None, error_handler=None):
......@@ -446,14 +458,16 @@ def update_sources_list(sources_list_dir=None, sources_cache_dir=None,
error_handler(source, e)
# Additional sources for ros distros
# In compliance with REP137
# In compliance with REP137 and REP143
print('Query rosdistro index %s' % get_index_url())
for dist_name in sorted(get_index().distributions.keys()):
print('Add distro "%s"' % dist_name)
rds = RosDistroSource(dist_name)
rosdep_data = get_gbprepo_as_rosdep_data(dist_name)
dist = get_index().distributions[dist_name]
retval.append((rds, write_cache_file(sources_cache_dir, dist['distribution'], rosdep_data)))
# dist_files can either be a string (single filename) or a list (list of filenames)
dist_files = get_index().distributions[dist_name]['distribution']
key = _generate_key_from_urls(dist_files)
retval.append((rds, write_cache_file(sources_cache_dir, key, rosdep_data)))
# Create a combined index of *all* the sources. We do all the
......@@ -465,7 +479,8 @@ def update_sources_list(sources_list_dir=None, sources_cache_dir=None,
cache_index = os.path.join(sources_cache_dir, CACHE_INDEX)
data = "#autogenerated by rosdep, do not edit. use 'rosdep update' instead\n"
for source in sources:
data += "yaml %s %s\n" % (source.url, ' '.join(source.tags))
url = _generate_key_from_urls(source.url)
data += "yaml %s %s\n" % (url, ' '.join(source.tags))
write_atomic(cache_index, data)
# mainly for debugging and testing
return retval
......@@ -492,15 +507,21 @@ def load_cached_sources_list(sources_cache_dir=None, verbose=False):
model = cache_data_source_loader(sources_cache_dir, verbose=verbose)
return parse_sources_data(cache_data, origin=cache_index, model=model)
def compute_filename_hash(filename_key):
def compute_filename_hash(key_filenames):
sha_hash = hashlib.sha1()
if isinstance(key_filenames, list):
for key in key_filenames:
return sha_hash.hexdigest()
def write_cache_file(source_cache_d, filename_key, rosdep_data):
def write_cache_file(source_cache_d, key_filenames, rosdep_data):
:param source_cache_d: directory to write cache file to
:param filename_key: hash of filename is used to store data in
:param key_filenames: filename (or list of filenames) to be used in hashing
:param rosdep_data: dictionary of data to serialize as YAML
:returns: name of file where cache is stored
:raises: :exc:`OSError` if cannot write to cache file/directory
......@@ -508,7 +529,7 @@ def write_cache_file(source_cache_d, filename_key, rosdep_data):
if not os.path.exists(source_cache_d):
key_hash = compute_filename_hash(filename_key)
key_hash = compute_filename_hash(key_filenames)
filepath = os.path.join(source_cache_d, key_hash)
write_atomic(filepath + PICKLE_CACHE_EXT, pickle.dumps(rosdep_data, -1), True)
......@@ -520,6 +541,7 @@ def write_cache_file(source_cache_d, filename_key, rosdep_data):
return filepath
def write_atomic(filepath, data, binary=False):
# write data to new file
fd, filepath_tmp = tempfile.mkstemp(prefix=os.path.basename(filepath) + '.tmp.', dir=os.path.dirname(filepath))
Depends: python-rospkg, python-yaml, python-catkin-pkg, python-rosdistro (>= 0.3.0)
Depends3: python3-rospkg, python3-yaml, python3-catkin-pkg, python3-rosdistro (>= 0.3.0)
Suite: oneiric precise quantal raring saucy trusty utopic wheezy jessie
Depends: python-rospkg, python-yaml, python-catkin-pkg, python-rosdistro (>= 0.4.0)
Depends3: python3-rospkg, python3-yaml, python3-catkin-pkg, python3-rosdistro (>= 0.4.0)
Suite: oneiric precise quantal raring saucy trusty utopic vivid wheezy jessie
X-Python3-Version: >= 3.2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment