From 51cc6c8f52b406e389fda1f1d17a57c0711adca379f7b47d31dfcf96416f27c8 Mon Sep 17 00:00:00 2001 From: David Cassany Date: Thu, 30 Mar 2023 07:27:22 +0000 Subject: [PATCH] =?UTF-8?q?-=20Update=20to=20version=201680160876.6dcaef0:?= =?UTF-8?q?=20=20=20*=20Bump=20version:=200.0.6=20=E2=86=92=200.0.7=20=20?= =?UTF-8?q?=20*=20Fix=20default=20value=20for=20empty=20or=20missing=20ver?= =?UTF-8?q?sion=20=20=20*=20Bump=20flake8=20from=205.0.1=20to=205.0.4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OBS-URL: https://build.opensuse.org/package/show/Virtualization:containers/obs-service-replace_using_package_version?expand=0&rev=16 --- _servicedata | 2 +- ...service-replace_using_package_version.changes | 8 ++++++++ obs-service-replace_using_package_version.spec | 4 ++-- replace_using_package_version.py | 16 ++++++++-------- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/_servicedata b/_servicedata index 5cfcf75..ef3e7fc 100644 --- a/_servicedata +++ b/_servicedata @@ -1,4 +1,4 @@ https://github.com/openSUSE/obs-service-replace_using_package_version.git - 71deb28fee3d2bd774404ee4018080fbb47a6247 \ No newline at end of file + 6dcaef0f89b089ac6f83200ce25c0d907e45111a \ No newline at end of file diff --git a/obs-service-replace_using_package_version.changes b/obs-service-replace_using_package_version.changes index 0a4bc8e..12cd965 100644 --- a/obs-service-replace_using_package_version.changes +++ b/obs-service-replace_using_package_version.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Mar 30 07:25:53 UTC 2023 - containers@suse.com + +- Update to version 1680160876.6dcaef0: + * Bump version: 0.0.6 → 0.0.7 + * Fix default value for empty or missing version + * Bump flake8 from 5.0.1 to 5.0.4 + ------------------------------------------------------------------- Thu Nov 10 14:26:46 UTC 2022 - containers@suse.com diff --git a/obs-service-replace_using_package_version.spec b/obs-service-replace_using_package_version.spec index a4cd2de..051f4ab 100644 --- a/obs-service-replace_using_package_version.spec +++ b/obs-service-replace_using_package_version.spec @@ -1,7 +1,7 @@ # # spec file # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define service replace_using_package_version Name: obs-service-%{service} -Version: 0.0.6 +Version: 0.0.7 Release: 0 Summary: An OBS service: Replaces a regex with the version value of a package License: GPL-3.0-or-later diff --git a/replace_using_package_version.py b/replace_using_package_version.py index 970398f..e07da84 100644 --- a/replace_using_package_version.py +++ b/replace_using_package_version.py @@ -161,22 +161,22 @@ def apply_regex_to_file(input_file, output_file, regex, replacement): def find_package_version(package, rpm_dir): - version = parse_version('') + version = None try: version = get_pkg_version(package) except Exception: version = find_package_version_in_local_repos(rpm_dir, package) - if not str(version): + if version is None: version = find_package_version_in_obsinfo('.', package) - if not str(version): + if version is None: raise Exception('Package version not found') return str(version) def find_package_version_in_local_repos(repo_path, package): - version = parse_version('') + version = None for root, _, files in os.walk(repo_path): packages = [ f for f in files if f.endswith('rpm') and package in f @@ -185,17 +185,17 @@ def find_package_version_in_local_repos(repo_path, package): rpm_file = os.path.join(root, pkg) if get_pkg_name_from_rpm(rpm_file) == package: rpm_ver = get_pkg_version_from_rpm(rpm_file) - if rpm_ver >= version: + if version is None or rpm_ver >= version: version = rpm_ver return version def find_package_version_in_obsinfo(path, package): - version = parse_version('') + version = None for f in os.listdir(path): if f.endswith('obsinfo') and package in f: obsinfo_ver = get_pkg_version_from_obsinfo(f) - if obsinfo_ver >= version: + if version is None or obsinfo_ver >= version: version = obsinfo_ver return version @@ -219,7 +219,7 @@ def get_pkg_version_from_obsinfo(obsinfo_file): match = regex.match(line) if match: return parse_version(match[1]) - return parse_version('') + return None def get_pkg_name_from_rpm(rpm_file):