1 Commits

Author SHA256 Message Date
e-minguez
39b878ce77 feat: Add suse-edge-components-versions
All checks were successful
Check Release Manifest Local Charts Versions / Check Release Manifest Local Charts Versions (pull_request) Successful in 0s
Build PR in OBS / Build PR in OBS (pull_request_target) Successful in 52m45s
2025-08-06 09:35:05 +02:00
17 changed files with 320 additions and 0 deletions

24
.gitmodules vendored
View File

@@ -13,3 +13,27 @@
[submodule "autoconf"]
path = autoconf
url = https://src.opensuse.org/SLFO-pool/autoconf.git
[submodule "python-pydantic"]
path = python-pydantic
url = https://src.opensuse.org/SLFO-pool/python-pydantic
[submodule "python-pydantic-core"]
path = python-pydantic-core
url = https://src.opensuse.org/SLFO-pool/python-pydantic-core
[submodule "python-inline-snapshot"]
path = python-inline-snapshot
url = https://src.opensuse.org/SLFO-pool/python-inline-snapshot
[submodule "python-executing"]
path = python-executing
url = https://src.opensuse.org/SLFO-pool/python-executing
[submodule "python-typing-inspection"]
path = python-typing-inspection
url = https://src.opensuse.org/SLFO-pool/python-typing-inspection
[submodule "python-annotated-types"]
path = python-annotated-types
url = https://src.opensuse.org/SLFO-pool/python-annotated-types
[submodule "python-typing_extensions"]
path = python-typing_extensions
url = https://src.opensuse.org/SLFO-pool/python-typing_extensions
[submodule "python-flit-core"]
path = python-flit-core
url = https://src.opensuse.org/SLFO-pool/python-flit-core

View File

@@ -50,6 +50,15 @@ Macros:
BuildFlags: excludebuild:autoconf:el
BuildFlags: excludebuild:autoconf:testsuite
# Missing deps for python packages related to suse-edge-components-versions
BuildFlags: excludebuild:python-pydantic:test
BuildFlags: excludebuild:python-pydantic-core:test
BuildFlags: excludebuild:python-inline-snapshot:test
BuildFlags: excludebuild:python-executing:test
BuildFlags: excludebuild:python-annotated-types:test
BuildFlags: excludebuild:python-typing-inspection:test
BuildFlags: excludebuild:python-typing_extensions:test
# Only build manifest embedding images here
%if "%_repository" == "test_manifest_images"
BuildFlags: onlybuild:edge-image-builder-image

1
python-executing Submodule

Submodule python-executing added at ac466db0b5

1
python-flit-core Submodule

Submodule python-flit-core added at 4362b05ea3

1
python-pydantic Submodule

Submodule python-pydantic added at f19a5a780f

1
python-pydantic-core Submodule

Submodule python-pydantic-core added at 00355d0825

3
python-rich/_service Normal file
View File

@@ -0,0 +1,3 @@
<services>
<service name="download_assets"></service>
</services>

View File

