From 1e02ae2cfb3b86ad7bf7b3a1d3034b83d767bfb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Mon, 15 Jul 2024 12:59:12 +0200 Subject: [PATCH] Sync from SUSE:ALP:Source:Standard:1.0 saltbundlepy-rpm-vercmp revision d3ad0b20f27aa93f815c4fd4e002fdb5 --- .gitattributes | 23 +++++ fix-circumflex-handling.patch | 29 +++++++ remove-pbr-dependency.patch | 45 ++++++++++ rpm_vercmp-0.1.2.tar.gz | 3 + rpmvercmp.at | 149 ++++++++++++++++++++++++++++++++ saltbundlepy-rpm-vercmp.changes | 35 ++++++++ saltbundlepy-rpm-vercmp.spec | 76 ++++++++++++++++ 7 files changed, 360 insertions(+) create mode 100644 .gitattributes create mode 100644 fix-circumflex-handling.patch create mode 100644 remove-pbr-dependency.patch create mode 100644 rpm_vercmp-0.1.2.tar.gz create mode 100644 rpmvercmp.at create mode 100644 saltbundlepy-rpm-vercmp.changes create mode 100644 saltbundlepy-rpm-vercmp.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..fecc750 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/fix-circumflex-handling.patch b/fix-circumflex-handling.patch new file mode 100644 index 0000000..c887255 --- /dev/null +++ b/fix-circumflex-handling.patch @@ -0,0 +1,29 @@ +--- a/rpm_vercmp/vercmp.py 2016-02-23 19:09:14.000000000 +0300 ++++ b/rpm_vercmp/vercmp.py 2021-10-22 16:49:28.675442381 +0300 +@@ -20,7 +20,7 @@ + + + class Vercmp(object): +- R_NONALNUMTILDE = re.compile(br"^([^a-zA-Z0-9~]*)(.*)$") ++ R_NONALNUMTILDE = re.compile(br"^([^a-zA-Z0-9~^]*)(.*)$") + R_NUM = re.compile(br"^([\d]+)(.*)$") + R_ALPHA = re.compile(br"^([a-zA-Z]+)(.*)$") + +@@ -46,6 +46,17 @@ + if second.startswith(b'~'): + return 1 + ++ # handle the circumflex separator ++ if first.startswith(b'^'): ++ if second.startswith(b'^'): ++ first, second = first[1:], second[1:] ++ continue ++ first = first[1:] ++ return -1 if second else 1 ++ if second.startswith(b'^'): ++ second = second[1:] ++ return 1 if first else -1 ++ + # If we ran to the end of either, we are finished with the loop + if not first or not second: + break diff --git a/remove-pbr-dependency.patch b/remove-pbr-dependency.patch new file mode 100644 index 0000000..625bf8c --- /dev/null +++ b/remove-pbr-dependency.patch @@ -0,0 +1,45 @@ +diff -urN a/rpm_vercmp.egg-info/pbr.json b/rpm_vercmp.egg-info/pbr.json +--- a/rpm_vercmp.egg-info/pbr.json 2018-10-30 17:29:00.000000000 +0300 ++++ b/rpm_vercmp.egg-info/pbr.json 1970-01-01 03:00:00.000000000 +0300 +@@ -1 +0,0 @@ +-{"is_release": true, "git_version": "15c5c29"} +\ No newline at end of file +diff -urN a/rpm_vercmp.egg-info/SOURCES.txt b/rpm_vercmp.egg-info/SOURCES.txt +--- a/rpm_vercmp.egg-info/SOURCES.txt 2018-10-30 17:29:01.000000000 +0300 ++++ b/rpm_vercmp.egg-info/SOURCES.txt 2021-12-16 15:52:25.138791261 +0300 +@@ -14,7 +14,6 @@ + rpm_vercmp.egg-info/SOURCES.txt + rpm_vercmp.egg-info/dependency_links.txt + rpm_vercmp.egg-info/not-zip-safe +-rpm_vercmp.egg-info/pbr.json + rpm_vercmp.egg-info/top_level.txt + rpm_vercmp/tests/__init__.py + rpm_vercmp/tests/vercmp_test.py +\ No newline at end of file +diff -urN a/setup.cfg b/setup.cfg +--- a/setup.cfg 2018-10-30 17:29:01.000000000 +0300 ++++ b/setup.cfg 2021-12-16 15:52:25.138791261 +0300 +@@ -23,11 +23,6 @@ + [files] + packages = rpm_vercmp + +-[pbr] +-autodoc_tree_index = true +-autodoc_index_modules = true +-autodoc_exclude_modules = rpm_vercmp.tests.* +- + [flake8] + ignore = E402 + +diff -urN a/setup.py b/setup.py +--- a/setup.py 2016-02-23 19:09:14.000000000 +0300 ++++ b/setup.py 2021-12-16 16:00:39.867128372 +0300 +@@ -1,6 +1,6 @@ + from setuptools import setup + + setup( +- setup_requires=["pbr"], +- pbr=True, ++ name="rpm_vercmp", ++ packages=["rpm_vercmp"], + ) diff --git a/rpm_vercmp-0.1.2.tar.gz b/rpm_vercmp-0.1.2.tar.gz new file mode 100644 index 0000000..200e2ff --- /dev/null +++ b/rpm_vercmp-0.1.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:73dd583f1ff7a798faff62d39659d8a3e5183099972b2fc028bfadd70a43eda8 +size 8852 diff --git a/rpmvercmp.at b/rpmvercmp.at new file mode 100644 index 0000000..a245a11 --- /dev/null +++ b/rpmvercmp.at @@ -0,0 +1,149 @@ +# rpmvercmp.at: rpm version comparison tests + +m4_define([RPMVERCMP],[ +AT_SETUP([rpmvercmp($1, $2) = $3]) +AT_KEYWORDS([vercmp]) +AT_CHECK([ +runroot rpm --eval '%{lua: print(rpm.vercmp("$1", "$2"))}'], [0], [$3 +], []) +AT_CLEANUP +]) + +AT_BANNER([RPM version comparison]) + +RPMVERCMP(1.0, 1.0, 0) +RPMVERCMP(1.0, 2.0, -1) +RPMVERCMP(2.0, 1.0, 1) + +RPMVERCMP(2.0.1, 2.0.1, 0) +RPMVERCMP(2.0, 2.0.1, -1) +RPMVERCMP(2.0.1, 2.0, 1) + +RPMVERCMP(2.0.1a, 2.0.1a, 0) +RPMVERCMP(2.0.1a, 2.0.1, 1) +RPMVERCMP(2.0.1, 2.0.1a, -1) + +RPMVERCMP(5.5p1, 5.5p1, 0) +RPMVERCMP(5.5p1, 5.5p2, -1) +RPMVERCMP(5.5p2, 5.5p1, 1) + +RPMVERCMP(5.5p10, 5.5p10, 0) +RPMVERCMP(5.5p1, 5.5p10, -1) +RPMVERCMP(5.5p10, 5.5p1, 1) + +RPMVERCMP(10xyz, 10.1xyz, -1) +RPMVERCMP(10.1xyz, 10xyz, 1) + +RPMVERCMP(xyz10, xyz10, 0) +RPMVERCMP(xyz10, xyz10.1, -1) +RPMVERCMP(xyz10.1, xyz10, 1) + +RPMVERCMP(xyz.4, xyz.4, 0) +RPMVERCMP(xyz.4, 8, -1) +RPMVERCMP(8, xyz.4, 1) +RPMVERCMP(xyz.4, 2, -1) +RPMVERCMP(2, xyz.4, 1) + +RPMVERCMP(5.5p2, 5.6p1, -1) +RPMVERCMP(5.6p1, 5.5p2, 1) + +RPMVERCMP(5.6p1, 6.5p1, -1) +RPMVERCMP(6.5p1, 5.6p1, 1) + +RPMVERCMP(6.0.rc1, 6.0, 1) +RPMVERCMP(6.0, 6.0.rc1, -1) + +RPMVERCMP(10b2, 10a1, 1) +RPMVERCMP(10a2, 10b2, -1) + +RPMVERCMP(1.0aa, 1.0aa, 0) +RPMVERCMP(1.0a, 1.0aa, -1) +RPMVERCMP(1.0aa, 1.0a, 1) + +RPMVERCMP(10.0001, 10.0001, 0) +RPMVERCMP(10.0001, 10.1, 0) +RPMVERCMP(10.1, 10.0001, 0) +RPMVERCMP(10.0001, 10.0039, -1) +RPMVERCMP(10.0039, 10.0001, 1) + +RPMVERCMP(4.999.9, 5.0, -1) +RPMVERCMP(5.0, 4.999.9, 1) + +RPMVERCMP(20101121, 20101121, 0) +RPMVERCMP(20101121, 20101122, -1) +RPMVERCMP(20101122, 20101121, 1) + +RPMVERCMP(2_0, 2_0, 0) +RPMVERCMP(2.0, 2_0, 0) +RPMVERCMP(2_0, 2.0, 0) + +dnl RhBug:178798 case +RPMVERCMP(a, a, 0) +RPMVERCMP(a+, a+, 0) +RPMVERCMP(a+, a_, 0) +RPMVERCMP(a_, a+, 0) +RPMVERCMP(+a, +a, 0) +RPMVERCMP(+a, _a, 0) +RPMVERCMP(_a, +a, 0) +RPMVERCMP(+_, +_, 0) +RPMVERCMP(_+, +_, 0) +RPMVERCMP(_+, _+, 0) +RPMVERCMP(+, _, 0) +RPMVERCMP(_, +, 0) + +dnl Basic testcases for tilde sorting +RPMVERCMP(1.0~rc1, 1.0~rc1, 0) +RPMVERCMP(1.0~rc1, 1.0, -1) +RPMVERCMP(1.0, 1.0~rc1, 1) +RPMVERCMP(1.0~rc1, 1.0~rc2, -1) +RPMVERCMP(1.0~rc2, 1.0~rc1, 1) +RPMVERCMP(1.0~rc1~git123, 1.0~rc1~git123, 0) +RPMVERCMP(1.0~rc1~git123, 1.0~rc1, -1) +RPMVERCMP(1.0~rc1, 1.0~rc1~git123, 1) + +dnl Basic testcases for caret sorting +RPMVERCMP(1.0^, 1.0^, 0) +RPMVERCMP(1.0^, 1.0, 1) +RPMVERCMP(1.0, 1.0^, -1) +RPMVERCMP(1.0^git1, 1.0^git1, 0) +RPMVERCMP(1.0^git1, 1.0, 1) +RPMVERCMP(1.0, 1.0^git1, -1) +RPMVERCMP(1.0^git1, 1.0^git2, -1) +RPMVERCMP(1.0^git2, 1.0^git1, 1) +RPMVERCMP(1.0^git1, 1.01, -1) +RPMVERCMP(1.01, 1.0^git1, 1) +RPMVERCMP(1.0^20160101, 1.0^20160101, 0) +RPMVERCMP(1.0^20160101, 1.0.1, -1) +RPMVERCMP(1.0.1, 1.0^20160101, 1) +RPMVERCMP(1.0^20160101^git1, 1.0^20160101^git1, 0) +RPMVERCMP(1.0^20160102, 1.0^20160101^git1, 1) +RPMVERCMP(1.0^20160101^git1, 1.0^20160102, -1) + +dnl Basic testcases for tilde and caret sorting +RPMVERCMP(1.0~rc1^git1, 1.0~rc1^git1, 0) +RPMVERCMP(1.0~rc1^git1, 1.0~rc1, 1) +RPMVERCMP(1.0~rc1, 1.0~rc1^git1, -1) +RPMVERCMP(1.0^git1~pre, 1.0^git1~pre, 0) +RPMVERCMP(1.0^git1, 1.0^git1~pre, 1) +RPMVERCMP(1.0^git1~pre, 1.0^git1, -1) + +dnl These are included here to document current, arguably buggy behaviors +dnl for reference purposes and for easy checking against unintended +dnl behavior changes. +dnl +dnl AT_BANNER([RPM version comparison oddities]) +dnl RhBug:811992 case +dnl RPMVERCMP(1b.fc17, 1b.fc17, 0) +dnl RPMVERCMP(1b.fc17, 1.fc17, -1) +dnl RPMVERCMP(1.fc17, 1b.fc17, 1) +dnl RPMVERCMP(1g.fc17, 1g.fc17, 0) +dnl RPMVERCMP(1g.fc17, 1.fc17, 1) +dnl RPMVERCMP(1.fc17, 1g.fc17, -1) + +dnl Non-ascii characters are considered equal so these are all the same, eh... +dnl RPMVERCMP(1.1.α, 1.1.α, 0) +dnl RPMVERCMP(1.1.α, 1.1.β, 0) +dnl RPMVERCMP(1.1.β, 1.1.α, 0) +dnl RPMVERCMP(1.1.αα, 1.1.α, 0) +dnl RPMVERCMP(1.1.α, 1.1.ββ, 0) +dnl RPMVERCMP(1.1.ββ, 1.1.αα, 0) diff --git a/saltbundlepy-rpm-vercmp.changes b/saltbundlepy-rpm-vercmp.changes new file mode 100644 index 0000000..9b27ef5 --- /dev/null +++ b/saltbundlepy-rpm-vercmp.changes @@ -0,0 +1,35 @@ +------------------------------------------------------------------- +Mon Apr 4 13:03:49 UTC 2022 - Victor Zhestkov + +- Strictly require Python 3.10 with saltbundlepy requrement + +------------------------------------------------------------------- +Thu Dec 16 13:02:08 UTC 2021 - Victor Zhestkov + +- Prevent building the package with no module inside + +- Updated: + * remove-pbr-dependency.patch + +------------------------------------------------------------------- +Fri Oct 22 14:32:43 UTC 2021 - Victor Zhestkov + +- Run the tests fully offline + +- Added: + * rpmvercmp.at + +------------------------------------------------------------------- +Fri Oct 22 14:13:02 UTC 2021 - Victor Zhestkov + +- Implement circumflex (^) symbol handling for vercmp +- Remove pbr module dependency for building + +- Added: + * fix-circumflex-handling.patch + * remove-pbr-dependency.patch + +------------------------------------------------------------------- +Fri Oct 22 13:16:16 UTC 2021 - Victor Zhestkov + +- Version 0.1.2: initial build diff --git a/saltbundlepy-rpm-vercmp.spec b/saltbundlepy-rpm-vercmp.spec new file mode 100644 index 0000000..e213812 --- /dev/null +++ b/saltbundlepy-rpm-vercmp.spec @@ -0,0 +1,76 @@ +# +# spec file for package saltbundlepy-rpm-vercmp +# +# Copyright (c) 2021 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/ +# + + +%{?!saltbundlepy_module:%define saltbundlepy_module() saltbundlepy-%{**}} +%define pythons saltbundlepy + +# Disable python bytecompile for all distros +# It's called explicitly in the spec +%global __brp_python_bytecompile %{nil} + +Name: saltbundlepy-rpm-vercmp +Version: 0.1.2 +Release: 0 +Summary: Pure Python implementation of rpmvercmp +License: Apache-2.0 +Group: Development/Languages/Python +URL: https://github.com/sassoftware/python-rpm-vercmp +Source: https://files.pythonhosted.org/packages/source/r/rpm_vercmp/rpm_vercmp-%{version}.tar.gz +Source1: rpmvercmp.at +# PATCH-FIX_UPSTREAM https://github.com/sassoftware/python-rpm-vercmp/pull/3 +Patch1: fix-circumflex-handling.patch +Patch2: remove-pbr-dependency.patch +BuildRequires: %{saltbundlepy_module base >= 3.10} +BuildRequires: %{saltbundlepy_module pytest} +BuildRequires: %{saltbundlepy_module requests} +BuildRequires: %{saltbundlepy_module setuptools} +BuildRequires: fdupes +BuildRequires: saltbundlepy-rpm-macros +Requires: saltbundlepy-base +BuildArch: noarch +%python_subpackages + +%description +The RPM Package Manager (http://rpm.org) has a version comparision algorithm, +implemented in its C library, which performs the comparison in a certain way. + +In certain circumstances, where the C library is not installable (for example, +on non-rpm based systems), or does not support the desired version of the python interpreter, +the pure-python implementation may be useful. + +%prep +%setup -q -n rpm_vercmp-%{version} +%autopatch -p1 + +%build +%python_build + +%install +%python_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +cp %{S:1} rpm_vercmp/tests/ +%pytest + +%files %{python_files} +%license LICENSE +%doc ChangeLog README.rst +%{python_sitelib}/rpm_vercmp* + +%changelog