New upstream version 0.10.7
Timo Röhling
2 years ago
0 | name: bloom-ci | |
1 | ||
2 | on: | |
3 | push: | |
4 | branches: ['master'] | |
5 | pull_request: | |
6 | branches: ['*'] | |
7 | ||
8 | jobs: | |
9 | build: | |
10 | strategy: | |
11 | matrix: | |
12 | os: [ubuntu-16.04, ubuntu-18.04, ubuntu-20.04, macos-latest] | |
13 | python: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9] | |
14 | exclude: | |
15 | - os: ubuntu-16.04 | |
16 | python: 3.6 | |
17 | - os: ubuntu-16.04 | |
18 | python: 3.7 | |
19 | - os: ubuntu-16.04 | |
20 | python: 3.8 | |
21 | - os: ubuntu-16.04 | |
22 | python: 3.9 | |
23 | - os: ubuntu-18.04 | |
24 | python: 3.5 | |
25 | - os: ubuntu-20.04 | |
26 | python: 2.7 | |
27 | - os: ubuntu-20.04 | |
28 | python: 3.5 | |
29 | - os: ubuntu-20.04 | |
30 | python: 3.6 | |
31 | - os: ubuntu-20.04 | |
32 | python: 3.7 | |
33 | - os: macos-latest | |
34 | python: 3.5 | |
35 | - os: macos-latest | |
36 | python: 3.6 | |
37 | name: bloom tests | |
38 | runs-on: ${{matrix.os}} | |
39 | ||
40 | steps: | |
41 | - uses: actions/checkout@v2 | |
42 | - name: Set up Python ${{matrix.python}} | |
43 | uses: actions/setup-python@v1 | |
44 | with: | |
45 | python-version: ${{matrix.python}} | |
46 | - name: Install dependencies | |
47 | run: | | |
48 | python -m pip install --upgrade pip setuptools | |
49 | python -m pip install PyYAML argparse empy rosdep vcstools catkin-pkg python-dateutil | |
50 | python -m pip install nose coverage pep8 | |
51 | - name: Run tests | |
52 | run: | | |
53 | BLOOM_VERBOSE=1 python setup.py nosetests -s --tests test |
0 | 0 | language: python |
1 | 1 | python: |
2 | - "2.7" | |
3 | 2 | - "3.4" # When support for 3.4 is removed unpin the PyYAML version below. |
4 | - "3.6" | |
5 | - "3.7" | |
6 | - "3.8" | |
7 | 3 | # command to install dependencies |
8 | 4 | install: |
9 | 5 | - if [ $TRAVIS_PYTHON_VERSION == "3.4" ]; then pip install PyYAML==5.2; fi # Forcing PyYAML 5.2 while we retain Python 3.4 support PyYAML 5.3 and higher does not support python 3.4 |
10 | - pip install PyYAML argparse rosdep vcstools catkin-pkg python-dateutil setuptools | |
6 | - pip install PyYAML argparse empy rosdep vcstools catkin-pkg python-dateutil setuptools | |
11 | 7 | - pip install nose coverage pep8 |
12 | - git clone https://github.com/dirk-thomas/empy.git /tmp/empy | |
13 | - cd /tmp/empy | |
14 | - python setup.py install | |
15 | - cd - | |
16 | - sudo `which rosdep` init | |
17 | - rosdep update | |
18 | 8 | # command to run tests |
19 | 9 | script: |
20 | 10 | - BLOOM_VERBOSE=1 python setup.py nosetests -s --tests test |
0 | 0.10.7 (2021-04-16 11:30:00 -0700) | |
1 | ---------------------------------- | |
2 | - Fix basic authentication issue affecting new GitHub tokens. `#633 <https://github.com/ros-infrastructure/bloom/issues/633>`_ | |
3 | ||
4 | 0.10.6 (2021-04-07 11:30:00 -0700) | |
5 | --------------------------------- | |
6 | - Fix a packaging bug affecting only Debian packages. | |
7 | ||
8 | 0.10.5 (2021-04-07 10:30:00 -0700) | |
9 | --------------------------------- | |
10 | - Fix a packaging bug affecting only Debian packages. | |
11 | ||
12 | 0.10.4 (2021-04-07 10:00:00 -0700) | |
13 | ---------------------------------- | |
14 | - Use basic authentication with the new personal access tokens. `#627 <https://github.com/ros-infrastructure/bloom/issues/627>`_ | |
15 | - Add a fast check for the likely fork name. `#629 <https://github.com/ros-infrastructure/bloom/issues/629>`_ | |
16 | - Specify patch level in RPM templates. `#626 <https://github.com/ros-infrastructure/bloom/issues/626>`_ | |
17 | - Collect manually created token rather than attempting to create one. `#628 <https://github.com/ros-infrastructure/bloom/issues/628>`_ | |
18 | ||
19 | 0.10.3 (2021-03-25 11:08:00 -0700) | |
20 | ---------------------------------- | |
21 | - Rewire the typesupport dependencies for post-Foxy. `#625 <https://github.com/ros-infrastructure/bloom/issues/625>`_ | |
22 | ||
23 | 0.10.2 (2021-03-11 17:05:00 -0800) | |
24 | ---------------------------------- | |
25 | - Drop Connext from typesupport dependencies for RPMs `#623 <https://github.com/ros-infrastructure/bloom/issues/623>`_ | |
26 | - Enable output from CTest failures in RPMs `#620 <https://github.com/ros-infrastructure/bloom/issues/620>`_ | |
27 | - Only suggest resetting action list if it's old `#622 <https://github.com/ros-infrastructure/bloom/issues/622>`_ | |
28 | ||
29 | 0.10.1 (2021-02-04 15:00:00 -0800) | |
30 | ---------------------------------- | |
31 | - Do not verify package version on ignored packages `#610 <https://github.com/ros-infrastructure/bloom/pull/610>`_ | |
32 | - Update email addresses and remove 404 download url `#607 <https://github.com/ros-infrastructure/bloom/pull/607>`_ | |
33 | - Align CMake args in RPMs with debs `#617 <https://github.com/ros-infrastructure/bloom/pull/617>`_ | |
34 | - Add a template substitution for the ROS distro `#612 <https://github.com/ros-infrastructure/bloom/pull/612>`_ | |
35 | - Create and use a 'fake' rosdep cache for tests `#614 <https://github.com/ros-infrastructure/bloom/pull/614>`_ | |
36 | - Add --debian-inc option to bloom-generate `#428 <https://github.com/ros-infrastructure/bloom/pull/428>`_ | |
37 | - Solve shlibdeps errors in REP136 packages that use GNUInstallDirs. `#600 <https://github.com/ros-infrastructure/bloom/pull/600>`_ | |
38 | - Don't prompt if --override-release-repository-url `#594 <https://github.com/ros-infrastructure/bloom/pull/594>`_ | |
39 | ||
0 | 40 | 0.10.0 (2020-09-28 16:30:00 -0700) |
1 | 41 | ---------------------------------- |
2 | 42 | - Add CMAKE_PREFIX_PATH to ament_cmake and cmake templates `#606 <https://github.com/ros-infrastructure/bloom/pull/606>`_ |
40 | 80 | |
41 | 81 | 0.9.2 (2020-03-02 13:00:00 -0800) |
42 | 82 | --------------------------------- |
43 | - Add option to disable weak RPM dependencies. `#574 <https://github.com/cottsay/bloom/issues/574>`_ | |
44 | - If not interactive, don't prompt to fix broken rosdep keys. `#573 <https://github.com/cottsay/bloom/issues/573>`_ | |
45 | - Make the RPM spec templates look more like the results. `#568 <https://github.com/cottsay/bloom/issues/568>`_ | |
46 | - Suppress automatic rosdep with BLOOM_SKIP_ROSDEP_UPDATE. `#565 <https://github.com/cottsay/bloom/issues/565>`_ | |
47 | - Provide group membership information in RPM packages. `#564 <https://github.com/cottsay/bloom/issues/564>`_ | |
48 | - Add an optional release version suffix to RPM templates. `#569 <https://github.com/cottsay/bloom/issues/569>`_ | |
49 | - Drop Connext from RPM RMW list. `#566 <https://github.com/cottsay/bloom/issues/566>`_ | |
50 | - Provide -devel, -doc and -runtime virtual packages in RPM. `#563 <https://github.com/cottsay/bloom/issues/563>`_ | |
51 | - Print the OS name along with OS version for RPMs. `#562 <https://github.com/cottsay/bloom/issues/562>`_ | |
83 | - Add option to disable weak RPM dependencies. `#574 <https://github.com/ros-infrastructure/bloom/issues/574>`_ | |
84 | - If not interactive, don't prompt to fix broken rosdep keys. `#573 <https://github.com/ros-infrastructure/bloom/issues/573>`_ | |
85 | - Make the RPM spec templates look more like the results. `#568 <https://github.com/ros-infrastructure/bloom/issues/568>`_ | |
86 | - Suppress automatic rosdep with BLOOM_SKIP_ROSDEP_UPDATE. `#565 <https://github.com/ros-infrastructure/bloom/issues/565>`_ | |
87 | - Provide group membership information in RPM packages. `#564 <https://github.com/ros-infrastructure/bloom/issues/564>`_ | |
88 | - Add an optional release version suffix to RPM templates. `#569 <https://github.com/ros-infrastructure/bloom/issues/569>`_ | |
89 | - Drop Connext from RPM RMW list. `#566 <https://github.com/ros-infrastructure/bloom/issues/566>`_ | |
90 | - Provide -devel, -doc and -runtime virtual packages in RPM. `#563 <https://github.com/ros-infrastructure/bloom/issues/563>`_ | |
91 | - Print the OS name along with OS version for RPMs. `#562 <https://github.com/ros-infrastructure/bloom/issues/562>`_ | |
52 | 92 | |
53 | 93 | 0.9.1 (2020-02-03 10:00:00 -0800) |
54 | 94 | --------------------------------- |
37 | 37 | import subprocess |
38 | 38 | import sys |
39 | 39 | |
40 | from bloom.config import ACTION_LIST_HISTORY | |
40 | 41 | from bloom.config import BLOOM_CONFIG_BRANCH |
41 | 42 | from bloom.config import config_template |
42 | 43 | from bloom.config import DEFAULT_TEMPLATE |
215 | 216 | warning("Your track's '{0}' configuration is not the same as the default." |
216 | 217 | .format(key)) |
217 | 218 | default = 'n' |
218 | if key == 'actions': | |
219 | if key == 'actions' and track_dict[key] in ACTION_LIST_HISTORY: | |
219 | 220 | default = 'y' |
220 | 221 | warning("Unless you have manually modified your 'actions' " |
221 | 222 | "(the commands which get run for a release), " |
275 | 275 | |
276 | 276 | def get_release_repo(repository, distro, override_url): |
277 | 277 | global _repositories |
278 | url = get_repo_uri(repository, distro) | |
278 | ||
279 | if override_url is not None: | |
280 | warning("Overriding the release repository url, using '{0}'".format(override_url)) | |
281 | url = override_url | |
282 | else: | |
283 | url = get_repo_uri(repository, distro) | |
284 | ||
279 | 285 | if repository not in _repositories.values(): |
280 | 286 | temp_dir = tempfile.mkdtemp() |
281 | 287 | _repositories[repository] = get_vcs_client('git', temp_dir) |
282 | if override_url is not None: | |
283 | warning("Overriding the release repository url, using '{0}'".format(override_url)) | |
284 | url = override_url | |
285 | 288 | info(fmt("@{gf}@!==> @|") + |
286 | 289 | "Fetching '{0}' repository from '{1}'".format(repository, url)) |
287 | 290 | _repositories[repository].checkout(url, 'master') |
675 | 678 | # Check if a fork already exists on the user's account |
676 | 679 | |
677 | 680 | try: |
678 | repo_forks = gh.list_forks(base_info['org'], base_info['repo']) | |
679 | user_forks = [r for r in repo_forks if r.get('owner', {}).get('login', '') == gh.username] | |
680 | # github allows only 1 fork per org as far as I know. We just take the first one. | |
681 | head_repo = user_forks[0] if user_forks else None | |
681 | # There are a lot of forks of the ros/rosdistro repository so | |
682 | # listing those forks takes a very long time. | |
683 | # Let's try a little shortcut by checking if the repository of | |
684 | # the same name owned by the current GitHub user, if that | |
685 | # repository exists and is in the same fork network as the | |
686 | # target repo let's take it. | |
687 | # If it is not, we still fall back to listing forks. | |
688 | target_repo = gh.get_repo(base_info['org'], base_info['repo']) | |
689 | target_repo_source = target_repo['full_name'] | |
690 | if target_repo['fork']: | |
691 | target_repo_source = target_repo['source']['full_name'] | |
692 | try: | |
693 | user_repo = gh.get_repo(gh.username, base_info['repo']) | |
694 | if user_repo['fork'] and user_repo['source']['full_name'] == target_repo_source: | |
695 | head_repo = user_repo | |
696 | except GithubException as exc: | |
697 | debug("Received GithubException while checking for fork: {exc}".format(**locals())) | |
698 | # 404 on finding an exact match repo. | |
699 | # Proceed listing all forks. | |
700 | pass | |
701 | if head_repo is None: | |
702 | repo_forks = gh.list_forks(base_info['org'], base_info['repo']) | |
703 | user_forks = [r for r in repo_forks if r.get('owner', {}).get('login', '') == gh.username] | |
704 | # github allows only 1 fork per org as far as I know. We just take the first one. | |
705 | head_repo = user_forks[0] if user_forks else None | |
682 | 706 | |
683 | 707 | except GithubException as exc: |
684 | 708 | debug("Received GithubException while checking for fork: {exc}".format(**locals())) |
177 | 177 | msg += fmt(" @!['@{yf}" + sanitize(self.default) + "@|@!']@|: ") |
178 | 178 | return msg |
179 | 179 | |
180 | ACTION_LIST_HISTORY = [ | |
181 | [ | |
182 | 'bloom-export-upstream :{vcs_local_uri} :{vcs_type}' | |
183 | ' --tag :{release_tag} --display-uri :{vcs_uri}' | |
184 | ' --name :{name} --output-dir :{archive_dir_path}', | |
185 | 'git-bloom-import-upstream :{archive_path} :{patches}' | |
186 | ' --release-version :{version} --replace', | |
187 | 'git-bloom-generate -y rosrelease :{ros_distro}' | |
188 | ' --source upstream -i :{release_inc}', | |
189 | 'git-bloom-generate -y rosdebian --prefix release/:{ros_distro}' | |
190 | ' :{ros_distro} -i :{release_inc}' | |
191 | ], | |
192 | [ | |
193 | 'bloom-export-upstream :{vcs_local_uri} :{vcs_type}' | |
194 | ' --tag :{release_tag} --display-uri :{vcs_uri}' | |
195 | ' --name :{name} --output-dir :{archive_dir_path}', | |
196 | 'git-bloom-import-upstream :{archive_path} :{patches}' | |
197 | ' --release-version :{version} --replace', | |
198 | 'git-bloom-generate -y rosrelease :{ros_distro}' | |
199 | ' --source upstream -i :{release_inc}', | |
200 | 'git-bloom-generate -y rosdebian --prefix release/:{ros_distro}' | |
201 | ' :{ros_distro} -i :{release_inc}', | |
202 | 'git-bloom-generate -y rosrpm --prefix release/:{ros_distro}' | |
203 | ' :{ros_distro} -i :{release_inc}' | |
204 | ], | |
205 | [ | |
206 | 'bloom-export-upstream :{vcs_local_uri} :{vcs_type}' | |
207 | ' --tag :{release_tag} --display-uri :{vcs_uri}' | |
208 | ' --name :{name} --output-dir :{archive_dir_path}', | |
209 | 'git-bloom-import-upstream :{archive_path} :{patches}' | |
210 | ' --release-version :{version} --replace', | |
211 | 'git-bloom-generate -y rosrelease :{ros_distro}' | |
212 | ' --source upstream -i :{release_inc}', | |
213 | 'git-bloom-generate -y rosdebian --prefix release/:{ros_distro}' | |
214 | ' :{ros_distro} -i :{release_inc} --os-name ubuntu', | |
215 | 'git-bloom-generate -y rosdebian --prefix release/:{ros_distro}' | |
216 | ' :{ros_distro} -i :{release_inc} --os-name debian --os-not-required', | |
217 | 'git-bloom-generate -y rosrpm --prefix release/:{ros_distro}' | |
218 | ' :{ros_distro} -i :{release_inc}' | |
219 | ], | |
220 | [ | |
221 | 'bloom-export-upstream :{vcs_local_uri} :{vcs_type}' | |
222 | ' --tag :{release_tag} --display-uri :{vcs_uri}' | |
223 | ' --name :{name} --output-dir :{archive_dir_path}', | |
224 | 'git-bloom-import-upstream :{archive_path} :{patches}' | |
225 | ' --release-version :{version} --replace', | |
226 | 'git-bloom-generate -y rosrelease :{ros_distro}' | |
227 | ' --source upstream -i :{release_inc}', | |
228 | 'git-bloom-generate -y rosdebian --prefix release/:{ros_distro}' | |
229 | ' :{ros_distro} -i :{release_inc} --os-name ubuntu', | |
230 | 'git-bloom-generate -y rosdebian --prefix release/:{ros_distro}' | |
231 | ' :{ros_distro} -i :{release_inc} --os-name debian --os-not-required', | |
232 | 'git-bloom-generate -y rosrpm --prefix release/:{ros_distro}' | |
233 | ' :{ros_distro} -i :{release_inc} --os-name fedora', | |
234 | 'git-bloom-generate -y rosrpm --prefix release/:{ros_distro}' | |
235 | ' :{ros_distro} -i :{release_inc} --os-name rhel', | |
236 | ] | |
237 | ] | |
238 | ||
180 | 239 | DEFAULT_TEMPLATE = { |
181 | 240 | 'name': PromptEntry('Repository Name', spec=config_spec['name'], default='upstream'), |
182 | 241 | 'vcs_uri': PromptEntry('Upstream Repository URI', spec=config_spec['vcs_uri']), |
190 | 249 | 'ros_distro': PromptEntry('ROS Distro', default='indigo', spec=config_spec['ros_distro']), |
191 | 250 | 'release_repo_url': PromptEntry('Release Repository Push URL', spec=config_spec['release_repo_url']), |
192 | 251 | 'release_inc': 0, |
193 | 'actions': [ | |
194 | 'bloom-export-upstream :{vcs_local_uri} :{vcs_type}' | |
195 | ' --tag :{release_tag} --display-uri :{vcs_uri}' | |
196 | ' --name :{name} --output-dir :{archive_dir_path}', | |
197 | 'git-bloom-import-upstream :{archive_path} :{patches}' | |
198 | ' --release-version :{version} --replace', | |
199 | 'git-bloom-generate -y rosrelease :{ros_distro}' | |
200 | ' --source upstream -i :{release_inc}', | |
201 | 'git-bloom-generate -y rosdebian --prefix release/:{ros_distro}' | |
202 | ' :{ros_distro} -i :{release_inc} --os-name ubuntu', | |
203 | 'git-bloom-generate -y rosdebian --prefix release/:{ros_distro}' | |
204 | ' :{ros_distro} -i :{release_inc} --os-name debian --os-not-required', | |
205 | 'git-bloom-generate -y rosrpm --prefix release/:{ros_distro}' | |
206 | ' :{ros_distro} -i :{release_inc} --os-name fedora', | |
207 | 'git-bloom-generate -y rosrpm --prefix release/:{ros_distro}' | |
208 | ' :{ros_distro} -i :{release_inc} --os-name rhel', | |
209 | ] | |
252 | 'actions': ACTION_LIST_HISTORY[-1] | |
210 | 253 | } |
211 | 254 | |
212 | 255 | CUSTOM_TEMPLATE = { |
74 | 74 | add('--os-name', help='OS name, e.g. ubuntu, debian') |
75 | 75 | add('--os-version', help='OS version or codename, e.g. precise, wheezy') |
76 | 76 | add('--ros-distro', help="ROS distro, e.g. %s (used for rosdep)" % get_distro_list_prompt()) |
77 | add('-i', '--debian-inc', help="debian increment number", default='0') | |
77 | 78 | add('--native', action='store_true', help="generate native package") |
78 | 79 | return parser |
79 | 80 | |
80 | 81 | |
81 | def get_subs(pkg, os_name, os_version, ros_distro, native=False): | |
82 | def get_subs(pkg, os_name, os_version, ros_distro, deb_inc=0, native=False): | |
82 | 83 | return generate_substitutions_from_package( |
83 | 84 | pkg, |
84 | 85 | os_name, |
85 | 86 | os_version, |
86 | 87 | ros_distro, |
88 | deb_inc=deb_inc, | |
87 | 89 | native=native |
88 | 90 | ) |
89 | 91 | |
122 | 124 | for path, pkg in pkgs_dict.items(): |
123 | 125 | template_files = None |
124 | 126 | try: |
125 | subs = get_subs_fn(pkg, os_name, os_version, ros_distro, args.native) | |
127 | subs = get_subs_fn(pkg, os_name, os_version, ros_distro, args.debian_inc, args.native) | |
126 | 128 | if _place_template_files: |
127 | 129 | # Place template files |
128 | 130 | place_template_files(path, pkg.get_build_type()) |
16 | 16 | # Explicitly enable -DNDEBUG, see: |
17 | 17 | # https://github.com/ros-infrastructure/bloom/issues/327 |
18 | 18 | export DEB_CXXFLAGS_MAINT_APPEND=-DNDEBUG |
19 | ||
20 | # Solve shlibdeps errors in REP136 packages that use GNUInstallDirs: | |
21 | export DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) | |
19 | 22 | |
20 | 23 | %: |
21 | 24 | dh $@@ -v --buildsystem=cmake |
49 | 52 | # in the install tree and source it. It will set things like |
50 | 53 | # CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. |
51 | 54 | if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi && \ |
52 | dh_shlibdeps -l$(CURDIR)/debian/@(Package)/@(InstallationPrefix)/lib/ | |
55 | dh_shlibdeps -l$(CURDIR)/debian/@(Package)/@(InstallationPrefix)/lib/:$(CURDIR)/debian/@(Package)/@(InstallationPrefix)/lib/${DEB_HOST_MULTIARCH} | |
53 | 56 | |
54 | 57 | override_dh_auto_install: |
55 | 58 | # In case we're installing to a non-standard location, look for a setup.sh |
70 | 70 | info("Releasing for rosdistro: " + self.rosdistro) |
71 | 71 | return ret |
72 | 72 | |
73 | def get_subs(self, package, debian_distro, releaser_history, native=False): | |
73 | def get_subs(self, package, debian_distro, releaser_history, deb_inc=0, native=False): | |
74 | 74 | def fallback_resolver(key, peer_packages, rosdistro=self.rosdistro): |
75 | 75 | if key in peer_packages: |
76 | 76 | return [sanitize_package_name(rosify_package_name(key, rosdistro))] |
86 | 86 | releaser_history=releaser_history, |
87 | 87 | fallback_resolver=fallback_resolver |
88 | 88 | ) |
89 | subs['Rosdistro'] = self.rosdistro | |
89 | 90 | subs['Package'] = rosify_package_name(subs['Package'], self.rosdistro) |
90 | 91 | |
91 | 92 | # ROS 2 specific bloom extensions. |
106 | 107 | self.rosdistro not in ('r2b2', 'r2b3', 'ardent') and \ |
107 | 108 | 'rosidl_interface_packages' in [p.name for p in package.member_of_groups]: |
108 | 109 | ROS2_VENDOR_TYPESUPPORT_DEPENDENCIES = [ |
109 | 'rosidl-typesupport-connext-c', | |
110 | 'rosidl-typesupport-connext-cpp', | |
111 | 110 | 'rosidl-typesupport-fastrtps-c', |
112 | 111 | 'rosidl-typesupport-fastrtps-cpp', |
113 | 112 | ] |
113 | ||
114 | # Connext was changed to a new rmw that doesn't require typesupport after Foxy | |
115 | if self.rosdistro in ('bouncy', 'crystal', 'dashing', 'eloquent', 'foxy'): | |
116 | ROS2_VENDOR_TYPESUPPORT_DEPENDENCIES.extend([ | |
117 | 'rosidl-typesupport-connext-c', | |
118 | 'rosidl-typesupport-connext-cpp', | |
119 | ]) | |
120 | ||
114 | 121 | # OpenSplice was dropped after Eloquent. |
115 | 122 | # rmw implementations are required as dependencies up to Eloquent. |
116 | if self.rosdistro in ['bouncy', 'crystal', 'dashing', 'eloquent']: | |
123 | if self.rosdistro in ('bouncy', 'crystal', 'dashing', 'eloquent'): | |
117 | 124 | ROS2_VENDOR_TYPESUPPORT_DEPENDENCIES.extend([ |
118 | 125 | 'rmw-connext-cpp', |
119 | 126 | 'rmw-fastrtps-cpp', |
145 | 152 | return 'ros-{0}-{1}'.format(rosdistro, name) |
146 | 153 | |
147 | 154 | |
148 | def get_subs(pkg, os_name, os_version, ros_distro, native): | |
155 | def get_subs(pkg, os_name, os_version, ros_distro, deb_inc, native): | |
149 | 156 | # No fallback_resolver provided because peer packages not considered. |
150 | 157 | subs = generate_substitutions_from_package( |
151 | 158 | pkg, |
153 | 160 | os_version, |
154 | 161 | ros_distro, |
155 | 162 | RosDebianGenerator.default_install_prefix + ros_distro, |
163 | deb_inc=deb_inc, | |
156 | 164 | native=native |
157 | 165 | ) |
158 | 166 | subs['Package'] = rosify_package_name(subs['Package'], ros_distro) |
87 | 87 | fallback_resolver=fallback_resolver, |
88 | 88 | skip_keys=self.skip_keys |
89 | 89 | ) |
90 | subs['Rosdistro'] = self.rosdistro | |
90 | 91 | subs['Package'] = rosify_package_name(subs['Package'], self.rosdistro) |
91 | 92 | |
92 | 93 | # Virtual packages |
120 | 121 | self.rosdistro not in ('r2b2', 'r2b3', 'ardent') and \ |
121 | 122 | 'rosidl_interface_packages' in [p.name for p in package.member_of_groups]: |
122 | 123 | ROS2_VENDOR_TYPESUPPORT_DEPENDENCIES = [ |
123 | 'rosidl-typesupport-connext-c', | |
124 | 'rosidl-typesupport-connext-cpp', | |
125 | 124 | 'rosidl-typesupport-fastrtps-c', |
126 | 125 | 'rosidl-typesupport-fastrtps-cpp', |
127 | 126 | ] |
129 | 128 | # rmw implementations are required as dependencies up to Eloquent. |
130 | 129 | if self.rosdistro in ['bouncy', 'crystal', 'dashing', 'eloquent']: |
131 | 130 | ROS2_VENDOR_TYPESUPPORT_DEPENDENCIES.extend([ |
132 | 'rmw-connext-cpp', | |
133 | 131 | 'rmw-fastrtps-cpp', |
134 | 132 | 'rmw-implementation', |
135 | 133 | 'rmw-opensplice-cpp', |
27 | 27 | @(Description) |
28 | 28 | |
29 | 29 | %prep |
30 | %autosetup | |
30 | %autosetup -p1 | |
31 | 31 | |
32 | 32 | %build |
33 | 33 | # In case we're installing to a non-standard location, look for a setup.sh |
41 | 41 | -USYSCONF_INSTALL_DIR \ |
42 | 42 | -USHARE_INSTALL_PREFIX \ |
43 | 43 | -ULIB_SUFFIX \ |
44 | -DCMAKE_INSTALL_LIBDIR="lib" \ | |
45 | 44 | -DCMAKE_INSTALL_PREFIX="@(InstallationPrefix)" \ |
45 | -DAMENT_PREFIX_PATH="@(InstallationPrefix)" \ | |
46 | 46 | -DCMAKE_PREFIX_PATH="@(InstallationPrefix)" \ |
47 | 47 | -DSETUPTOOLS_DEB_LAYOUT=OFF \ |
48 | 48 | .. |
65 | 65 | # in the install tree and source it. It will set things like |
66 | 66 | # CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. |
67 | 67 | if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi |
68 | %make_build -C obj-%{_target_platform} $TEST_TARGET || echo "RPM TESTS FAILED" | |
68 | CTEST_OUTPUT_ON_FAILURE=1 \ | |
69 | %make_build -C obj-%{_target_platform} $TEST_TARGET || echo "RPM TESTS FAILED" | |
69 | 70 | else echo "RPM TESTS SKIPPED"; fi |
70 | 71 | %endif |
71 | 72 |
27 | 27 | @(Description) |
28 | 28 | |
29 | 29 | %prep |
30 | %autosetup | |
30 | %autosetup -p1 | |
31 | 31 | |
32 | 32 | %build |
33 | 33 | # In case we're installing to a non-standard location, look for a setup.sh |
26 | 26 | @(Description) |
27 | 27 | |
28 | 28 | %prep |
29 | %autosetup | |
29 | %autosetup -p1 | |
30 | 30 | |
31 | 31 | %build |
32 | 32 | # In case we're installing to a non-standard location, look for a setup.sh |
40 | 40 | -USYSCONF_INSTALL_DIR \ |
41 | 41 | -USHARE_INSTALL_PREFIX \ |
42 | 42 | -ULIB_SUFFIX \ |
43 | -DCMAKE_INSTALL_LIBDIR="lib" \ | |
44 | 43 | -DCMAKE_INSTALL_PREFIX="@(InstallationPrefix)" \ |
45 | 44 | -DCMAKE_PREFIX_PATH="@(InstallationPrefix)" \ |
46 | 45 | -DSETUPTOOLS_DEB_LAYOUT=OFF \ |
27 | 27 | @(Description) |
28 | 28 | |
29 | 29 | %prep |
30 | %autosetup | |
30 | %autosetup -p1 | |
31 | 31 | |
32 | 32 | %build |
33 | 33 | # In case we're installing to a non-standard location, look for a setup.sh |
41 | 41 | -USYSCONF_INSTALL_DIR \ |
42 | 42 | -USHARE_INSTALL_PREFIX \ |
43 | 43 | -ULIB_SUFFIX \ |
44 | -DCMAKE_INSTALL_LIBDIR="lib" \ | |
45 | 44 | -DCMAKE_INSTALL_PREFIX="@(InstallationPrefix)" \ |
46 | 45 | -DCMAKE_PREFIX_PATH="@(InstallationPrefix)" \ |
47 | 46 | -DSETUPTOOLS_DEB_LAYOUT=OFF \ |
65 | 64 | # in the install tree and source it. It will set things like |
66 | 65 | # CMAKE_PREFIX_PATH, PKG_CONFIG_PATH, and PYTHONPATH. |
67 | 66 | if [ -f "@(InstallationPrefix)/setup.sh" ]; then . "@(InstallationPrefix)/setup.sh"; fi |
68 | %make_build -C obj-%{_target_platform} $TEST_TARGET || echo "RPM TESTS FAILED" | |
67 | CTEST_OUTPUT_ON_FAILURE=1 \ | |
68 | %make_build -C obj-%{_target_platform} $TEST_TARGET || echo "RPM TESTS FAILED" | |
69 | 69 | else echo "RPM TESTS SKIPPED"; fi |
70 | 70 | %endif |
71 | 71 |
75 | 75 | auth_str = '{0}:{1}'.format(user, password) |
76 | 76 | if sys.version_info >= (3, 0): |
77 | 77 | auth_str = auth_str.encode() |
78 | return "Basic {0}".format(base64.b64encode(auth_str)) | |
78 | b64_encoded = base64.b64encode(auth_str) | |
79 | if sys.version_info >= (3, 0): | |
80 | b64_encoded = b64_encoded.decode() | |
81 | return "Basic {0}".format(b64_encoded) | |
82 | ||
83 | ||
84 | def auth_header_from_token(username, token): | |
85 | # Handle new GitHub personal access tokens | |
86 | # which are used with basic authentication. | |
87 | if token.startswith('ghp_'): | |
88 | return auth_header_from_basic_auth(username, token) | |
89 | else: | |
90 | return auth_header_from_oauth_token(token) | |
79 | 91 | |
80 | 92 | |
81 | 93 | def auth_header_from_oauth_token(token): |
152 | 164 | self.auth = auth |
153 | 165 | self.token = token |
154 | 166 | |
155 | def create_new_bloom_authorization(self, note=None, note_url=None, scopes=None, update_auth=False): | |
156 | payload = { | |
157 | "scopes": ['public_repo'] if scopes is None else scopes, | |
158 | "note": note or "bloom-{0} for {1} created on {2}".format( | |
159 | bloom.__version__, | |
160 | socket.gethostname(), | |
161 | datetime.datetime.now().isoformat()), | |
162 | "note_url": 'http://bloom.readthedocs.org/' if note_url is None else note_url | |
163 | } | |
164 | resp = do_github_post_req('/authorizations', payload, self.auth) | |
167 | def check_token_validity(self, username, token, update_auth=False): | |
168 | resp = do_github_get_req('/user', self.auth) | |
165 | 169 | resp_data = json_loads(resp) |
166 | resp_code = '{0}'.format(resp.getcode()) | |
167 | if resp_code not in ['201', '202'] or 'token' not in resp_data: | |
168 | raise GithubException("Failed to create a new oauth authorization", resp) | |
169 | token = resp_data['token'] | |
170 | if resp.getcode() != 200 or 'login' not in resp_data: | |
171 | raise GithubException('Token authorization unsuccessful', resp) | |
170 | 172 | if update_auth: |
171 | self.auth = auth_header_from_oauth_token(token) | |
173 | self.username = username | |
172 | 174 | self.token = token |
173 | return token | |
174 | 175 | |
175 | 176 | def get_repo(self, owner, repo): |
176 | 177 | resp = do_github_get_req('/repos/{owner}/{repo}'.format(**locals()), auth=self.auth) |
298 | 299 | token = config.get('oauth_token', None) |
299 | 300 | username = config.get('github_user', None) |
300 | 301 | if token and username: |
301 | return Github(username, auth=auth_header_from_oauth_token(token), token=token) | |
302 | return Github(username, auth=auth_header_from_token(username, token), token=token) | |
302 | 303 | if not os.path.isdir(os.path.dirname(oauth_config_path)): |
303 | 304 | os.makedirs(os.path.dirname(oauth_config_path)) |
304 | 305 | if quiet: |
306 | 307 | # Ok, now we have to ask for the user name and pass word |
307 | 308 | info("") |
308 | 309 | warning("Looks like bloom doesn't have an oauth token for you yet.") |
309 | warning("Therefore bloom will require your GitHub username and password just this once.") | |
310 | warning("With your GitHub username and password bloom will create an oauth token on your behalf.") | |
311 | warning("The token will be stored in `~/.config/bloom`.") | |
312 | warning("You can delete the token from that file to have a new token generated.") | |
313 | warning("Guard this token like a password, because it allows someone/something to act on your behalf.") | |
314 | warning("If you need to unauthorize it, remove it from the 'Applications' menu in your GitHub account page.") | |
310 | warning("You can create a token by visiting https://github.com/settings/tokens in your browser.") | |
311 | warning("For bloom to work the token must have at least `public_repo` scope.") | |
312 | warning("If you want bloom to be able to automatically update your fork of ros/rosdistro (recommended)") | |
313 | warning("then you must also enable the workflow scope for the token.") | |
314 | warning("If you need to unauthorize it, remove it from the 'Tokens' menu in your GitHub account settings.") | |
315 | 315 | info("") |
316 | if not maybe_continue('y', "Would you like to create an OAuth token now"): | |
316 | if not maybe_continue('y', 'Would you like to enter an access token now'): | |
317 | 317 | return None |
318 | 318 | token = None |
319 | 319 | while token is None: |
320 | 320 | try: |
321 | 321 | username = getpass.getuser() |
322 | 322 | username = safe_input("GitHub username [{0}]: ".format(username)) or username |
323 | password = getpass.getpass("GitHub password (never stored): ") | |
323 | token = getpass.getpass("GitHub access token: ").strip() | |
324 | 324 | except (KeyboardInterrupt, EOFError): |
325 | 325 | return None |
326 | if not password: | |
327 | error("No password was given, aborting.") | |
326 | if not token: | |
327 | error("No token was given, aborting.") | |
328 | 328 | return None |
329 | gh = Github(username, auth=auth_header_from_basic_auth(username, password)) | |
329 | gh = Github(username, auth=auth_header_from_token(username, token)) | |
330 | 330 | try: |
331 | token = gh.create_new_bloom_authorization(update_auth=True) | |
331 | gh.check_token_validity(username, token, update_auth=True) | |
332 | 332 | with open(oauth_config_path, 'w') as f: |
333 | 333 | config.update({'oauth_token': token, 'github_user': username}) |
334 | 334 | f.write(json.dumps(config)) |
87 | 87 | else: |
88 | 88 | log("found '" + list(packages.values())[0].name + "'.", |
89 | 89 | use_prefix=False) |
90 | version = verify_equal_package_versions(packages.values()) | |
91 | 90 | ignored_packages = get_ignored_packages(release_directory=release_directory) |
92 | 91 | for k, v in dict(packages).items(): |
93 | 92 | # Check for packages with upper case names |
105 | 104 | if packages == {}: |
106 | 105 | error("All packages that were found were also ignored, aborting.", |
107 | 106 | exit=True) |
107 | version = verify_equal_package_versions(packages.values()) | |
108 | 108 | return [p.name for p in packages.values()], version, packages |
109 | 109 | # Otherwise we have a problem |
110 | 110 | log("failed.", use_prefix=False) |
21 | 21 | |
22 | 22 | setup( |
23 | 23 | name='bloom', |
24 | version='0.10.0', | |
24 | version='0.10.7', | |
25 | 25 | packages=find_packages(exclude=['test', 'test.*']), |
26 | 26 | package_data={ |
27 | 27 | 'bloom.generators.debian': [ |
35 | 35 | include_package_data=True, |
36 | 36 | install_requires=install_requires, |
37 | 37 | author='Tully Foote, William Woodall', |
38 | author_email='tfoote@willowgarage.com, william@osrfoundation.org', | |
38 | author_email='tfoote@openrobotics.org, william@openrobotics.org', | |
39 | 39 | maintainer='William Woodall', |
40 | maintainer_email='william@osrfoundation.org', | |
40 | maintainer_email='william@openrobotics.org', | |
41 | 41 | url='http://www.ros.org/wiki/bloom', |
42 | download_url='http://pr.willowgarage.com/downloads/bloom/', | |
43 | 42 | keywords=['ROS'], |
44 | 43 | classifiers=['Programming Language :: Python', |
45 | 44 | 'License :: OSI Approved :: BSD License'], |
18 | 18 | from ..utils.common import bloom_answer |
19 | 19 | from ..utils.common import change_directory |
20 | 20 | from ..utils.common import in_temporary_directory |
21 | from ..utils.common import set_up_fake_rosdep | |
21 | 22 | from ..utils.common import user |
22 | 23 | from ..utils.package_version import change_upstream_version |
23 | 24 | |
87 | 88 | return os.getcwd() |
88 | 89 | |
89 | 90 | |
90 | def _test_unary_package_repository(release_dir, version, directory=None): | |
91 | def _test_unary_package_repository(release_dir, version, directory=None, env=None): | |
91 | 92 | print("Testing in {0} at version {1}".format(release_dir, version)) |
92 | 93 | with change_directory(release_dir): |
93 | 94 | # First run everything |
97 | 98 | cmd = cmd.format(' --quiet') |
98 | 99 | else: |
99 | 100 | cmd = cmd.format('') |
100 | user(cmd, silent=False) | |
101 | user(cmd, silent=False, env=env) | |
101 | 102 | ### |
102 | 103 | ### Import upstream |
103 | 104 | ### |
183 | 184 | Release a single package catkin (melodic) repository. |
184 | 185 | """ |
185 | 186 | directory = directory if directory is not None else os.getcwd() |
187 | # Initialize rosdep | |
188 | rosdep_dir = os.path.join(directory, 'foo_rosdep') | |
189 | env = dict(os.environ) | |
190 | fake_distros = {'melodic': {'ubuntu': ['bionic']}} | |
191 | fake_rosdeps = { | |
192 | 'catkin': {'ubuntu': []}, | |
193 | 'roscpp_core': {'ubuntu': []} | |
194 | } | |
195 | env.update(set_up_fake_rosdep(rosdep_dir, fake_distros, fake_rosdeps)) | |
186 | 196 | # Setup |
187 | 197 | upstream_dir = create_upstream_repository(['foo'], directory) |
188 | 198 | upstream_url = 'file://' + upstream_dir |
197 | 207 | versions = ['0.1.0', '0.1.1', '0.2.0'] |
198 | 208 | import bloom.commands.git.release |
199 | 209 | for index in range(len(versions)): |
200 | _test_unary_package_repository(release_dir, versions[index], directory) | |
210 | _test_unary_package_repository(release_dir, versions[index], directory, env=env) | |
201 | 211 | bloom.commands.git.release.upstream_repos = {} |
202 | 212 | if index != len(versions) - 1: |
203 | 213 | change_upstream_version(upstream_dir, versions[index + 1]) |
209 | 219 | Release a multi package catkin (melodic) repository. |
210 | 220 | """ |
211 | 221 | directory = directory if directory is not None else os.getcwd() |
222 | # Initialize rosdep | |
223 | rosdep_dir = os.path.join(directory, 'foo_rosdep') | |
224 | env = dict(os.environ) | |
225 | fake_distros = { | |
226 | 'melodic': { | |
227 | 'debian': ['stretch'], | |
228 | 'ubuntu': ['bionic'] | |
229 | } | |
230 | } | |
231 | fake_rosdeps = { | |
232 | 'catkin': {'debian': [], 'ubuntu': []}, | |
233 | 'roscpp_core': {'debian': [], 'ubuntu': []} | |
234 | } | |
235 | env.update(set_up_fake_rosdep(rosdep_dir, fake_distros, fake_rosdeps)) | |
212 | 236 | # Setup |
213 | 237 | pkgs = ['foo', 'bar_ros', 'baz'] |
214 | 238 | upstream_dir = create_upstream_repository(pkgs, directory, format_versions=[1, 2, 3]) |
229 | 253 | cmd = cmd.format(' --quiet') |
230 | 254 | else: |
231 | 255 | cmd = cmd.format('') |
232 | user(cmd, silent=False) | |
256 | user(cmd, silent=False, env=env) | |
233 | 257 | ### |
234 | 258 | ### Import upstream |
235 | 259 | ### |
285 | 309 | ### Release generator, again |
286 | 310 | ### |
287 | 311 | with bloom_answer(bloom_answer.ASSERT_NO_QUESTION): |
288 | ret = user('git-bloom-generate -y rosrelease melodic -s upstream') | |
312 | ret = user('git-bloom-generate -y rosrelease melodic -s upstream', env=env) | |
289 | 313 | # patch import should have reported OK |
290 | 314 | assert ret == code.OK, "actually returned ({0})".format(ret) |
291 | 315 | # Check the environment after the release generator |
370 | 394 | can handle it. |
371 | 395 | """ |
372 | 396 | directory = directory if directory is not None else os.getcwd() |
397 | # Initialize rosdep | |
398 | rosdep_dir = os.path.join(directory, 'foo_rosdep') | |
399 | env = dict(os.environ) | |
400 | fake_distros = {'melodic': {'ubuntu': ['bionic']}} | |
401 | fake_rosdeps = { | |
402 | 'catkin': {'ubuntu': []}, | |
403 | 'roscpp_core': {'ubuntu': []} | |
404 | } | |
405 | env.update(set_up_fake_rosdep(rosdep_dir, fake_distros, fake_rosdeps)) | |
373 | 406 | # Setup |
374 | 407 | upstream_dir = create_upstream_repository(['foo'], directory) |
375 | 408 | upstream_url = 'file://' + upstream_dir |
386 | 419 | user('git tag upstream/0.0.0@baz') |
387 | 420 | |
388 | 421 | import bloom.commands.git.release |
389 | _test_unary_package_repository(release_dir, '0.1.0', directory) | |
422 | _test_unary_package_repository(release_dir, '0.1.0', directory, env=env) |
19 | 19 | from io import StringIO |
20 | 20 | |
21 | 21 | from subprocess import Popen, PIPE, CalledProcessError |
22 | import yaml | |
22 | 23 | |
23 | 24 | |
24 | 25 | def assert_raises(exception_classes, callable_obj=None, *args, **kwargs): |
123 | 124 | os.chdir(self.original_cwd) |
124 | 125 | |
125 | 126 | |
127 | class change_environ(object): | |
128 | def __init__(self, env=None): | |
129 | self.original_env = os.environ | |
130 | self.new_env = dict(env) if env is not None else dict(os.environ) | |
131 | ||
132 | def __enter__(self): | |
133 | self.original_env = os.environ | |
134 | os.environ = dict(self.new_env) | |
135 | ||
136 | def __exit__(self, exc_type, exc_value, traceback): | |
137 | os.environ = self.original_env | |
138 | ||
139 | ||
126 | 140 | def in_temporary_directory(f): |
127 | 141 | @functools.wraps(f) |
128 | 142 | def decorated(*args, **kwds): |
168 | 182 | |
169 | 183 | |
170 | 184 | def user_bloom(cmd, args=None, directory=None, auto_assert=True, |
171 | return_io=True, silent=False): | |
185 | return_io=True, silent=False, env=None): | |
172 | 186 | """Runs the given bloom cmd ('git-bloom-{cmd}') with the given args""" |
173 | 187 | assert type(cmd) == str, \ |
174 | 188 | "user_bloom cmd takes str only, got " + str(type(cmd)) |
190 | 204 | with redirected_stdio() as (out, err): |
191 | 205 | func = load_entry_point('bloom==' + ver, 'console_scripts', cmd) |
192 | 206 | try: |
193 | ret = func(args) or 0 | |
207 | with change_environ(env): | |
208 | ret = func(args) or 0 | |
194 | 209 | except SystemExit as e: |
195 | 210 | ret = e.code |
196 | 211 | if ret != 0 and auto_assert: |
211 | 226 | Used in place of user('cd <new_directory>') |
212 | 227 | """ |
213 | 228 | if type(cmd) is str: |
214 | assert cmd is not '', "no arguments passed to cd, not allowed" | |
229 | assert cmd != '', "no arguments passed to cd, not allowed" | |
215 | 230 | cmd = cmd.split() |
216 | 231 | new_directory = cmd[0] |
217 | 232 | assert os.path.exists(new_directory), \ |
246 | 261 | Used in system tests to emulte a user creating a directory |
247 | 262 | """ |
248 | 263 | if type(cmd) is str: |
249 | assert cmd is not '', "no arguments passed to mkdir, not allowed" | |
264 | assert cmd != '', "no arguments passed to mkdir, not allowed" | |
250 | 265 | cmd = cmd.split() |
251 | 266 | if len(cmd) == 2: |
252 | 267 | assert '-p' in cmd, "two args to mkdir, neither is '-p', not allowed" |
283 | 298 | |
284 | 299 | |
285 | 300 | def user(cmd, directory=None, auto_assert=True, return_io=False, |
286 | bash_only=False, silent=True): | |
301 | bash_only=False, silent=True, env=None): | |
287 | 302 | """Used in system tests to emulate a user action""" |
288 | 303 | if type(cmd) in [list, tuple]: |
289 | 304 | cmd = ' '.join(cmd) |
297 | 312 | directory=directory, |
298 | 313 | auto_assert=auto_assert, |
299 | 314 | return_io=return_io, |
300 | silent=silent | |
315 | silent=silent, | |
316 | env=env | |
301 | 317 | ) |
302 | 318 | ret = -1 |
303 | 319 | try: |
304 | p = Popen(cmd, shell=True, cwd=directory, stdout=PIPE, stderr=PIPE) | |
320 | p = Popen(cmd, shell=True, cwd=directory, env=env, stdout=PIPE, stderr=PIPE) | |
305 | 321 | out, err = p.communicate() |
306 | 322 | if out is not None and not isinstance(out, str): |
307 | 323 | out = out.decode('utf-8') |
319 | 335 | if return_io: |
320 | 336 | return ret, out, err |
321 | 337 | return ret |
338 | ||
339 | ||
340 | def set_up_fake_rosdep(staging_dir, distros={}, rules={}): | |
341 | """ | |
342 | Used to create a 'fake' rosdep cache from a locally generated index. | |
343 | ||
344 | Example invocation: | |
345 | .. code-block:: python | |
346 | ||
347 | env = dict(os.environ) | |
348 | env.update(set_up_fake_rosdep( | |
349 | '/tmp/fake_rosdep', | |
350 | { | |
351 | 'melodic': { | |
352 | 'ubuntu': ['bionic'] | |
353 | } | |
354 | }, | |
355 | { | |
356 | 'some_rosdep_key': { | |
357 | 'ubuntu': ['some-package-name'] | |
358 | } | |
359 | })) | |
360 | ||
361 | :param staging_dir: Scratch directory in which to make infrastructure files. | |
362 | :param distros: Mapping of ROS distributions to populate the index with. | |
363 | :param rules: rosdep rules to populate the rosdep database with. | |
364 | ||
365 | :returns: Environment variables which cause Bloom will use the fake cache. | |
366 | """ | |
367 | # Construct bare environment | |
368 | rosdistro_dir = os.path.join(staging_dir, 'rosdistro') | |
369 | rosdistro_index_path = os.path.join(rosdistro_dir, 'index.yaml') | |
370 | sources_list_dir = os.path.join(staging_dir, 'sources.list.d') | |
371 | ros_home_dir = os.path.join(staging_dir, 'ros_home') | |
372 | os.makedirs(rosdistro_dir) | |
373 | os.makedirs(sources_list_dir) | |
374 | os.makedirs(ros_home_dir) | |
375 | env = { | |
376 | 'BLOOM_SKIP_ROSDEP_UPDATE': '1', | |
377 | 'ROSDEP_SOURCE_PATH': os.path.realpath(sources_list_dir), | |
378 | 'ROSDISTRO_INDEX_URL': 'file://' + os.path.realpath(rosdistro_index_path), | |
379 | 'ROS_HOME': os.path.realpath(ros_home_dir) | |
380 | } | |
381 | ||
382 | # Create the specified distributions | |
383 | for distro, platforms in distros.items(): | |
384 | distro_dir = os.path.join(rosdistro_dir, distro) | |
385 | distro_yaml_path = os.path.join(distro_dir, 'distribution.yaml') | |
386 | os.makedirs(distro_dir) | |
387 | distro_yaml_data = { | |
388 | 'release_platforms': platforms, | |
389 | 'repositories': dict({}), | |
390 | 'type': 'distribution', | |
391 | 'version': 2 | |
392 | } | |
393 | with open(distro_yaml_path, 'w') as f: | |
394 | f.write(yaml.dump(distro_yaml_data)) | |
395 | ||
396 | # Index the specified distributions | |
397 | rosdistro_index_data = { | |
398 | 'distributions': { | |
399 | distro: { | |
400 | 'distribution': [os.path.join(distro, 'distribution.yaml')], | |
401 | 'distribution_cache': 'DOES-NOT-EXIST', | |
402 | 'distribution_status': 'active', | |
403 | 'distribution_type': 'ros1', | |
404 | 'python_version': 2 | |
405 | } for distro in distros.keys() | |
406 | }, | |
407 | 'type': 'index', | |
408 | 'version': 4 | |
409 | } | |
410 | with open(rosdistro_index_path, 'w') as f: | |
411 | f.write(yaml.dump(rosdistro_index_data)) | |
412 | ||
413 | # Create the rosdep database | |
414 | rosdep_db_dir = os.path.join(rosdistro_dir, 'rosdep') | |
415 | os.makedirs(rosdep_db_dir) | |
416 | rosdep_db_path = os.path.join(rosdep_db_dir, 'rosdep.yaml') | |
417 | with open(rosdep_db_path, 'w') as f: | |
418 | f.write(yaml.dump(rules)) | |
419 | ||
420 | # Create the rosdep sources list | |
421 | rosdistro_source_path = os.path.join(sources_list_dir, '50-rosdep.list') | |
422 | with open(rosdistro_source_path, 'w') as f: | |
423 | f.write('yaml file://' + os.path.realpath(rosdep_db_path)) | |
424 | ||
425 | # Perform the initial rosdep update | |
426 | setup_env = dict(os.environ) | |
427 | setup_env.update(env) | |
428 | user('rosdep update', env=setup_env) | |
429 | ||
430 | return env |