forked from rpms/leapp
Compare commits
1 Commits
c8-elevate
...
c8
| Author | SHA1 | Date | |
|---|---|---|---|
| 1ff3d09a69 |
@ -0,0 +1,120 @@
|
|||||||
|
From e62e4e144670de9337c8a406ff8d532b9c1033d4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Matej Matuska <mmatuska@redhat.com>
|
||||||
|
Date: Fri, 19 Sep 2025 11:39:11 +0200
|
||||||
|
Subject: [PATCH 1/3] cli: Add possibility to specify aliases for CLI option
|
||||||
|
|
||||||
|
The existing 'name' and 'short_name' parameters are kept as is for
|
||||||
|
backwards compatibility.
|
||||||
|
|
||||||
|
Also a dest parameter is added for specifying the name of the attribute
|
||||||
|
to be added to the parsed args object.
|
||||||
|
|
||||||
|
The change is backwards compatible, bump framework-version from 6.1 to
|
||||||
|
6.2.
|
||||||
|
|
||||||
|
Jira: RHEL-110563 (related)
|
||||||
|
---
|
||||||
|
leapp/utils/clicmd.py | 53 +++++++++++++++++++++++++++++++++++++------
|
||||||
|
packaging/leapp.spec | 2 +-
|
||||||
|
2 files changed, 47 insertions(+), 8 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/leapp/utils/clicmd.py b/leapp/utils/clicmd.py
|
||||||
|
index 89d3e27..7f819ea 100644
|
||||||
|
--- a/leapp/utils/clicmd.py
|
||||||
|
+++ b/leapp/utils/clicmd.py
|
||||||
|
@@ -202,9 +202,22 @@ class Command(object):
|
||||||
|
internal = kwargs.pop('internal', {})
|
||||||
|
self._options.append((args, kwargs, internal))
|
||||||
|
|
||||||
|
- def add_option(self, name, short_name='', help='', # noqa; pylint: disable=redefined-builtin
|
||||||
|
- is_flag=False, inherit=False, value_type=str, wrapped=None, action=None, metavar=None,
|
||||||
|
- choices=None, default=None):
|
||||||
|
+ def add_option( # noqa; pylint: disable=redefined-builtin, too-many-arguments
|
||||||
|
+ self,
|
||||||
|
+ name,
|
||||||
|
+ short_name="",
|
||||||
|
+ help="",
|
||||||
|
+ is_flag=False,
|
||||||
|
+ inherit=False,
|
||||||
|
+ value_type=str,
|
||||||
|
+ wrapped=None,
|
||||||
|
+ action=None,
|
||||||
|
+ metavar=None,
|
||||||
|
+ choices=None,
|
||||||
|
+ default=None,
|
||||||
|
+ aliases=None,
|
||||||
|
+ dest=None,
|
||||||
|
+ ):
|
||||||
|
"""
|
||||||
|
Add an option
|
||||||
|
|
||||||
|
@@ -230,16 +243,39 @@ class Command(object):
|
||||||
|
:type choices: list
|
||||||
|
:param default: default value of the argument if nothing is specified
|
||||||
|
:type default: any
|
||||||
|
+ :param aliases: Aliases for the option, appended after short_name and name in help output
|
||||||
|
+ :type aliases: list[str]
|
||||||
|
+ :param dest: The name of the attribute to be added to the parsed args object
|
||||||
|
+ :type dest: str
|
||||||
|
:return: self
|
||||||
|
"""
|
||||||
|
name = name.lstrip('-')
|
||||||
|
names = ['--' + name]
|
||||||
|
kwargs = {}
|
||||||
|
if short_name:
|
||||||
|
- short_name = short_name.lstrip('-')
|
||||||
|
- if len(short_name) != 1:
|
||||||
|
- raise CommandDefinitionError("Short name should be one letter only")
|
||||||
|
- names.insert(0, '-' + short_name)
|
||||||
|
+ stripped = short_name.lstrip('-')
|
||||||
|
+ if len(stripped) != 1:
|
||||||
|
+ msg = "Short name option should be one letter only (excluding '-'), but received: {}"
|
||||||
|
+ raise CommandDefinitionError(msg.format(short_name))
|
||||||
|
+ names.insert(0, '-' + stripped)
|
||||||
|
+
|
||||||
|
+ aliases = aliases or []
|
||||||
|
+ for alias in aliases:
|
||||||
|
+ if alias.startswith('--'):
|
||||||
|
+ names.append('--' + alias.strip('-'))
|
||||||
|
+ elif alias.startswith('-'):
|
||||||
|
+ stripped = alias.strip('-')
|
||||||
|
+ if len(stripped) != 1:
|
||||||
|
+ msg = "Short name option should be one letter only (excluding '-'), but received: {}"
|
||||||
|
+ raise CommandDefinitionError(msg.format(alias))
|
||||||
|
+ names.append('-' + stripped)
|
||||||
|
+ else:
|
||||||
|
+ # no way to distinguish whether it's a short or long option if no leading dashes,
|
||||||
|
+ # decide based on length
|
||||||
|
+ if len(alias) == 1:
|
||||||
|
+ names.append('-' + alias)
|
||||||
|
+ else:
|
||||||
|
+ names.append('--' + alias)
|
||||||
|
if not action:
|
||||||
|
action = 'store'
|
||||||
|
if is_flag:
|
||||||
|
@@ -252,6 +288,9 @@ class Command(object):
|
||||||
|
kwargs['choices'] = choices
|
||||||
|
if default is not None:
|
||||||
|
kwargs['default'] = default
|
||||||
|
+ if dest:
|
||||||
|
+ kwargs['dest'] = dest
|
||||||
|
+
|
||||||
|
self._add_opt(*names, help=help, # noqa; pylint: disable=redefined-builtin
|
||||||
|
action=action, internal={'wrapped': wrapped, 'inherit': inherit}, **kwargs)
|
||||||
|
return self
|
||||||
|
diff --git a/packaging/leapp.spec b/packaging/leapp.spec
|
||||||
|
index bdf5a79..22a2085 100644
|
||||||
|
--- a/packaging/leapp.spec
|
||||||
|
+++ b/packaging/leapp.spec
|
||||||
|
@@ -13,7 +13,7 @@
|
||||||
|
# This is kind of help for more flexible development of leapp repository,
|
||||||
|
# so people do not have to wait for new official release of leapp to ensure
|
||||||
|
# it is installed/used the compatible one.
|
||||||
|
-%global framework_version 6.1
|
||||||
|
+%global framework_version 6.2
|
||||||
|
|
||||||
|
# IMPORTANT: everytime the requirements are changed, increment number by one
|
||||||
|
# - same for Provides in deps subpackage
|
||||||
|
--
|
||||||
|
2.51.1
|
||||||
|
|
||||||
70
SOURCES/0002-Update-build-container-up-to-f42.patch
Normal file
70
SOURCES/0002-Update-build-container-up-to-f42.patch
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
From 723b17561251a1b5fa01518966483c573142ac8e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tomas Fratrik <tfratrik@redhat.com>
|
||||||
|
Date: Tue, 19 Aug 2025 14:31:51 +0200
|
||||||
|
Subject: [PATCH 2/3] Update build container up to f42
|
||||||
|
|
||||||
|
* Add installation of python3-setuptools
|
||||||
|
* Drop fedora versions 35-40
|
||||||
|
|
||||||
|
Jira: RHELMISC-13271
|
||||||
|
---
|
||||||
|
Makefile | 8 ++++----
|
||||||
|
res/container-builds/Containerfile.fedora_generic | 2 +-
|
||||||
|
2 files changed, 5 insertions(+), 5 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/Makefile b/Makefile
|
||||||
|
index 1dc9a29..a68b8fe 100644
|
||||||
|
--- a/Makefile
|
||||||
|
+++ b/Makefile
|
||||||
|
@@ -82,7 +82,7 @@ help:
|
||||||
|
@echo " build create the RPM"
|
||||||
|
@echo " build_container create the RPM in container"
|
||||||
|
@echo " - set BUILD_CONTAINER to select the container"
|
||||||
|
- @echo " - available containers are:" el{8..9} f{35..40} rawhide
|
||||||
|
+ @echo " - available containers are:" el{8..9} f{41..42} rawhide
|
||||||
|
@echo " - this can't be used to build in parallel,"
|
||||||
|
@echo " as build containers operate on the same files"
|
||||||
|
@echo " clean_containers clean container images used for building"
|
||||||
|
@@ -154,7 +154,7 @@ build_container:
|
||||||
|
el[8-9]) \
|
||||||
|
_CONT_FILE="Containerfile.ubi"$${BUILD_CONTAINER: -1}; \
|
||||||
|
;; \
|
||||||
|
- f3[5-9]|f40|rawhide) \
|
||||||
|
+ f4[1-2]|rawhide) \
|
||||||
|
[ $$BUILD_CONTAINER = rawhide ] && VERSION=latest || VERSION=$${BUILD_CONTAINER: -2}; \
|
||||||
|
_CONT_FILE=".Containerfile.$${BUILD_CONTAINER}"; \
|
||||||
|
cp res/container-builds/Containerfile.fedora_generic res/container-builds/$$_CONT_FILE && \
|
||||||
|
@@ -165,7 +165,7 @@ build_container:
|
||||||
|
exit 1; \
|
||||||
|
;; \
|
||||||
|
*) \
|
||||||
|
- echo "Available containers are: el{8..9} f{35..40} rawhide"; \
|
||||||
|
+ echo "Available containers are: el{8..9} f{41..42} rawhide"; \
|
||||||
|
exit 1; \
|
||||||
|
;; \
|
||||||
|
esac && \
|
||||||
|
@@ -234,7 +234,7 @@ test_container_all:
|
||||||
|
done
|
||||||
|
|
||||||
|
clean_containers:
|
||||||
|
- @for i in "leapp-build-"{el8,el9,f35,f36,rawhide} "leapp-tests-rhel"{8..10}; do \
|
||||||
|
+ @for i in leapp-build-el{8,9} leapp-build-f{41..42} leapp-build-rawhide leapp-tests-rhel{8..10}; do \
|
||||||
|
[ -z $$($(_CONTAINER_TOOL) images -q "$$i") ] || \
|
||||||
|
$(_CONTAINER_TOOL) rmi "$$i" > /dev/null 2>&1 || :; \
|
||||||
|
done
|
||||||
|
diff --git a/res/container-builds/Containerfile.fedora_generic b/res/container-builds/Containerfile.fedora_generic
|
||||||
|
index c0af2b7..bd67876 100644
|
||||||
|
--- a/res/container-builds/Containerfile.fedora_generic
|
||||||
|
+++ b/res/container-builds/Containerfile.fedora_generic
|
||||||
|
@@ -5,7 +5,7 @@ VOLUME /payload
|
||||||
|
ENV DIST_VERSION 8
|
||||||
|
|
||||||
|
RUN dnf update -y && \
|
||||||
|
- dnf install -y python3 make git rpm-build python3-devel
|
||||||
|
+ dnf install -y python3 make git rpm-build python3-devel python3-setuptools
|
||||||
|
#yum install -y python3-pip && \ python3 -m pip install --upgrade pip==20.3.4
|
||||||
|
|
||||||
|
WORKDIR /payload
|
||||||
|
--
|
||||||
|
2.51.1
|
||||||
|
|
||||||
@ -0,0 +1,48 @@
|
|||||||
|
From 32cd2e7649236a3aa30f7763e1634cc26381afa7 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
|
||||||
|
Date: Thu, 9 Oct 2025 15:02:13 +0000
|
||||||
|
Subject: [PATCH 3/3] chore(deps): update actions/checkout action to v5
|
||||||
|
|
||||||
|
---
|
||||||
|
.github/workflows/reuse-copr-build.yml | 4 ++--
|
||||||
|
.github/workflows/unit-tests.yml | 2 +-
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/.github/workflows/reuse-copr-build.yml b/.github/workflows/reuse-copr-build.yml
|
||||||
|
index dc3af98..c2fb51c 100644
|
||||||
|
--- a/.github/workflows/reuse-copr-build.yml
|
||||||
|
+++ b/.github/workflows/reuse-copr-build.yml
|
||||||
|
@@ -49,7 +49,7 @@ jobs:
|
||||||
|
# TODO: The correct way to checkout would be to use simmilar approach as in get_commit_by_timestamp function of
|
||||||
|
# the github gluetool module (i.e. do not use HEAD but the last commit before comment).
|
||||||
|
id: checkout
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
+ uses: actions/checkout@v5
|
||||||
|
with:
|
||||||
|
ref: "refs/pull/${{ steps.pr_nr.outputs.pr_nr }}/head"
|
||||||
|
|
||||||
|
@@ -121,7 +121,7 @@ jobs:
|
||||||
|
- name: Checkout leapp-repository
|
||||||
|
id: checkout_leapp_repository
|
||||||
|
if: ${{ steps.leapp_repository_pr_regex_match.outputs.match != '' }}
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
+ uses: actions/checkout@v5
|
||||||
|
with:
|
||||||
|
repository: "oamg/leapp-repository"
|
||||||
|
ref: "refs/pull/${{ steps.leapp_repository_pr.outputs.leapp_repository_pr }}/head"
|
||||||
|
diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml
|
||||||
|
index 2702e93..70d624d 100644
|
||||||
|
--- a/.github/workflows/unit-tests.yml
|
||||||
|
+++ b/.github/workflows/unit-tests.yml
|
||||||
|
@@ -36,7 +36,7 @@ jobs:
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
+ uses: actions/checkout@v5
|
||||||
|
with:
|
||||||
|
fetch-depth: '0'
|
||||||
|
- name: Set main to origin/main
|
||||||
|
--
|
||||||
|
2.51.1
|
||||||
|
|
||||||
@ -7,7 +7,7 @@
|
|||||||
# it. In case of upstream, dependencies are set differently, but YUM is not
|
# it. In case of upstream, dependencies are set differently, but YUM is not
|
||||||
# capable enough to deal with them correctly all the time; we continue to use
|
# capable enough to deal with them correctly all the time; we continue to use
|
||||||
# simplified deps in RHEL to ensure that YUM can deal with it.
|
# simplified deps in RHEL to ensure that YUM can deal with it.
|
||||||
%global framework_version 6.1
|
%global framework_version 6.2
|
||||||
|
|
||||||
# IMPORTANT: everytime the requirements are changed, increment number by one
|
# IMPORTANT: everytime the requirements are changed, increment number by one
|
||||||
# - same for Provides in deps subpackage
|
# - same for Provides in deps subpackage
|
||||||
@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
Name: leapp
|
Name: leapp
|
||||||
Version: 0.20.0
|
Version: 0.20.0
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
Summary: OS & Application modernization framework
|
Summary: OS & Application modernization framework
|
||||||
|
|
||||||
License: ASL 2.0
|
License: ASL 2.0
|
||||||
@ -65,6 +65,9 @@ Requires: leapp-repository
|
|||||||
|
|
||||||
# PATCHES HERE
|
# PATCHES HERE
|
||||||
# Patch0001: filename.patch
|
# Patch0001: filename.patch
|
||||||
|
Patch0001: 0001-cli-Add-possibility-to-specify-aliases-for-CLI-optio.patch
|
||||||
|
Patch0002: 0002-Update-build-container-up-to-f42.patch
|
||||||
|
Patch0003: 0003-chore-deps-update-actions-checkout-action-to-v5.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Leapp utility provides the possibility to use the Leapp framework via CLI.
|
Leapp utility provides the possibility to use the Leapp framework via CLI.
|
||||||
@ -161,7 +164,9 @@ Requires: findutils
|
|||||||
|
|
||||||
# APPLY REGISTERED PATCHES HERE
|
# APPLY REGISTERED PATCHES HERE
|
||||||
# %%patch -P 0001 -p1
|
# %%patch -P 0001 -p1
|
||||||
|
%patch -P 0001 -p1
|
||||||
|
%patch -P 0002 -p1
|
||||||
|
%patch -P 0003 -p1
|
||||||
|
|
||||||
##################################################
|
##################################################
|
||||||
# Build
|
# Build
|
||||||
@ -246,6 +251,11 @@ install -m 0644 -p man/leapp.1 %{buildroot}%{_mandir}/man1/
|
|||||||
# no files here
|
# no files here
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Nov 13 2025 Karolina Kula <kkula@redhat.com> - 0.20.0-2
|
||||||
|
- Bump leapp-framework to 6.2
|
||||||
|
- Add possibility to specify aliases for CLI option
|
||||||
|
- Resolves: RHEL-128270
|
||||||
|
|
||||||
* Thu Aug 14 2025 Karolina Kula <kkula@redhat.com> - 0.20.0-1
|
* Thu Aug 14 2025 Karolina Kula <kkula@redhat.com> - 0.20.0-1
|
||||||
- Rebase to new upstream 0.20.0
|
- Rebase to new upstream 0.20.0
|
||||||
- Resolves: RHEL-67625
|
- Resolves: RHEL-67625
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user