@@ -0,0 +1,45 @@
From 08be21dadfd2ce9e96e41e366ab38bd8d7cd0e39 Mon Sep 17 00:00:00 2001
From: Dan Lazin <dlazin@users.noreply.github.com>
Date: Tue, 7 Jan 2025 16:04:56 -0500
Subject: [PATCH] Fix test that changed with Pygments 2.19.
---
tests/test_markdown.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: rich-13.9.4/tests/test_markdown.py
===================================================================
--- rich-13.9.4.orig/tests/test_markdown.py
+++ rich-13.9.4/tests/test_markdown.py
@@ -110,7 +110,7 @@ def test_inline_code():
inline_code_theme="emacs",
)
result = render(markdown)
- expected = "inline \x1b[1;38;2;170;34;255;48;2;248;248;248mimport\x1b[0m\x1b[38;2;0;0;0;48;2;248;248;248m \x1b[0m\x1b[1;38;2;0;0;255;48;2;248;248;248mthis\x1b[0m code \n"
+ expected = "inline \x1b[1;38;2;170;34;255;48;2;248;248;248mimport\x1b[0m\x1b[38;2;187;187;187;48;2;248;248;248m \x1b[0m\x1b[1;38;2;0;0;255;48;2;248;248;248mthis\x1b[0m code \n"
print(result)
print(repr(result))
assert result == expected
Index: rich-13.9.4/tests/test_syntax.py
===================================================================
--- rich-13.9.4.orig/tests/test_syntax.py
+++ rich-13.9.4/tests/test_syntax.py
@@ -53,7 +53,7 @@ def test_blank_lines():
print(repr(result))
assert (
result
- == "\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m1 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m2 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m3 \x1b[0m\x1b[1;38;2;0;128;0;48;2;248;248;248mimport\x1b[0m\x1b[38;2;0;0;0;48;2;248;248;248m \x1b[0m\x1b[1;38;2;0;0;255;48;2;248;248;248mthis\x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m4 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m5 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n"
+ == "\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m1 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m2 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m3 \x1b[0m\x1b[1;38;2;0;128;0;48;2;248;248;248mimport\x1b[0m\x1b[38;2;187;187;187;48;2;248;248;248m \x1b[0m\x1b[1;38;2;0;0;255;48;2;248;248;248mthis\x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m4 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n\x1b[1;38;2;24;24;24;48;2;248;248;248m \x1b[0m\x1b[38;2;173;173;173;48;2;248;248;248m5 \x1b[0m\x1b[48;2;248;248;248m \x1b[0m\n"
)
@@ -119,7 +119,7 @@ def test_python_render_simple_indent_gui
)
rendered_syntax = render(syntax)
print(repr(rendered_syntax))
- expected = '\x1b[34mdef\x1b[0m \x1b[32mloop_first_last\x1b[0m(values: Iterable[T]) -> Iterable[Tuple[\x1b[36mb\x1b[0m\n\x1b[2;37m│ \x1b[0m\x1b[33m"""Iterate and generate a tuple with a flag for first an\x1b[0m\n\x1b[2m│ \x1b[0miter_values = \x1b[36miter\x1b[0m(values)\n\x1b[2m│ \x1b[0m\x1b[34mtry\x1b[0m:\n\x1b[2m│ │ \x1b[0mprevious_value = \x1b[36mnext\x1b[0m(iter_values)\n\x1b[2m│ \x1b[0m\x1b[34mexcept\x1b[0m \x1b[36mStopIteration\x1b[0m:\n\x1b[2m│ │ \x1b[0m\x1b[34mreturn\x1b[0m\n\x1b[2m│ \x1b[0mfirst = \x1b[34mTrue\x1b[0m\n\x1b[2m│ \x1b[0m\x1b[34mfor\x1b[0m value \x1b[35min\x1b[0m iter_values:\n\x1b[2m│ │ \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mFalse\x1b[0m, previous_value\n\x1b[2m│ │ \x1b[0mfirst = \x1b[34mFalse\x1b[0m\n\x1b[2m│ │ \x1b[0mprevious_value = value\n\x1b[2m│ \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mTrue\x1b[0m, previous_value\n'
+ expected = '\x1b[34mdef\x1b[0m\x1b[37m \x1b[0m\x1b[32mloop_first_last\x1b[0m(values: Iterable[T]) -> Iterable[Tuple[\x1b[36mb\x1b[0m\n\x1b[2;37m│ \x1b[0m\x1b[33m"""Iterate and generate a tuple with a flag for first an\x1b[0m\n\x1b[2m│ \x1b[0miter_values = \x1b[36miter\x1b[0m(values)\n\x1b[2m│ \x1b[0m\x1b[34mtry\x1b[0m:\n\x1b[2m│ │ \x1b[0mprevious_value = \x1b[36mnext\x1b[0m(iter_values)\n\x1b[2m│ \x1b[0m\x1b[34mexcept\x1b[0m \x1b[36mStopIteration\x1b[0m:\n\x1b[2m│ │ \x1b[0m\x1b[34mreturn\x1b[0m\n\x1b[2m│ \x1b[0mfirst = \x1b[34mTrue\x1b[0m\n\x1b[2m│ \x1b[0m\x1b[34mfor\x1b[0m value \x1b[35min\x1b[0m iter_values:\n\x1b[2m│ │ \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mFalse\x1b[0m, previous_value\n\x1b[2m│ │ \x1b[0mfirst = \x1b[34mFalse\x1b[0m\n\x1b[2m│ │ \x1b[0mprevious_value = value\n\x1b[2m│ \x1b[0m\x1b[34myield\x1b[0m first, \x1b[34mTrue\x1b[0m, previous_value\n'
assert rendered_syntax == expected

