From 26e75471231a6c67a3899349d6724d7bd7b9e09a Mon Sep 17 00:00:00 2001 From: zguo Date: Tue, 27 May 2025 10:20:31 +0800 Subject: [PATCH 01/14] ci: migrate to pre-commit.ci and remove duplicate hooks Signed-off-by: zguo --- .pre-commit-config.yaml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a0e101f..d9967fe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,13 +11,18 @@ repos: - id: check-case-conflict - id: check-ast - id: check-docstring-first - - id: check-case-conflict - id: check-merge-conflict - id: check-builtin-literals - - id: check-docstring-first - - id: check-merge-conflict - id: check-toml - id: debug-statements - id: end-of-file-fixer - id: trailing-whitespace args: [--markdown-linebreak-ext=md] + +ci: + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit.com hooks + + For more information, see https://pre-commit.ci + autofix_prs: true + autoupdate_schedule: monthly From d7850b04c276f626f99fbc22623cc57ec14c246c Mon Sep 17 00:00:00 2001 From: zguo Date: Tue, 27 May 2025 12:11:57 +0800 Subject: [PATCH 02/14] ci: add Packit configuration --- .packit.yaml | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .packit.yaml diff --git a/.packit.yaml b/.packit.yaml new file mode 100644 index 0000000..27a019b --- /dev/null +++ b/.packit.yaml @@ -0,0 +1,42 @@ +--- +# Basic configuration for Packit +# See documentation: https://packit.dev/docs/configuration/ + +specfile_path: fedora/python-configshell-fb.spec + +# Configure files to sync between upstream and downstream +synced_files: + - .packit.yaml + - fedora/python-configshell-fb.spec + +upstream_package_name: configshell-fb +# In Fedora, Python packages are prefixed with 'python-' +downstream_package_name: python-configshell-fb + +# Use Python's build system to create the source archive +actions: + create-archive: + - python -m build --sdist + - bash -c "ls -1t ./dist/*.tar.gz | head -n 1" + +jobs: + # Test PRs in COPR + - job: copr_build + trigger: pull_request + targets: + - fedora-all + - epel-9 + + # Run tests + - job: tests + trigger: pull_request + targets: + - fedora-all + - epel-9 + + # Sync with Fedora when a new release is created + - job: propose_downstream + trigger: release + dist_git_branches: + - fedora-all + - epel-9 From cb98f49f6b5ec93f9bf99a0af3a96ef5c8c634f6 Mon Sep 17 00:00:00 2001 From: zguo Date: Tue, 27 May 2025 12:17:03 +0800 Subject: [PATCH 03/14] ci: add a Fedora spec file --- fedora/python-configshell-fb.spec | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 fedora/python-configshell-fb.spec diff --git a/fedora/python-configshell-fb.spec b/fedora/python-configshell-fb.spec new file mode 100644 index 0000000..d1f4ffd --- /dev/null +++ b/fedora/python-configshell-fb.spec @@ -0,0 +1,49 @@ +%global pypi_name configshell-fb + +Name: python-%{pypi_name} +Version: 1.1.29 +Release: 1%{?dist} +Summary: A framework to implement simple but nice CLIs + +License: Apache-2.0 +URL: http://github.com/open-iscsi/configshell-fb +Source0: %{pypi_source} + +BuildArch: noarch +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-hatchling +BuildRequires: python3-hatch-vcs + +%description +configshell-fb is a Python library that provides a framework to implement simple +but nice CLI-based applications. + +%package -n python3-%{pypi_name} +Summary: %{summary} +%{?python_provide:%python_provide python3-%{pypi_name}} + +Requires: python3-pyparsing >= 2.4.7 + +%description -n python3-%{pypi_name} +configshell-fb is a Python library that provides a framework to implement simple +but nice CLI-based applications. + +%prep +%autosetup -n %{pypi_name}-%{version} +rm -rf %{pypi_name}.egg-info + +%build +%pyproject_wheel + +%install +%pyproject_install +%pyproject_save_files configshell configshell_fb.py + +%files -n python3-%{pypi_name} -f %{pyproject_files} +%license COPYING +%doc README.md + +%changelog +* Thu May 23 2024 Packit - 1.1.29-1 +- Initial package for Fedora From 8fef6b7441e1bee6bb80fd1b683e3b574db390bd Mon Sep 17 00:00:00 2001 From: zguo Date: Tue, 27 May 2025 12:38:53 +0800 Subject: [PATCH 04/14] Add Packit validation hook Signed-off-by: zguo --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d9967fe..a50d718 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,6 +19,11 @@ repos: - id: trailing-whitespace args: [--markdown-linebreak-ext=md] + - repo: https://github.com/packit/pre-commit-hooks + rev: v1.3.0 + hooks: + - id: validate-config + ci: autofix_commit_msg: | [pre-commit.ci] auto fixes from pre-commit.com hooks From 1d69a7c7c37f8d7cd770eb53e269e1e7af265f15 Mon Sep 17 00:00:00 2001 From: zguo Date: Tue, 27 May 2025 13:09:47 +0800 Subject: [PATCH 05/14] pre-commit autoupdate, packit configuration, spec update --- .packit.yaml | 16 +++++++++------- .pre-commit-config.yaml | 2 +- configshell/__init__.py | 6 +++--- fedora/python-configshell-fb.spec | 5 +++-- 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.packit.yaml b/.packit.yaml index 27a019b..682c361 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -4,21 +4,23 @@ specfile_path: fedora/python-configshell-fb.spec -# Configure files to sync between upstream and downstream -synced_files: - - .packit.yaml - - fedora/python-configshell-fb.spec - upstream_package_name: configshell-fb # In Fedora, Python packages are prefixed with 'python-' downstream_package_name: python-configshell-fb -# Use Python's build system to create the source archive +# Use hatch to create the source archive actions: create-archive: - - python -m build --sdist + - hatch build -t sdist - bash -c "ls -1t ./dist/*.tar.gz | head -n 1" +srpm_build_deps: + - python3-devel + - python3-pip + - hatch + - python3-hatchling + - python3-hatch-vcs + jobs: # Test PRs in COPR - job: copr_build diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a50d718..2797868 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,6 +1,6 @@ repos: - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.7.1 + rev: v0.11.11 hooks: - id: ruff args: [--fix] diff --git a/configshell/__init__.py b/configshell/__init__.py index 9de7a25..8d61191 100644 --- a/configshell/__init__.py +++ b/configshell/__init__.py @@ -22,10 +22,10 @@ from .shell import ConfigShell __all__ = [ - 'Console', - 'Log', 'ConfigNode', + 'ConfigShell', + 'Console', 'ExecutionError', + 'Log', 'Prefs', - 'ConfigShell', ] diff --git a/fedora/python-configshell-fb.spec b/fedora/python-configshell-fb.spec index d1f4ffd..19ea376 100644 --- a/fedora/python-configshell-fb.spec +++ b/fedora/python-configshell-fb.spec @@ -11,7 +11,8 @@ Source0: %{pypi_source} BuildArch: noarch BuildRequires: python3-devel -BuildRequires: python3-setuptools +BuildRequires: python3-pip +BuildRequires: hatch BuildRequires: python3-hatchling BuildRequires: python3-hatch-vcs @@ -38,7 +39,7 @@ rm -rf %{pypi_name}.egg-info %install %pyproject_install -%pyproject_save_files configshell configshell_fb.py +%pyproject_save_files configshell configshell_fb %files -n python3-%{pypi_name} -f %{pyproject_files} %license COPYING From 301a865b57767d4a87fc75f3056a869bf87d909e Mon Sep 17 00:00:00 2001 From: zguo Date: Wed, 28 May 2025 10:42:20 +0800 Subject: [PATCH 06/14] Add ci-tests Signed-off-by: zguo --- .fmf/version | 1 + ci-tests/sts.fmf | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 .fmf/version create mode 100644 ci-tests/sts.fmf diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/ci-tests/sts.fmf b/ci-tests/sts.fmf new file mode 100644 index 0000000..6632211 --- /dev/null +++ b/ci-tests/sts.fmf @@ -0,0 +1,4 @@ +plan: + import: + url: https://gitlab.com/rh-kernel-stqe/sts + name: /plans/lio/core From e0c6fc44ecfe38fdef11319b988c1cf05da2d5a1 Mon Sep 17 00:00:00 2001 From: zguo Date: Wed, 28 May 2025 13:00:40 +0800 Subject: [PATCH 07/14] spec enhencements --- .packit.yaml | 2 +- fedora/python-configshell-fb.spec | 27 ++++++++++++++------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.packit.yaml b/.packit.yaml index 682c361..68b0f5a 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -6,7 +6,7 @@ specfile_path: fedora/python-configshell-fb.spec upstream_package_name: configshell-fb # In Fedora, Python packages are prefixed with 'python-' -downstream_package_name: python-configshell-fb +downstream_package_name: python3-configshell # Use hatch to create the source archive actions: diff --git a/fedora/python-configshell-fb.spec b/fedora/python-configshell-fb.spec index 19ea376..dc8e152 100644 --- a/fedora/python-configshell-fb.spec +++ b/fedora/python-configshell-fb.spec @@ -1,13 +1,15 @@ -%global pypi_name configshell-fb +%global upstream_name configshell-fb +%global pkg_name configshell -Name: python-%{pypi_name} +Name: python-%{pkg_name} Version: 1.1.29 -Release: 1%{?dist} +Release: %autorelease Summary: A framework to implement simple but nice CLIs +# Note: This is the fb version of configshell License: Apache-2.0 -URL: http://github.com/open-iscsi/configshell-fb -Source0: %{pypi_source} +URL: http://github.com/open-iscsi/%{upstream_name} +Source0: %{pypi_source %{upstream_name}} BuildArch: noarch BuildRequires: python3-devel @@ -20,19 +22,19 @@ BuildRequires: python3-hatch-vcs configshell-fb is a Python library that provides a framework to implement simple but nice CLI-based applications. -%package -n python3-%{pypi_name} +%package -n python3-%{pkg_name} Summary: %{summary} -%{?python_provide:%python_provide python3-%{pypi_name}} +%{?python_provide:%python_provide python3-%{pkg_name}} Requires: python3-pyparsing >= 2.4.7 -%description -n python3-%{pypi_name} +%description -n python3-%{pkg_name} configshell-fb is a Python library that provides a framework to implement simple but nice CLI-based applications. %prep -%autosetup -n %{pypi_name}-%{version} -rm -rf %{pypi_name}.egg-info +%autosetup -n %{upstream_name}-%{version} +rm -rf %{upstream_name}.egg-info %build %pyproject_wheel @@ -41,10 +43,9 @@ rm -rf %{pypi_name}.egg-info %pyproject_install %pyproject_save_files configshell configshell_fb -%files -n python3-%{pypi_name} -f %{pyproject_files} +%files -n python3-%{pkg_name} -f %{pyproject_files} %license COPYING %doc README.md %changelog -* Thu May 23 2024 Packit - 1.1.29-1 -- Initial package for Fedora +%autochangelog From 989a425858dfb7849c7d3f5280e4303618f5959d Mon Sep 17 00:00:00 2001 From: zguo Date: Fri, 30 May 2025 12:09:13 +0800 Subject: [PATCH 08/14] Remove the existing GitHub Actions workflow for pre-commit --- .github/workflows/pre-commit.yml | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml deleted file mode 100644 index 7f579af..0000000 --- a/.github/workflows/pre-commit.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [master] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 - - uses: pre-commit/action@v3.0.1 From 1d0948d60b16ae3e421e6120b7305cc12e2674e2 Mon Sep 17 00:00:00 2001 From: zguo Date: Fri, 30 May 2025 13:53:37 +0800 Subject: [PATCH 09/14] ci: add CodeQL security scanning workflow --- .github/workflows/codeql.yml | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 0000000..3ec8054 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,39 @@ +name: "CodeQL" + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'python' ] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + queries: security-and-quality + + - name: Autobuild + uses: github/codeql-action/autobuild@v3 + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: "/language:${{matrix.language}}" From 31248d64df98d36e8dfb5d8ecb1872615c88e814 Mon Sep 17 00:00:00 2001 From: zguo Date: Fri, 20 Jun 2025 16:11:15 +0800 Subject: [PATCH 10/14] Disable ci autofix --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2797868..6fda799 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,5 +29,5 @@ ci: [pre-commit.ci] auto fixes from pre-commit.com hooks For more information, see https://pre-commit.ci - autofix_prs: true + autofix_prs: false autoupdate_schedule: monthly From ab197c37ce065d8e0a549bc3b6d5a83d25f60a61 Mon Sep 17 00:00:00 2001 From: zguo Date: Fri, 20 Jun 2025 16:14:17 +0800 Subject: [PATCH 11/14] Use global _description --- fedora/python-configshell-fb.spec | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/fedora/python-configshell-fb.spec b/fedora/python-configshell-fb.spec index dc8e152..c1cd8b4 100644 --- a/fedora/python-configshell-fb.spec +++ b/fedora/python-configshell-fb.spec @@ -18,9 +18,13 @@ BuildRequires: hatch BuildRequires: python3-hatchling BuildRequires: python3-hatch-vcs -%description +%global _description %{expand: configshell-fb is a Python library that provides a framework to implement simple but nice CLI-based applications. +} + +%description +%{_description} %package -n python3-%{pkg_name} Summary: %{summary} @@ -29,8 +33,7 @@ Summary: %{summary} Requires: python3-pyparsing >= 2.4.7 %description -n python3-%{pkg_name} -configshell-fb is a Python library that provides a framework to implement simple -but nice CLI-based applications. +%{_description} %prep %autosetup -n %{upstream_name}-%{version} From 31caaf32efa93247d6ec2bf67ddb66728c8b2e0b Mon Sep 17 00:00:00 2001 From: zguo Date: Fri, 26 Sep 2025 11:43:19 +0800 Subject: [PATCH 12/14] builds on the newest stable Fedora --- .packit.yaml | 6 +++--- ...python-configshell-fb.spec => python-configshell-fb.spec | 0 2 files changed, 3 insertions(+), 3 deletions(-) rename fedora/python-configshell-fb.spec => python-configshell-fb.spec (100%) diff --git a/.packit.yaml b/.packit.yaml index 68b0f5a..e0050a6 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -2,7 +2,7 @@ # Basic configuration for Packit # See documentation: https://packit.dev/docs/configuration/ -specfile_path: fedora/python-configshell-fb.spec +specfile_path: python-configshell-fb.spec upstream_package_name: configshell-fb # In Fedora, Python packages are prefixed with 'python-' @@ -26,14 +26,14 @@ jobs: - job: copr_build trigger: pull_request targets: - - fedora-all + - fedora-latest-stable - epel-9 # Run tests - job: tests trigger: pull_request targets: - - fedora-all + - fedora-latest-stable - epel-9 # Sync with Fedora when a new release is created diff --git a/fedora/python-configshell-fb.spec b/python-configshell-fb.spec similarity index 100% rename from fedora/python-configshell-fb.spec rename to python-configshell-fb.spec From fae51d25021999490b61ca4d91e852ba6bd79745 Mon Sep 17 00:00:00 2001 From: zguo Date: Fri, 26 Sep 2025 11:52:02 +0800 Subject: [PATCH 13/14] Ensure symbolic link to configshell exist before build --- python-configshell-fb.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/python-configshell-fb.spec b/python-configshell-fb.spec index c1cd8b4..19804d2 100644 --- a/python-configshell-fb.spec +++ b/python-configshell-fb.spec @@ -37,6 +37,7 @@ Requires: python3-pyparsing >= 2.4.7 %prep %autosetup -n %{upstream_name}-%{version} +ln -sf configshell configshell_fb rm -rf %{upstream_name}.egg-info %build From 4e65bbf63a2d77085420fa95bb060d5b54da4b7a Mon Sep 17 00:00:00 2001 From: zguo Date: Fri, 26 Sep 2025 12:32:31 +0800 Subject: [PATCH 14/14] Update pre-commit.ci commit message --- .pre-commit-config.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6fda799..aa4dea2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,8 +26,6 @@ repos: ci: autofix_commit_msg: | - [pre-commit.ci] auto fixes from pre-commit.com hooks - - For more information, see https://pre-commit.ci + Auto fixes from pre-commit.com hooks autofix_prs: false autoupdate_schedule: monthly