Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package obs-service-set_version for
openSUSE:Factory checked in at 2024-05-07 18:02:17
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-set_version (Old)
and /work/SRC/openSUSE:Factory/.obs-service-set_version.new.1880 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "obs-service-set_version"
Tue May 7 18:02:17 2024 rev:47 rq:1172198 version:0.6.3
Changes:
--------
---
/work/SRC/openSUSE:Factory/obs-service-set_version/obs-service-set_version.changes
2024-01-18 21:52:15.342275197 +0100
+++
/work/SRC/openSUSE:Factory/.obs-service-set_version.new.1880/obs-service-set_version.changes
2024-05-07 18:02:25.756380934 +0200
@@ -1,0 +2,12 @@
+Mon May 06 14:28:11 UTC 2024 - [email protected]
+
+- Update to version 0.6.3:
+ * [dist] import spec file from O:S:U
+ * Mute warning about missing EMAIL env variable in unit tests
+ * Fix unit tests
+ * Replace invalid use of os.errno with errno module
+ * Replace @VERSION@ placeholders in .dsc files
+ * Remove usage of deprecated imp module with importlib
+ * Detect revision and set pkgrel for Arch packages
+
+-------------------------------------------------------------------
Old:
----
obs-service-set_version-0.6.2.tar.gz
New:
----
obs-service-set_version-0.6.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ obs-service-set_version.spec ++++++
--- /var/tmp/diff_new_pack.O8l3G7/_old 2024-05-07 18:02:26.264399406 +0200
+++ /var/tmp/diff_new_pack.O8l3G7/_new 2024-05-07 18:02:26.264399406 +0200
@@ -1,5 +1,5 @@
#
-# spec file
+# spec file for package obs-service-set_version
#
# Copyright (c) 2024 SUSE LLC
#
@@ -24,7 +24,7 @@
%define service set_version
Name: obs-service-%{service}
-Version: 0.6.2
+Version: 0.6.3
Release: 0
Summary: An OBS source service: Update spec file version
License: GPL-2.0-or-later
++++++ PKGBUILD ++++++
--- /var/tmp/diff_new_pack.O8l3G7/_old 2024-05-07 18:02:26.296400569 +0200
+++ /var/tmp/diff_new_pack.O8l3G7/_new 2024-05-07 18:02:26.304400860 +0200
@@ -1,5 +1,5 @@
pkgname=obs-service-set_version
-pkgver=0.6.2
+pkgver=0.6.3
pkgrel=0
pkgdesc="An OBS source service: Update spec file version"
arch=('i686' 'x86_64')
++++++ _service ++++++
--- /var/tmp/diff_new_pack.O8l3G7/_old 2024-05-07 18:02:26.324401588 +0200
+++ /var/tmp/diff_new_pack.O8l3G7/_new 2024-05-07 18:02:26.328401733 +0200
@@ -1,20 +1,20 @@
<services>
- <service mode="disabled" name="tar_scm">
+ <service mode="manual" name="tar_scm">
<param
name="url">https://github.com/openSUSE/obs-service-set_version.git</param>
<param name="scm">git</param>
<param name="exclude">.git</param>
- <param name="version">git-master</param>
+ <param name="version">master</param>
<param name="versionformat">@PARENT_TAG@</param>
<param name="revision">master</param>
<param name="changesgenerate">enable</param>
</service>
- <service mode="disabled" name="recompress">
+ <service mode="manual" name="recompress">
<param name="file">*.tar</param>
<param name="compression">gz</param>
</service>
- <service mode="disabled" name="set_version">
+ <service mode="manual" name="set_version">
<param name="basename">obs-service-set_version</param>
</service>
</services>
++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.O8l3G7/_old 2024-05-07 18:02:26.352402606 +0200
+++ /var/tmp/diff_new_pack.O8l3G7/_new 2024-05-07 18:02:26.356402751 +0200
@@ -4,6 +4,6 @@
<param
name="changesrevision">eaedc529acba421821e0e5dcb4956c66e7f315a9</param></service>
<service name="tar_scm">
<param
name="url">https://github.com/openSUSE/obs-service-set_version.git</param>
- <param
name="changesrevision">d4150d2cf2c80788efd5e9dff6bc4fd033c74a93</param></service></servicedata>
+ <param
name="changesrevision">fc93ee6169e660f158f0f36f87b69d555eccbd75</param></service></servicedata>
(No newline at EOF)
++++++ debian.dsc ++++++
--- /var/tmp/diff_new_pack.O8l3G7/_old 2024-05-07 18:02:26.376403478 +0200
+++ /var/tmp/diff_new_pack.O8l3G7/_new 2024-05-07 18:02:26.380403624 +0200
@@ -1,6 +1,6 @@
Format: 1.0
Source: obs-service-set_version
-Version: 0.6.1-0
+Version: 0.6.3-0
Binary: obs-service-set_version
Provides: obs-service-set_version
Maintainer: Dirk Mueller <[email protected]>
++++++ obs-service-set_version-0.6.2.tar.gz ->
obs-service-set_version-0.6.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-set_version-0.6.2/.github/workflows/main.yml
new/obs-service-set_version-0.6.3/.github/workflows/main.yml
--- old/obs-service-set_version-0.6.2/.github/workflows/main.yml
2023-01-18 13:24:22.000000000 +0100
+++ new/obs-service-set_version-0.6.3/.github/workflows/main.yml
2024-05-02 13:30:32.000000000 +0200
@@ -14,6 +14,9 @@
runs-on: ubuntu-latest
+ env:
+ EMAIL: "[email protected]"
+
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.10
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-set_version-0.6.2/dist/obs-service-set_version.spec
new/obs-service-set_version-0.6.3/dist/obs-service-set_version.spec
--- old/obs-service-set_version-0.6.2/dist/obs-service-set_version.spec
1970-01-01 01:00:00.000000000 +0100
+++ new/obs-service-set_version-0.6.3/dist/obs-service-set_version.spec
2024-05-02 13:30:32.000000000 +0200
@@ -0,0 +1,83 @@
+#
+# spec file for package obs-service-set_version
+#
+# Copyright (c) 2024 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/
+#
+
+
+%if 0%{?suse_version} >= 1500 || 0%{?fedora_version} >= 29 ||
0%{?centos_version} >= 800
+%bcond_without python3
+%else
+%bcond_with python3
+%endif
+%if %{with python3}
+%define use_python python3
+%else
+%define use_python python
+%endif
+
+%define service set_version
+
+Name: obs-service-%{service}
+Version: 0.5.12
+Release: 0
+Summary: An OBS source service: Update spec file version
+License: GPL-2.0-or-later
+Group: Development/Tools/Building
+URL: https://github.com/openSUSE/obs-service-%{service}
+Source: %{name}-%{version}.tar.gz
+BuildRequires: python3-ddt
+BuildRequires: python3-flake8
+BuildRequires: python3-packaging
+%if 0%{?suse_version}
+%if 0%{?suse_version} > 1315
+Recommends: python3-packaging
+Requires: python3-base
+%else
+Recommends: python-packaging
+%endif
+%endif
+Requires: sed
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+BuildArch: noarch
+
+%description
+This is a source service for openSUSE Build Service.
+
+Very simply script to update the version in .spec or .dsc files according to
+a given version or to the existing files.
+
+%prep
+%setup -q
+
+%build
+%if 0%{?suse_version} > 1315
+sed -i -e "1 s,#!/usr/bin/python$,#!/usr/bin/python3," set_version
+%endif
+
+%check
+make test PYTHON=python3
+
+%install
+mkdir -p %{buildroot}%{_prefix}/lib/obs/service
+install -m 0755 set_version %{buildroot}%{_prefix}/lib/obs/service
+install -m 0644 set_version.service %{buildroot}%{_prefix}/lib/obs/service
+perl -p -i -e 's{#!.*python.*}{#!%{_bindir}/%{use_python}}'
%{buildroot}%{_prefix}/lib/obs/service/set_version
+
+%files
+%defattr(-,root,root)
+%dir %{_prefix}/lib/obs
+%{_prefix}/lib/obs/service
+
+%changelog
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-set_version-0.6.2/set_version
new/obs-service-set_version-0.6.3/set_version
--- old/obs-service-set_version-0.6.2/set_version 2023-01-18
13:24:22.000000000 +0100
+++ new/obs-service-set_version-0.6.3/set_version 2024-05-02
13:30:32.000000000 +0200
@@ -16,6 +16,7 @@
import argparse
from contextlib import suppress
+import errno
import glob
import os
import re
@@ -126,7 +127,7 @@
if not os.path.exists(self.versionfile):
logging.debug(" - file: %s does not exist", self.versionfile)
- raise OSError(os.errno.ENOENT, os.strerror(os.errno.ENOENT),
+ raise OSError(errno.ENOENT, os.strerror(errno.ENOENT),
self.versionfile)
with codecs.open(self.versionfile, 'r', 'utf8') as fp:
@@ -221,6 +222,22 @@
return None
+class RevisionDetector(object):
+
+ def __init__(self):
+ pass
+
+ def autodetect(self):
+ return self._get_revision_from_osc_files()
+
+ @staticmethod
+ def _get_revision_from_osc_files():
+ from xml.etree import ElementTree
+ _filesname = os.path.join('.osc', '_files')
+ _filesXML = ElementTree.parse(_filesname)
+ return _filesXML.getroot().attrib['rev']
+
+
class PackageTypeDetector(object):
# pylint: disable=too-few-public-methods
@staticmethod
@@ -324,6 +341,19 @@
f.write(contents_new)
+def _replace_variable(filename, variable, string):
+ # cmake configure_file behavior, replace variables marked with @ sign
+ with codecs.open(filename, 'r+', 'utf8') as f:
+ contents = f.read()
+ f.seek(0)
+ contents_new, subs = re.subn(
+ r"@{variable}@".format(variable=variable),
+ string, contents, flags=re.MULTILINE)
+ if subs > 0:
+ f.truncate()
+ f.write(contents_new)
+
+
def _replace_debian_changelog_version(fname, version_new):
# first, modify a copy of filename and then move it
# get current version
@@ -379,6 +409,14 @@
return ver
+def _revision_detect(args):
+ revdetect = RevisionDetector()
+ revision = revdetect.autodetect()
+ logging.debug("Found revision '%s'", revision)
+
+ return revision
+
+
if __name__ == '__main__':
parser = argparse.ArgumentParser(
@@ -390,6 +428,9 @@
parser.add_argument('--version',
help='use given version string, do not detect it '
'from source files')
+ parser.add_argument('--revision',
+ help='use given revision string, do not detect it '
+ 'from obs files')
parser.add_argument('--basename', default="",
help='detect version based on the file name with '
'a given prefix')
@@ -406,6 +447,7 @@
args = vars(parser.parse_args())
version = args['version']
+ revision = args['revision']
outdir = args['outdir']
@@ -430,6 +472,17 @@
print("unable to detect the version")
sys.exit(-1)
+ if not revision:
+ try:
+ revision = _revision_detect(args)
+ except Exception as e:
+ print("Revision detection failed with error: \"", e, "\".")
+ revision = '0'
+
+ if not revision:
+ print("unable to detect the revision")
+ sys.exit(-1)
+
# if no files explicitly specified process whole directory
files = args['file'] or files_local
@@ -460,8 +513,12 @@
shutil.copyfile(f, filename)
if "-" in VersionDetector._get_version_via_debian_dsc(filename):
_replace_tag(filename, 'Version', version + "-0")
+ _replace_variable(filename, 'VERSION', version)
+ _replace_variable(filename, 'VERSION-RELEASE', version + "-0")
else:
_replace_tag(filename, 'Version', version)
+ _replace_variable(filename, 'VERSION', version)
+ _replace_variable(filename, 'VERSION-RELEASE', version)
for f in filter(lambda x: x.endswith(("debian.changelog")), files):
filename = outdir + "/" + f
@@ -486,4 +543,4 @@
_replace_tag(filename, "md5sums", "('SKIP')")
_replace_tag(filename, "sha256sums", "('SKIP')")
_replace_tag(filename, "pkgver", version)
- _replace_tag(filename, "pkgrel", "0")
+ _replace_tag(filename, "pkgrel", revision)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-set_version-0.6.2/tests/loader.py
new/obs-service-set_version-0.6.3/tests/loader.py
--- old/obs-service-set_version-0.6.2/tests/loader.py 1970-01-01
01:00:00.000000000 +0100
+++ new/obs-service-set_version-0.6.3/tests/loader.py 2024-05-02
13:30:32.000000000 +0200
@@ -0,0 +1,16 @@
+import importlib.machinery
+import importlib.util
+from pathlib import Path
+
+
+def import_set_version():
+ """Imports the set_version script as a python module and returns it."""
+ loader = importlib.machinery.SourceFileLoader(
+ 'set_version',
+ str(Path(__file__).parent.joinpath("..", "set_version"))
+ )
+ spec = importlib.util.spec_from_loader('set_version', loader)
+ sv = importlib.util.module_from_spec(spec)
+ loader.exec_module(sv)
+
+ return sv
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-set_version-0.6.2/tests/test_base.py
new/obs-service-set_version-0.6.3/tests/test_base.py
--- old/obs-service-set_version-0.6.2/tests/test_base.py 2023-01-18
13:24:22.000000000 +0100
+++ new/obs-service-set_version-0.6.3/tests/test_base.py 2024-05-02
13:30:32.000000000 +0200
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA.
-import imp
import os
import re
import shutil
@@ -25,15 +24,15 @@
import tempfile
import unittest
-
from ddt import data, ddt, unpack
+from loader import import_set_version
+
DEBUG = False
if os.environ.get('DEBUG_SET_VERSION') == "1":
DEBUG = True
-# NOTE(toabctl): Hack to import non-module file for testing
-sv = imp.load_source("set_version", "set_version")
+sv = import_set_version()
SET_VERSION_EXECUTABLE = os.path.abspath(
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-set_version-0.6.2/tests/test_package_type_detection.py
new/obs-service-set_version-0.6.3/tests/test_package_type_detection.py
--- old/obs-service-set_version-0.6.2/tests/test_package_type_detection.py
2023-01-18 13:24:22.000000000 +0100
+++ new/obs-service-set_version-0.6.3/tests/test_package_type_detection.py
2024-05-02 13:30:32.000000000 +0200
@@ -15,15 +15,13 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA.
-import imp
-
from ddt import data, ddt, unpack
from test_base import SetVersionBaseTest
+from tests.loader import import_set_version
-# NOTE(toabctl): Hack to import non-module file for testing
-sv = imp.load_source("set_version", "set_version")
+sv = import_set_version()
@ddt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-set_version-0.6.2/tests/test_python_pip2rpm.py
new/obs-service-set_version-0.6.3/tests/test_python_pip2rpm.py
--- old/obs-service-set_version-0.6.2/tests/test_python_pip2rpm.py
2023-01-18 13:24:22.000000000 +0100
+++ new/obs-service-set_version-0.6.3/tests/test_python_pip2rpm.py
2024-05-02 13:30:32.000000000 +0200
@@ -15,7 +15,6 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,USA.
-import imp
import os
import subprocess
import unittest
@@ -25,10 +24,10 @@
from packaging.version import parse
from test_base import SetVersionBaseTest
+from tests.loader import import_set_version
-# NOTE(toabctl): Hack to import non-module file for testing
-sv = imp.load_source("set_version", "set_version")
+sv = import_set_version()
def _has_zypper():
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-set_version-0.6.2/tests/test_rpmspec.py
new/obs-service-set_version-0.6.3/tests/test_rpmspec.py
--- old/obs-service-set_version-0.6.2/tests/test_rpmspec.py 2023-01-18
13:24:22.000000000 +0100
+++ new/obs-service-set_version-0.6.3/tests/test_rpmspec.py 2024-05-02
13:30:32.000000000 +0200
@@ -16,13 +16,13 @@
import os
-import imp
import shutil
from ddt import data, ddt, file_data, unpack
from test_base import SetVersionBaseTest
+from tests.loader import import_set_version
-sv = imp.load_source("set_version", "set_version")
+sv = import_set_version()
@ddt