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 2021-07-18 23:44:59
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/obs-service-set_version (Old)
and /work/SRC/openSUSE:Factory/.obs-service-set_version.new.2632 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "obs-service-set_version"
Sun Jul 18 23:44:59 2021 rev:40 rq:906285 version:0.5.14
Changes:
--------
---
/work/SRC/openSUSE:Factory/obs-service-set_version/obs-service-set_version.changes
2021-02-11 12:46:21.077398366 +0100
+++
/work/SRC/openSUSE:Factory/.obs-service-set_version.new.2632/obs-service-set_version.changes
2021-07-18 23:45:12.570925881 +0200
@@ -1,0 +2,9 @@
+Wed Jul 14 09:32:33 UTC 2021 - [email protected]
+
+- Update to version 0.5.14:
+ * changed debugging output to logging module
+ * Explicitely specifying --fromfile should win over .obsinfo
+ * Add new switch --fromfile
+ * Add zst to recognized suffixes (zstd support)
+
+-------------------------------------------------------------------
Old:
----
obs-service-set_version-0.5.13.tar.gz
New:
----
obs-service-set_version-0.5.14.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ obs-service-set_version.spec ++++++
--- /var/tmp/diff_new_pack.TmwEtl/_old 2021-07-18 23:45:13.002922559 +0200
+++ /var/tmp/diff_new_pack.TmwEtl/_new 2021-07-18 23:45:13.006922527 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package obs-service-set_version
+# spec file
#
# Copyright (c) 2021 SUSE LLC
#
@@ -23,14 +23,14 @@
%endif
%define service set_version
-%if 0%{?suse_version} > 1315 || 0%{?fedora_version} || 0%{?centos_version}
>= 800
+%if 0%{?suse_version} > 1315 || 0%{?fedora_version} || 0%{?centos_version}
>= 800 || 0%{?almalinux} >= 8
%define use_python python3
%else
%define use_python python
%endif
Name: obs-service-%{service}
-Version: 0.5.13
+Version: 0.5.14
Release: 0
Summary: An OBS source service: Update spec file version
License: GPL-2.0-or-later
++++++ PKGBUILD ++++++
--- /var/tmp/diff_new_pack.TmwEtl/_old 2021-07-18 23:45:13.034922313 +0200
+++ /var/tmp/diff_new_pack.TmwEtl/_new 2021-07-18 23:45:13.034922313 +0200
@@ -1,5 +1,5 @@
pkgname=obs-service-set_version
-pkgver=0.5.13
+pkgver=0.5.14
pkgrel=0
pkgdesc="An OBS source service: Update spec file version"
arch=('i686' 'x86_64')
++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.TmwEtl/_old 2021-07-18 23:45:13.066922066 +0200
+++ /var/tmp/diff_new_pack.TmwEtl/_new 2021-07-18 23:45:13.066922066 +0200
@@ -4,4 +4,4 @@
<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">dd24a0ed641d06a023607430be967e356f97d931</param></service></servicedata>
\ No newline at end of file
+ <param
name="changesrevision">854fd2773fc0683c64a42c7ea42c4c743f3dd57f</param></service></servicedata>
\ No newline at end of file
++++++ debian.dsc ++++++
--- /var/tmp/diff_new_pack.TmwEtl/_old 2021-07-18 23:45:13.086921912 +0200
+++ /var/tmp/diff_new_pack.TmwEtl/_new 2021-07-18 23:45:13.086921912 +0200
@@ -1,6 +1,6 @@
Format: 1.0
Source: obs-service-set_version
-Version: 0.5.13-0
+Version: 0.5.14-0
Binary: obs-service-set_version
Provides: obs-service-set_version
Maintainer: Adrian Schroeter <[email protected]>
++++++ obs-service-set_version-0.5.13.tar.gz ->
obs-service-set_version-0.5.14.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/obs-service-set_version-0.5.13/.github/workflows/main.yml
new/obs-service-set_version-0.5.14/.github/workflows/main.yml
--- old/obs-service-set_version-0.5.13/.github/workflows/main.yml
1970-01-01 01:00:00.000000000 +0100
+++ new/obs-service-set_version-0.5.14/.github/workflows/main.yml
2021-07-14 11:26:12.000000000 +0200
@@ -0,0 +1,32 @@
+# This workflow will install Python dependencies, run tests and lint with a
single version of Python
+# For more information see:
https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
+
+name: Testing
+
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Set up Python 3.9
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.9
+ - name: Install required deb packages
+ run: sudo apt-get install zypper devscripts
+ - name: Install python dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install flake8 pytest
+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
+ - name: Test with pytest
+ run: |
+ make test
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-set_version-0.5.13/.gitignore
new/obs-service-set_version-0.5.14/.gitignore
--- old/obs-service-set_version-0.5.13/.gitignore 1970-01-01
01:00:00.000000000 +0100
+++ new/obs-service-set_version-0.5.14/.gitignore 2021-07-14
11:26:12.000000000 +0200
@@ -0,0 +1,5 @@
+*.pyc
+*.pyo
+*.sw?
+set_versionc
+tests/test_newline/
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-set_version-0.5.13/requirements.txt
new/obs-service-set_version-0.5.14/requirements.txt
--- old/obs-service-set_version-0.5.13/requirements.txt 1970-01-01
01:00:00.000000000 +0100
+++ new/obs-service-set_version-0.5.14/requirements.txt 2021-07-14
11:26:12.000000000 +0200
@@ -0,0 +1 @@
+ddt
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-set_version-0.5.13/set_version
new/obs-service-set_version-0.5.14/set_version
--- old/obs-service-set_version-0.5.13/set_version 2020-09-14
09:13:14.000000000 +0200
+++ new/obs-service-set_version-0.5.14/set_version 2021-07-14
11:26:12.000000000 +0200
@@ -23,6 +23,7 @@
import tarfile
import zipfile
import codecs
+import logging
try:
from packaging.version import LegacyVersion, Version, parse
@@ -35,14 +36,12 @@
HAS_PACKAGING = True
-DEBUG = False
-
if os.environ.get('DEBUG_SET_VERSION') == "1":
- DEBUG = True
+ logging.getLogger().setLevel(logging.DEBUG)
outdir = None
suffixes = ('.obscpio', '.tar', '.tar.gz', '.tgz', '.tar.bz2', '.tbz2',
- '.tar.xz', '.zip')
+ '.tar.xz', '.tar.zst', '.zip')
suffixes_re = "|".join(map(lambda x: re.escape(x), suffixes))
@@ -55,48 +54,44 @@
class VersionDetector(object):
- def __init__(self, regex=None, file_list=(), basename=''):
+ def __init__(self, regex=None, file_list=(), basename='',
+ versionfile=None):
self.regex = regex
self.file_list = file_list
self.basename = basename
+ self.versionfile = versionfile
def autodetect(self):
- if DEBUG:
- print("Starting version autodetect")
-
- if DEBUG:
- print("-- Starting version detection via obsinfo")
- version = self._get_version_via_obsinfo()
+ logging.debug("Starting version autodetect")
+ logging.debug("-- Starting version detection via specified file")
+ version = self._get_version_via_versionfile()
+ if not version:
+ logging.debug("--- Could not find version via specified file")
+ logging.debug("-- Starting version detection via obsinfo")
+ version = self._get_version_via_obsinfo()
if not version:
- if DEBUG:
- print("--- Could not find version via obsinfo")
- print("-- Starting version detection via archive dirname")
+ logging.debug("--- Could not find version via obsinfo")
+ logging.debug("-- Starting version detection via archive dirname")
version = self._get_version_via_archive_dirname()
if not version:
- if DEBUG:
- print("--- Could not find version via archive dirname")
- print("-- Starting version detection via filename")
+ logging.debug("--- Could not find version via archive dirname")
+ logging.debug("-- Starting version detection via filename")
version = self._get_version_via_filename()
if not version:
- if DEBUG:
- print("--- Could not find version via filename")
- print("-- Starting version detection via debian changelog")
+ logging.debug("--- Could not find version via filename")
+ logging.debug("-- Starting version detection via debian changelog")
version = self.get_version_via_debian_changelog("debian.changelog")
if not version:
- if DEBUG:
- print("--- Could not find version via debian changelog")
+ logging.debug("--- Could not find version via debian changelog")
return version
def _get_version_via_filename(self):
""" detect version based on file names"""
- if DEBUG:
- print("detecting version via files")
+ logging.debug("detecting version via files")
for f in self.file_list:
- if DEBUG:
- print(" - checking file ", f)
+ logging.debug(" - checking file %s", f)
if self.regex:
- if DEBUG:
- print(" - using regex: ", self.regex)
+ logging.debug(" - using regex: %r", self.regex)
regex = self.regex
else:
regex = r"^%s.*[-_]([\d].*)(?:%s)$" % (
@@ -108,6 +103,35 @@
# Nothing found
return None
+ def _get_version_via_versionfile(self):
+ """ detect version based on custom file contents"""
+ logging.debug("detecting version via custom file")
+
+ if not self.versionfile:
+ logging.debug("Custom file name not set")
+ return None
+
+ logging.debug(" - checking file '%s'", self.versionfile)
+
+ if self.regex:
+ regex = self.regex
+ else:
+ regex = r"^[Vv]ersion:\s+([\d].*)(?:)\s?$"
+
+ logging.debug(" - using regex: %r", regex)
+
+ 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),
+ self.versionfile)
+
+ with codecs.open(self.versionfile, 'r', 'utf8') as fp:
+ for line in fp:
+ m = re.match(regex, line)
+ if m:
+ return m.group(1)
+ return None
+
def __get_version(self, str_list):
if self.regex:
regex = self.regex
@@ -124,11 +148,9 @@
def _get_version_via_archive_dirname(self):
""" detect version based tar'd directory name"""
for f in filter(lambda x: x.endswith(suffixes), self.file_list):
- if DEBUG:
- print("Checking path: '%s'." % f)
+ logging.debug("Checking path: '%s'.", f)
if not os.path.isfile(f):
- if DEBUG:
- print("Skipping path: '%s' is not a regular file." % f)
+ logging.debug("Skipping path: '%s' is not a regular file.", f)
continue
# handle tarfiles
if tarfile.is_tarfile(f):
@@ -211,8 +233,7 @@
def _is_python(f):
names = []
if not os.path.isfile(f):
- if DEBUG:
- print("Skipping path: '%s' is not a regular file." % f)
+ logging.debug("Skipping path: '%s' is not a regular file.", f)
return False
if tarfile.is_tarfile(f):
with tarfile.open(f) as tf:
@@ -338,10 +359,10 @@
def _version_detect(args, files_local):
- vdetect = VersionDetector(args['regex'], files_local, args["basename"])
+ vdetect = VersionDetector(args['regex'], files_local, args["basename"],
+ args["fromfile"])
ver = vdetect.autodetect()
- if DEBUG:
- print("Found version '%s'" % ver)
+ logging.debug("Found version '%s'", ver)
return ver
@@ -367,6 +388,9 @@
help='Enable more verbose output.')
parser.add_argument('--regex',
help='regex to be used by autodetect')
+ parser.add_argument('--fromfile',
+ help='detect version based on the '
+ 'file contents and regex')
args = vars(parser.parse_args())
version = args['version']
@@ -378,13 +402,17 @@
sys.exit(-1)
if args['debug']:
- print("Running in debug mode")
- DEBUG = True
+ logging.getLogger().setLevel(logging.DEBUG)
+ logging.debug("Running in debug mode")
files_local = _get_local_files()
if not version:
- version = _version_detect(args, files_local)
+ try:
+ version = _version_detect(args, files_local)
+ except Exception as e:
+ print("Detection failed with error: \"", e, "\".")
+ sys.exit(-1)
if not version:
print("unable to detect the version")
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-set_version-0.5.13/set_version.service
new/obs-service-set_version-0.5.14/set_version.service
--- old/obs-service-set_version-0.5.13/set_version.service 2020-09-14
09:13:14.000000000 +0200
+++ new/obs-service-set_version-0.5.14/set_version.service 2021-07-14
11:26:12.000000000 +0200
@@ -12,6 +12,9 @@
<parameter name="file">
<description>Update only the given file.</description>
</parameter>
+ <parameter name="fromfile">
+ <description>Try to detect version from the contents of the given
file.</description>
+ </parameter>
<parameter name="regex">
<description>This regex can be used to autodetect the version from the
source dir
inside the source file or the source file directly.</description>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/obs-service-set_version-0.5.13/tests/test_base.py
new/obs-service-set_version-0.5.14/tests/test_base.py
--- old/obs-service-set_version-0.5.13/tests/test_base.py 2020-09-14
09:13:14.000000000 +0200
+++ new/obs-service-set_version-0.5.14/tests/test_base.py 2021-07-14
11:26:12.000000000 +0200
@@ -264,11 +264,11 @@
files_local = ['test-v1.2.3.tar']
# checking dirname in archive detection
- args = {'regex': '^test-v(.*)', 'basename': ''}
+ args = {'regex': '^test-v(.*)', 'basename': '', 'fromfile': None}
ver = sv._version_detect(args, files_local)
self.assertEqual(ver, '1.2.3')
# checking archive filename detection
- args = {'regex': '^test-v(.*).tar', 'basename': ''}
+ args = {'regex': '^test-v(.*).tar', 'basename': '', 'fromfile': None}
ver = sv._version_detect(args, files_local)
self.assertEqual(ver, '1.2.3')