View File

@@ -0,0 +1,66 @@
#
# spec file for package python-rich
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2020-2021, Martin Hauke <mardnh@gmx.de>
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?sle15_python_module_pythons}
Name: python-rich
Version: 14.0.0
Release: 0
Summary: A Python library for rich text and beautiful formatting in the terminal
License: MIT
URL: https://github.com/Textualize/rich
#!RemoteAsset: https://github.com/Textualize/rich/archive/refs/tags/v%{version}.tar.gz rich-%{version}.tar.gz
Source: rich-%{version}.tar.gz
# PATCH-FIX-UPSTREAM https://github.com/Textualize/rich/pull/3604 Fix test that changed with Pygments 2.19.
# and https://github.com/Textualize/rich/pull/3608 fix remaining tests with Pygments 2.19 #3604 did not fix
Patch: pygments.patch
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module markdown-it-py >= 2.2.0}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module poetry-core}
BuildRequires: %{python_module pygments >= 2.13.0}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-markdown-it-py >= 2.2.0
Requires: python-pygments >= 2.13.0
Suggests: python-ipywidgets >= 7.5.1
BuildArch: noarch
# TODO(edu): Disabled all tests
%python_subpackages
%description
Render rich text, tables, progress bars, syntax highlighting,
markdown and more to the terminal.
%prep
%autosetup -p1 -n rich-%{version}
%build
%pyproject_wheel
%install
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%files %{python_files}
%license LICENSE
%doc README.md
%{python_sitelib}/rich
%{python_sitelib}/rich-%{version}.dist-info
%changelog

View File

@@ -0,0 +1,3 @@
<services>
<service name="download_assets"></service>
</services>

View File

