Skip to content

Commit f1058dc

Browse files
committed
add zenoh repo
Signed-off-by: Ian Chen <ichen@openrobotics.org>
1 parent f38e38b commit f1058dc

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

plugins/config/repository.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ repositories:
3838
types:
3939
- name: main
4040
url: http://repos.ros.org/repos/ros_bootstrap
41+
- name: eclipse-zenoh
42+
key: null
43+
key_url: null
44+
linux_distro: ubuntu
45+
types:
46+
- name: stable
47+
url: https://download.eclipse.org/zenoh/debian-repo/
48+
suite: /
49+
4150
# wildcards are allowed in name, entries are processed in top-down order
4251
# first entry matching the name is used
4352
projects:
@@ -90,6 +99,8 @@ projects:
9099
type: stable
91100
- name: osrf
92101
type: nightly
102+
- name: eclipse-zenoh
103+
type: stable
93104
- name: gz-fuel-tools11
94105
repositories:
95106
- name: osrf

plugins/repository.py

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,14 @@ def get_repo_url(repo_name, repo_type, config):
131131

132132
error('Unknown repository or type: ' + repo_name + '/' + repo_type)
133133

134+
def get_repo_suite(repo_name, repo_type, config):
135+
for p in config['repositories']:
136+
if p['name'] == repo_name and p['linux_distro'].lower() == get_linux_distro():
137+
for t in p['types']:
138+
if t['name'] == repo_type:
139+
if 'suite' in t:
140+
return t['suite']
141+
return None
134142

135143
def get_sources_list_file_path(repo_name, repo_type):
136144
filename = f'{GZDEV_FILE_PREFIX}{repo_name}_{repo_type}.list'
@@ -188,17 +196,27 @@ def install_repo(repo_name, repo_type, config, linux_distro, gpg_check):
188196
url = get_repo_url(repo_name, repo_type, config)
189197
key = get_repo_key(repo_name, config)
190198
key_url = get_repo_key_url(repo_name, config)
199+
suite = get_repo_suite(repo_name, repo_type, config)
191200

192201
try:
193-
key_path = download_key(repo_name, repo_type, key_url)
194-
if gpg_check:
195-
assert_key_in_file(key, key_path)
202+
trusted_or_signed_str = ""
203+
if key is not None and key_url is not None:
204+
key_path = download_key(repo_name, repo_type, key_url)
205+
if gpg_check:
206+
assert_key_in_file(key, key_path)
207+
trusted_or_signed_str = f"signed-by={key_path}"
208+
else:
209+
trusted_or_signed_str = "trusted=yes"
196210

197-
# if not linux_distro provided, try to guess it
198-
if not linux_distro:
199-
linux_distro = distro.codename()
211+
if suite is not None:
212+
distro_component_or_suite_str = f"{suite}"
213+
else:
214+
# if not linux_distro provided, try to guess it
215+
if not linux_distro:
216+
linux_distro = distro.codename()
217+
distro_component_or_suite_str = f"{linux_distro} main"
200218

201-
content = f"deb [signed-by={key_path}] {url} {linux_distro} main"
219+
content = f"deb [{trusted_or_signed_str}] {url} {distro_component_or_suite_str}"
202220
full_path = get_sources_list_file_path(repo_name, repo_type)
203221
if os.path.isfile(full_path):
204222
warn("gzdev file with the repositoy already exists in the system:"
@@ -210,7 +228,7 @@ def install_repo(repo_name, repo_type, config, linux_distro, gpg_check):
210228

211229
run_apt_update()
212230
except PermissionError:
213-
print('No permissiong to make system file modifications. Run the script with sudo.')
231+
print('No permission to make system file modifications. Run the script with sudo.')
214232

215233

216234
def disable_repo(repo_name):

0 commit comments

Comments
 (0)