From 89999adfa49e5122af45099e28bb65810c811a0c Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Tue, 27 Feb 2024 11:31:57 +0100 Subject: [PATCH 1/4] Transform repository enable to use gpg optionally * Do not require gpg. Change the option to a parameter Signed-off-by: Jose Luis Rivero --- plugins/repository.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/plugins/repository.py b/plugins/repository.py index ab37a6a..f35a1ba 100644 --- a/plugins/repository.py +++ b/plugins/repository.py @@ -6,7 +6,7 @@ Usage: gzdev repository (ACTION) [] [] [--project=] [--force-linux-distro=] - [--keyserver=] + [--keyserver=] [--gpg-check] gzdev repository list gzdev repository (-h | --help) gzdev repository --version @@ -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 @@ -158,14 +161,15 @@ def install_repos(project_list, config, linux_distro): install_repo(p['name'], p['type'], config, linux_distro) -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: @@ -196,13 +200,14 @@ def normalize_args(args): repo_type = args[''] if args[''] 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 = None 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): @@ -213,14 +218,18 @@ def validate_input(args): 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'): if project: project_list = load_project(project, config) install_repos(project_list, config, linux_distro) 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) From 206aa7a7d38844ea1c0bae953a88e8ce40b7b605 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Tue, 27 Feb 2024 14:50:47 +0100 Subject: [PATCH 2/4] Added gpg_check positional argument (#80) Signed-off-by: Jose Luis Rivero --- plugins/repository.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/repository.py b/plugins/repository.py index f35a1ba..6db0ed1 100644 --- a/plugins/repository.py +++ b/plugins/repository.py @@ -156,9 +156,9 @@ def run_apt_update(): _check_call(['apt-get', 'update']) -def install_repos(project_list, config, linux_distro): +def install_repos(project_list, config, linux_distro, gpg_check): for p in project_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, gpg_check): @@ -223,7 +223,7 @@ def process_input(args, config): if (action == 'enable'): if project: project_list = load_project(project, config) - install_repos(project_list, config, linux_distro) + install_repos(project_list, config, linux_distro, gpg_check) else: install_repo(repo_name, repo_type, From d5aa161407209c41ab1bb115f3152b909a30653d Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Tue, 27 Feb 2024 15:58:01 +0100 Subject: [PATCH 3/4] Implement pyright linting (#81) * Add pyright static linter Signed-off-by: Jose Luis Rivero --- .github/workflows/pyright.yml | 18 ++++++++++++++++++ plugins/repository.py | 9 ++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pyright.yml diff --git a/.github/workflows/pyright.yml b/.github/workflows/pyright.yml new file mode 100644 index 0000000..1c90213 --- /dev/null +++ b/.github/workflows/pyright.yml @@ -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 diff --git a/plugins/repository.py b/plugins/repository.py index 6db0ed1..5164edb 100644 --- a/plugins/repository.py +++ b/plugins/repository.py @@ -69,14 +69,17 @@ def load_config_file(config_file_path='config/repository.yaml'): def load_project(project, config): + ret = [] for p in config['projects']: pattern = re.compile(p['name']) if pattern.search(project): - return p['repositories'] - # stop in the first match + ret = p['repositories'] break - error('Unknown project: ' + project) + if not ret: + error('Unknown project: ' + project) + + return ret def get_linux_distro(): From 4282c06b1b550bde2412c978ab9a5cbbfd8c2f9b Mon Sep 17 00:00:00 2001 From: Ian Chen Date: Mon, 25 Mar 2024 17:53:30 +0000 Subject: [PATCH 4/4] Use pre-releases for gz-sim8 to test gz-transport 13.2.0 Signed-off-by: Ian Chen --- plugins/config/repository.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plugins/config/repository.yaml b/plugins/config/repository.yaml index a6ae3c6..fae25f8 100644 --- a/plugins/config/repository.yaml +++ b/plugins/config/repository.yaml @@ -130,6 +130,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: