Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into jrivero/support_dis…
Browse files Browse the repository at this point in the history
…tribution_requirement_harmonic_noble
  • Loading branch information
j-rivero committed Apr 1, 2024
2 parents ade1a24 + 8f7e2d1 commit b77ccbc
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 8 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: CI
on: [push]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # v5
with:
cache: 'pip'
- run: |
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
- run: echo "$PWD/.venv/bin" >> $GITHUB_PATH
- uses: jakebailey/pyright-action@1a4bf406072a8d0efdf6faba94a34a096430472f # v2
7 changes: 7 additions & 0 deletions plugins/config/repository.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,13 @@ projects:
type: stable
- name: osrf
type: nightly
# Use pre-releases for gz-sim for testing gz-transport 13.2.0
- name: gz-sim8
repositories:
- name: osrf
type: stable
- name: osrf
type: prerelease
# generic regexp
- name: gazebo.*
repositories:
Expand Down
29 changes: 21 additions & 8 deletions plugins/repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
Usage:
gzdev repository (ACTION) [<repo-name>] [<repo-type>]
[--project=<project_name>] [--force-linux-distro=<distro>]
[--keyserver=<keyserver>]
[--keyserver=<keyserver>] [--gpg-check]
gzdev repository list
gzdev repository (-h | --help)
gzdev repository --version
Expand All @@ -19,6 +19,9 @@
Options:
-h --help Show this screen
--version Show gzdev's version
--gpg-check Do run a gpg check for validating the key
downloaded in enable action
(need the gpg binary)
"""

import distro
Expand Down Expand Up @@ -168,19 +171,24 @@ def run_apt_update():
_check_call(['apt-get', 'update'])


def install_repos(repos_list, config, linux_distro):
def install_repos(repos_list, config, linux_distro, gpg_check):
for p in repos_list:
install_repo(p['name'], p['type'], config, linux_distro)
install_repo(p['name'], p['type'], config, linux_distro, gpg_check)


def install_repo(repo_name, repo_type, config, linux_distro):
def install_repo(repo_name, repo_type, config, linux_distro, gpg_check):
url = get_repo_url(repo_name, repo_type, config)
key = get_repo_key(repo_name, config)
key_url = get_repo_key_url(repo_name, config)

try:
key_path = download_key(repo_name, repo_type, key_url)
assert_key_in_file(key, key_path)
if gpg_check:
assert_key_in_file(key, key_path)

# if not linux_distro provided, try to guess it
if not linux_distro:
linux_distro = distro.codename()

content = f"deb [signed-by={key_path}] {url} {linux_distro} main"
full_path = get_sources_list_file_path(repo_name, repo_type)
Expand All @@ -207,13 +215,14 @@ def normalize_args(args):
repo_type = args['<repo-type>'] if args['<repo-type>'] else 'stable'
project = args['--project']
force_linux_distro = args['--force-linux-distro']
gpg_check = args['--gpg_check'] if '--gpg_check' in args else False
if force_linux_distro:
linux_distro = force_linux_distro
else:
linux_distro = distro.codename()
if '--keyserver' in args:
warn('--keyserver option is deprecated. It is safe to remove it')
return action, repo_name, repo_type, project, linux_distro
return action, repo_name, repo_type, project, linux_distro, gpg_check


def validate_input(args):
Expand All @@ -235,12 +244,16 @@ def process_project_install(project, config, linux_distro, dry_run=False):


def process_input(args, config):
action, repo_name, repo_type, project, linux_distro = args
action, repo_name, repo_type, project, linux_distro, gpg_check = args

if (action == 'enable'):
process_project_install(project, config, linux_distro) \
if project else \
install_repo(repo_name, repo_type, config, linux_distro)
install_repo(repo_name,
repo_type,
config,
linux_distro,
gpg_check)
elif (action == 'disable'):
disable_repo(repo_name)

Expand Down

0 comments on commit b77ccbc

Please sign in to comment.