├── .gitignore ├── README.md └── rosdep-generator /.gitignore: -------------------------------------------------------------------------------- 1 | *.yaml 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | rosdep-generator 2 | ================ 3 | 4 | If you use [bloom](http://wiki.ros.org/bloom) to release catkin packages into a rosdistro other than the public 5 | one, you've probably come across a situation 6 | [like this one](http://answers.ros.org/question/135976/bloom-could-not-resolve-rosdep-key-message_runtime/), 7 | where the package you want to build depends on a package in the public rosdistro, and bloom doesn't know how to 8 | resolve the rosdep key, since you've changed `ROSDISTRO_INDEX_URL`. 9 | 10 | Enter *rosdep-generator*, which parses the rosdistro file, and dumps a rosdep-formatted yaml into the current 11 | directory: 12 | 13 | ``` 14 | $ ./rosdep-generator --distro indigo 15 | Downloading: https://github.com/ros/rosdistro/raw/master/indigo/distribution.yaml 16 | Parsing 250264 bytes of yaml. 17 | Extracting package names. 18 | Assembling output yaml structure. 19 | Outputting: ros-rosdistro-indigo.yaml 20 | Complete. Suggested next steps: 21 | 22 | sudo sh -c 'echo "yaml file:///Users/mikepurvis/rosdep-generator/ros-rosdistro-indigo.yaml indigo" > /etc/ros/rosdep/sources.list.d/90-ros-rosdistro-indigo.list' 23 | rosdep update 24 | ``` 25 | 26 | Execute the next steps to make rosdep aware of the public packages, then run: 27 | 28 | ``` 29 | $ export ROSDISTRO_INDEX_URL=https://github.com/me/my-secret-rosdistro/raw/master/index.yaml 30 | $ bloom-release -r indigo -t indigo my_secrete_package 31 | ``` 32 | 33 | Bloom will find your dependencies now. 34 | -------------------------------------------------------------------------------- /rosdep-generator: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import argparse 4 | import os 5 | import urllib2 6 | import yaml 7 | 8 | parser = argparse.ArgumentParser(description="Generate rosdep key mapping so that bloom can resolve dependencies for an overlaid rosdistro.") 9 | parser.add_argument("--org", default="ros", help="Github org from which to fetch rosdistro.") 10 | parser.add_argument("--repo", default="rosdistro", help="Github repo from which to fetch rosdistro.") 11 | parser.add_argument("--distro", default="indigo", help="Distro to generate for.") 12 | parser.add_argument("--url", help="rosdistro to be used.") 13 | args = parser.parse_args() 14 | 15 | if args.url: 16 | url = args.url 17 | else: 18 | url = "https://github.com/%s/%s/raw/master/%s/distribution.yaml" % \ 19 | (args.org, args.repo, args.distro) 20 | 21 | print "Downloading: %s" % url 22 | response = urllib2.urlopen(url) 23 | response_text = response.read() 24 | print "Parsing %d bytes of yaml." % len(response_text) 25 | distribution = yaml.load(response_text) 26 | 27 | print "Extracting package names." 28 | platforms = distribution['release_platforms'].keys() 29 | packages = set() 30 | for name, meta in distribution['repositories'].iteritems(): 31 | if 'release' in meta: 32 | if 'packages' in meta['release']: 33 | packages.update(meta['release']['packages']) 34 | else: 35 | packages.add(name) 36 | 37 | output_yaml = {} 38 | print "Assembling output yaml structure." 39 | for package in packages: 40 | output_yaml[package] = {} 41 | for platform in platforms: 42 | output_yaml[package][platform] = "ros-%s-%s" % (args.distro, package.replace("_", "-")) 43 | 44 | output_file = "%s-%s-%s.yaml" % (args.org, args.repo, args.distro) 45 | print "Outputting: %s" % output_file 46 | with open(output_file, "w") as f: 47 | yaml.dump(output_yaml, f) 48 | 49 | print "Complete. Suggested next steps:" 50 | print 51 | print ' sudo sh -c \'echo "yaml file://%s/%s %s" > /etc/ros/rosdep/sources.list.d/90-%s-%s-%s.list\'' % \ 52 | (os.getcwd(), output_file, args.distro, args.org, args.repo, args.distro) 53 | print ' rosdep update' 54 | print 55 | --------------------------------------------------------------------------------