@@ -0,0 +1,98 @@
#
# spec file for package python-suse-edge-components-versions
#
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
%global mod_name suse-edge-components-versions
%global pythons %{primary_python}
%if 0%{?suse_version} == 1500
%sle15_python_module_pythons
%endif
Name: python-suse-edge-components-versions
Version: 0.1.0
Release: 0%{?dist}
Summary: A tool to gather and display component versions for SUSE Edge products.
License: Apache-2.0
URL: https://github.com/suse-edge/support-tools/tree/main/components-versions
#!RemoteAsset: https://github.com/suse-edge/support-tools/archive/refs/tags/components-versions-v%{version}.tar.gz
Source: components-versions-v0.1.0.tar.gz
BuildArch: noarch
BuildRequires: python-rpm-macros
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module wheel}
# Requires:
Requires: %{python_module kubernetes}
Requires: %{python_module pyhelm3}
Requires: %{python_module tabulate}
Requires: %{python_module pydantic >= 2.0}
Requires: helm
# This macro automatically creates subpackages for each Python version
# (e.g., python311-suse-edge-components-versions, python312-suse-edge-components-versions).
%python_subpackages
%description
This tool provides functionality to gather and display component versions
for various SUSE Edge products. It helps in understanding the exact versions
of software components used in different product releases and ensures
consistency across deployments.
%prep
# Unpack the source tarball.
# The tarball extracts into 'support-tools-components-versions-v%{version}'.
%setup -q -n support-tools-components-versions-v%{version}
%build
# The actual Python project (containing pyproject.toml and the source code)
# is nested inside the 'components-versions' directory within the extracted tarball.
# We need to change into this directory before building.
cd components-versions
%pyproject_wheel .
cd ..
%install
cd components-versions
%pyproject_install
# Rename the main executable from 'components-versions' to 'suse-edge-components-versions'
mv %{buildroot}%{_bindir}/components-versions %{buildroot}%{_bindir}/suse-edge-components-versions
%python_clone -a %{buildroot}%{_bindir}/suse-edge-components-versions
cd ..
# Move the json files to /usr/share/suse-edge-components-versions instead
mkdir -p %{buildroot}/usr/share/suse-edge-components-versions/
mv %{buildroot}%{python_sitelib}/components_versions/data/*.json %{buildroot}/usr/share/suse-edge-components-versions/
rmdir %{buildroot}%{python_sitelib}/components_versions/data/
%post
%python_install_alternative suse-edge-components-versions
%postun
%python_uninstall_alternative suse-edge-components-versions
%files %{python_files}
%license LICENSE
%{python_sitelib}/components_versions
# Include the Python package metadata (e.g., .dist-info or .egg-info).
# The .dist-info name is based on the 'name' field in pyproject.toml.
%{python_sitelib}/suse_edge_components_versions-%{version}*.dist-info
# Include the main executable with its new name.
%python_alternative %{_bindir}/suse-edge-components-versions
# Include the json files
/usr/share/suse-edge-components-versions/
%changelog

View File

@@ -0,0 +1,52 @@
# SPDX-License-Identifier: Apache-2.0
#!BuildTag: %%IMG_PREFIX%%suse-edge-components-versions:0.1.0
#!BuildTag: %%IMG_PREFIX%%suse-edge-components-versions:0.1.0-%RELEASE%
ARG SLE_VERSION
FROM registry.suse.com/bci/bci-micro:$SLE_VERSION AS micro
FROM registry.suse.com/bci/bci-base:$SLE_VERSION AS base
COPY --from=micro / /installroot/
RUN sed -i -e 's%^# rpm.install.excludedocs = no.*%rpm.install.excludedocs = yes%g' /etc/zypp/zypp.conf
RUN zypper --installroot /installroot --non-interactive install --no-recommends python311-suse-edge-components-versions
# https://opensource.suse.com/bci-docs/guides/adding-users/
ARG USERNAME=suse
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME
# build actual image
FROM micro AS final
MAINTAINER SUSE LLC (https://www.suse.com/)
# Define labels according to https://en.opensuse.org/Building_derived_containers
LABEL org.opencontainers.image.title="SUSE Edge components-versions Container Image"
LABEL org.opencontainers.image.description="Gather and display component versions for various SUSE Edge products"
LABEL org.opencontainers.image.url="https://github.com/suse-edge/support-tools/tree/main/components-versions"
LABEL org.opencontainers.image.created="%BUILDTIME%"
LABEL org.opencontainers.image.vendor="SUSE LLC"
LABEL org.opencontainers.image.version="0.1.0"
LABEL org.opensuse.reference="%%IMG_REPO%%/%%IMG_PREFIX%%suse-edge-components-versions:0.1.0-%RELEASE%"
LABEL org.openbuildservice.disturl="%DISTURL%"
LABEL com.suse.supportlevel="%%SUPPORT_LEVEL%%"
LABEL com.suse.eula="SUSE Combined EULA February 2024"
LABEL com.suse.lifecycle-url="https://www.suse.com/lifecycle"
LABEL com.suse.image-type="application"
LABEL com.suse.release-stage="released"
# endlabelprefix
COPY --from=base /installroot /
# https://opensource.suse.com/bci-docs/guides/adding-users/
COPY --from=base /etc/passwd /etc/passwd
COPY --from=base /etc/group /etc/group
COPY --from=base /etc/shadow /etc/shadow
COPY --from=base /home/$USERNAME /home/$USERNAME
USER ${USERNAME}
ENTRYPOINT ["/usr/bin/suse-edge-components-versions"]

View File

@@ -0,0 +1,12 @@
<services>
<service mode="buildtime" name="kiwi_metainfo_helper"/>
<service name="replace_using_env" mode="buildtime">
<param name="file">Dockerfile</param>
<param name="eval">IMG_PREFIX=$(rpm --macros=/root/.rpmmacros -E %{?img_prefix})</param>
<param name="var">IMG_PREFIX</param>
<param name="eval">IMG_REPO=$(rpm --macros=/root/.rpmmacros -E %img_repo)</param>
<param name="var">IMG_REPO</param>
<param name="eval">SUPPORT_LEVEL=$(rpm --macros=/root/.rpmmacros -E %support_level)</param>
<param name="var">SUPPORT_LEVEL</param>
</service>
</services>