Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package obs-service-tar_scm for openSUSE:Factory checked in at 2022-09-17 20:10:06 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/obs-service-tar_scm (Old) and /work/SRC/openSUSE:Factory/.obs-service-tar_scm.new.2083 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "obs-service-tar_scm" Sat Sep 17 20:10:06 2022 rev:72 rq:1004076 version:0.10.32.1662712308.31d1884 Changes: -------- --- /work/SRC/openSUSE:Factory/obs-service-tar_scm/obs-service-tar_scm.changes 2022-01-14 23:13:23.302637505 +0100 +++ /work/SRC/openSUSE:Factory/.obs-service-tar_scm.new.2083/obs-service-tar_scm.changes 2022-09-17 20:10:08.149121528 +0200 @@ -1,0 +2,29 @@ +Fri Sep 09 09:09:06 UTC 2022 - fschrei...@suse.com + +- Update to version 0.10.32.1662712308.31d1884: + * [dist] added Requires to python_path + * improve tar service to handle multiple obsinfo files to create tarball from obscpio + * new ENV 'TAR_SCM_SKIP_CLEANUP' to make test development/debugging easier + * staple pylint version lower than 2.14 because of breaking changes in config + * do not use python mock + * fix pylint errors in commontests.py + * Fixed testing + * use extra cache dir for partial clone + * fix cache update in case of partial clone + * disable partial clone when subdir is set + * do not set default subdir to '.' + * fixes to pass pylint + * enable partial clone feature in git scm + * partial clone feature + * simplify locking to avoid race conditions + * TarSCM.cli: set some defaults to make usage in testing easier + * unlink .lock file after unlocking the cache + +------------------------------------------------------------------- +Thu Jan 13 11:33:51 UTC 2022 - fschrei...@suse.com + +- Update to version 0.10.30.1641993356.a87e7af: + * Simplifiy conditions for all rhel like distros + * Changed gendered pronoun to be gender neutral + +------------------------------------------------------------------- Old: ---- obs-service-tar_scm-0.10.30.1641990734.bdad8f9.tar.gz New: ---- obs-service-tar_scm-0.10.32.1662712308.31d1884.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ obs-service-tar_scm.spec ++++++ --- /var/tmp/diff_new_pack.AZXe3A/_old 2022-09-17 20:10:08.717123167 +0200 +++ /var/tmp/diff_new_pack.AZXe3A/_new 2022-09-17 20:10:08.721123179 +0200 @@ -16,7 +16,7 @@ # -%if 0%{?fedora_version}%{?centos_version}%{?rhel_version}%{?almalinux} +%if 0%{?fedora_version}%{?rhel} %define _pkg_base %nil %else %define _pkg_base -base @@ -40,7 +40,7 @@ ExclusiveArch: skip-build %endif -%if 0%{?suse_version} >= 1315 || 0%{?fedora_version} >= 29 || 0%{?centos_version} >= 800 || 0%{?rhel_version} >= 800 || 0%{?almalinux} >= 8 +%if 0%{?suse_version} >= 1315 || 0%{?fedora_version} >= 29 || 0%{?rhel} >= 8 %bcond_without python3 %else %bcond_with python3 @@ -71,14 +71,14 @@ %endif %endif -%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?scientificlinux_version} || 0%{?almalinux} -%if 0%{?fedora_version} >= 29 || 0%{?rhel_version} >= 800 || 0%{?centos_version} >= 800 || 0%{?almalinux} >= 8 +%if 0%{?fedora_version} || 0%{?rhel} +%if 0%{?fedora_version} >= 29 || 0%{?rhel} >= 8 %define pyyaml_package %{use_python}-PyYAML %else %define pyyaml_package PyYAML %endif -%if 0%{?fedora_version} >= 24 || 0%{?rhel_version} >= 800 || 0%{?centos_version} >= 800 || 0%{?almalinux} >= 8 +%if 0%{?fedora_version} >= 24 || 0%{?rhel} >= 8 %define locale_package glibc-langpack-en %else %define locale_package glibc-common @@ -92,7 +92,7 @@ # Mageia 8 has package names python-* # but requires python3 in shebang -%if 0%{?mageia} >= 8 || 0%{?centos_version} >= 800 || 0%{?rhel_version} >= 800 || 0%{?almalinux} >= 8 +%if 0%{?mageia} >= 8 || 0%{?rhel} >= 8 %define python_path %{_bindir}/python3 %else %define python_path %{_bindir}/%{use_python} @@ -119,8 +119,8 @@ %define pkg_name obs-service-tar_scm Name: %{pkg_name}%{nsuffix} -%define version_unconverted 0.10.30.1641990734.bdad8f9 -Version: 0.10.30.1641990734.bdad8f9 +%define version_unconverted 0.10.32.1662712308.31d1884 +Version: 0.10.32.1662712308.31d1884 Release: 0 Summary: An OBS source service: create tar ball from svn/git/hg License: GPL-2.0-or-later @@ -137,13 +137,15 @@ BuildRequires: %{pkg_name} = %{version} BuildRequires: %{use_python}-keyring BuildRequires: %{use_python}-keyrings.alt -BuildRequires: %{use_python}-mock BuildRequires: %{use_python}-six BuildRequires: %{use_python}-unittest2 BuildRequires: bzr BuildRequires: git-core BuildRequires: mercurial BuildRequires: subversion +%if !%{with python3} +BuildRequires: %{use_python}-mock +%endif %endif BuildRequires: %{locale_package} @@ -169,6 +171,7 @@ # BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch +Requires: %{python_path} %description This is a source service for openSUSE Build Service. ++++++ PKGBUILD ++++++ --- /var/tmp/diff_new_pack.AZXe3A/_old 2022-09-17 20:10:08.777123340 +0200 +++ /var/tmp/diff_new_pack.AZXe3A/_new 2022-09-17 20:10:08.781123352 +0200 @@ -1,5 +1,5 @@ pkgname=obs-service-tar_scm -pkgver=0.10.30.1641990734.bdad8f9 +pkgver=0.10.32.1662712308.31d1884 pkgrel=0 pkgdesc="Source Service for the OpenSUSE Build Service (OBS)" arch=('any') ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.AZXe3A/_old 2022-09-17 20:10:08.837123513 +0200 +++ /var/tmp/diff_new_pack.AZXe3A/_new 2022-09-17 20:10:08.845123536 +0200 @@ -9,6 +9,6 @@ <param name="url">git://github.com/openSUSE/obs-service-tar_scm.git</param> <param name="changesrevision">85bfc3fabb06212b49a389afb3310bfbf2996913</param></service><service name="tar_scm"> <param name="url">https://github.com/openSUSE/obs-service-tar_scm.git</param> - <param name="changesrevision">bdad8f941c0455ea30970aaee53b9e47ba26c93c</param></service></servicedata> + <param name="changesrevision">31d1884bdda3cff616826e8780c37389a791b21d</param></service></servicedata> (No newline at EOF) ++++++ debian.dsc ++++++ --- /var/tmp/diff_new_pack.AZXe3A/_old 2022-09-17 20:10:08.885123652 +0200 +++ /var/tmp/diff_new_pack.AZXe3A/_new 2022-09-17 20:10:08.889123663 +0200 @@ -1,6 +1,6 @@ Format: 1.0 Source: obs-service-tar-scm -Version: 0.10.30.1641990734.bdad8f9 +Version: 0.10.32.1662712308.31d1884 Provides: obs-service-obs_scm, obs-service-tar Binary: obs-service-tar_scm Maintainer: Adrian Schroeter <adr...@suse.de> ++++++ obs-service-tar_scm-0.10.30.1641990734.bdad8f9.tar.gz -> obs-service-tar_scm-0.10.32.1662712308.31d1884.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/.pylintrc new/obs-service-tar_scm-0.10.32.1662712308.31d1884/.pylintrc --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/.pylintrc 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/.pylintrc 2022-09-09 10:31:48.000000000 +0200 @@ -84,7 +84,7 @@ # a feature request to improve pylint in this respect: # https://github.com/PyCQA/pylint/issues/246 -disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,missing-docstring,old-style-class,bad-whitespace,consider-using-with,consider-using-f-string +disable=import-star-module-level,old-octal-literal,oct-method,print-statement,unpacking-in-except,parameter-unpacking,backtick,old-raise-syntax,old-ne-operator,long-suffix,dict-view-method,dict-iter-method,metaclass-assignment,next-method-called,raising-string,indexing-exception,raw_input-builtin,long-builtin,file-builtin,execfile-builtin,coerce-builtin,cmp-builtin,buffer-builtin,basestring-builtin,apply-builtin,filter-builtin-not-iterating,using-cmp-argument,useless-suppression,range-builtin-not-iterating,suppressed-message,no-absolute-import,old-division,cmp-method,reload-builtin,zip-builtin-not-iterating,intern-builtin,unichr-builtin,reduce-builtin,standarderror-builtin,unicode-builtin,xrange-builtin,coerce-method,delslice-method,getslice-method,setslice-method,input-builtin,round-builtin,hex-method,nonzero-method,map-builtin-not-iterating,missing-docstring,old-style-class,bad-whitespace,consider-using-with,consider-using-f-string,duplicate-code [REPORTS] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/KankuFile new/obs-service-tar_scm-0.10.32.1662712308.31d1884/KankuFile --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/KankuFile 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/KankuFile 2022-09-09 10:31:48.000000000 +0200 @@ -48,7 +48,7 @@ commands: - zypper -n in git bzr mercurial subversion make tar - zypper -n in python2-PyYAML python2-python-dateutil python2-mock python2-pylint python2-flake8 - - zypper -n in python3-PyYAML python3-python-dateutil python3-mock python3-pylint python3-flake8 + - zypper -n in python3-PyYAML python3-python-dateutil python3-pylint python3-flake8 - use_module: Kanku::Handler::ExecuteCommandViaSSH options: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/cli.py new/obs-service-tar_scm-0.10.32.1662712308.31d1884/TarSCM/cli.py --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/cli.py 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/TarSCM/cli.py 2022-09-09 10:31:48.000000000 +0200 @@ -44,6 +44,7 @@ class Cli(): # pylint: disable=too-few-public-methods + # pylint: disable=too-many-instance-attributes DEFAULT_AUTHOR = 'obs-service-tar-scm@invalid' outdir = None @@ -51,6 +52,12 @@ self.use_obs_scm = False self.snapcraft = False self.appimage = False + self.maintainers_asc = None + self.url = None + self.revision = None + self.user = None + self.keyring_passphrase = None + self.changesgenerate = False def parse_args(self, options): parser = argparse.ArgumentParser(description='Git Tarballs') @@ -198,7 +205,8 @@ args.outdir = os.path.abspath(args.outdir) orig_subdir = args.subdir - args.subdir = os.path.normpath(orig_subdir) + if orig_subdir: + args.subdir = os.path.normpath(orig_subdir) if args.subdir.startswith('/'): sys.exit("Absolute path '%s' is not allowed for --subdir" % orig_subdir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/scm/base.py new/obs-service-tar_scm-0.10.32.1662712308.31d1884/TarSCM/scm/base.py --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/scm/base.py 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/TarSCM/scm/base.py 2022-09-09 10:31:48.000000000 +0200 @@ -5,7 +5,6 @@ import re import hashlib import shutil -import fcntl import time import subprocess import glob @@ -30,6 +29,7 @@ class Scm(): scm = None + partial_clone = False def __init__(self, args, task): # default settings @@ -293,6 +293,13 @@ osc_version = 0 + logging.debug(" - SUBDIR: %s", self.args.subdir) + if not self.args.subdir and self.scm == 'git': + self.partial_clone = True + logging.debug("NO SUBDIR FOUND - USING PARTIAL CLONE") + if self.repocachedir: + self.repocachedir = self.repocachedir + '-pc' + try: osc_version = os.environ['OSC_VERSION'] except: @@ -368,13 +375,23 @@ def lock_cache(self): pdir = os.path.join(self.clone_dir, os.pardir, '.lock') - self.lock_file = open(os.path.abspath(pdir), 'w') - fcntl.lockf(self.lock_file, fcntl.LOCK_EX) + while True: + if os.path.isfile(pdir): + time.sleep(0.1) + else: + logging.debug("Using lockfile: %s", pdir) + self.lock_file = open(os.path.abspath(pdir), 'w') + break def unlock_cache(self): if self.lock_file and os.path.isfile(self.lock_file.name): - fcntl.lockf(self.lock_file, fcntl.LOCK_UN) - self.lock_file.close() + logging.debug("Unlocking cache: %s", self.lock_file.name) + try: + self.lock_file.close() + os.unlink(self.lock_file.name) + except: + pass + self.lock_file = None def finalize(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/scm/bzr.py new/obs-service-tar_scm-0.10.32.1662712308.31d1884/TarSCM/scm/bzr.py --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/scm/bzr.py 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/TarSCM/scm/bzr.py 2022-09-09 10:31:48.000000000 +0200 @@ -28,10 +28,12 @@ def update_cache(self): """Update sources via bzr.""" + # pylint: disable=duplicate-code command = self._get_scm_cmd() + ['update'] if self.revision: command.insert(3, '-r') command.insert(4, self.revision) + self.helpers.safe_run( command, cwd=self.clone_dir, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/scm/git.py new/obs-service-tar_scm-0.10.32.1662712308.31d1884/TarSCM/scm/git.py --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/scm/git.py 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/TarSCM/scm/git.py 2022-09-09 10:31:48.000000000 +0200 @@ -22,6 +22,7 @@ class Git(Scm): scm = 'git' _stash_pop_required = False + partial_clone = False def _get_scm_cmd(self): """Compose a GIT-specific command line using http proxies""" @@ -129,11 +130,15 @@ def fetch_upstream_scm(self): """SCM specific version of fetch_uptream for git.""" self.auth_url() + # clone if no .git dir exists - command = self._get_scm_cmd() + ['clone', self.url, self.clone_dir] + command = self._get_scm_cmd() + ['clone', + self.url, self.clone_dir] + if self.partial_clone: + command.insert(-2, '--filter=tree:0') if not self.is_sslverify_enabled(): command += ['--config', 'http.sslverify=false'] - if self.repocachedir: + if self.repocachedir and not self.partial_clone: command.insert(command.index('clone') + 1, '--mirror') wdir = os.path.abspath(os.path.join(self.repodir, os.pardir)) try: @@ -142,6 +147,22 @@ except SystemExit as exc: os.removedirs(os.path.join(wdir, self.clone_dir)) raise exc + if self.partial_clone: + config_command = self._get_scm_cmd() + ['config', '--local', + 'extensions.partialClone', + 'origin'] + self.helpers.safe_run( + config_command, cwd=self.clone_dir, + interactive=sys.stdout.isatty()) + + argsd = self.args.__dict__ + if 'submodules' not in argsd: + cfg_cmd = self._get_scm_cmd() + ['config', '--local', + 'fetch.recurseSubmodules', + 'false'] + self.helpers.safe_run( + cfg_cmd, cwd=self.clone_dir, + interactive=sys.stdout.isatty()) if self.revision == "@PARENT_TAG@": self.revision = self._detect_parent_tag() @@ -160,10 +181,13 @@ def fetch_specific_revision(self): if self.revision and not self._ref_exists(self.revision): + rev = self.revision + ':' + self.revision + command = self._get_scm_cmd() + ['fetch', self.url, rev] + if self.partial_clone: + command.insert(-2, '--filter=tree:0') # fetch reference from url and create locally self.helpers.safe_run( - self._get_scm_cmd() + ['fetch', self.url, - self.revision + ':' + self.revision], + command, cwd=self.clone_dir, interactive=sys.stdout.isatty() ) @@ -208,13 +232,22 @@ interactive=sys.stdout.isatty() ) + command = self._get_scm_cmd() + ['fetch', '--tags'] + if self.partial_clone: + command.insert(-1, '--filter=tree:0') + self.helpers.safe_run( - self._get_scm_cmd() + ['fetch', '--tags'], + command, cwd=self.clone_dir, interactive=sys.stdout.isatty() ) + + command = self._get_scm_cmd() + ['fetch'] + if self.partial_clone: + command.append('--filter=tree:0') + self.helpers.safe_run( - self._get_scm_cmd() + ['fetch'], + command, cwd=self.clone_dir, interactive=sys.stdout.isatty() ) @@ -380,8 +413,12 @@ # between multiple services org_clone_dir = self.clone_dir self.clone_dir = self.repodir - command = self._get_scm_cmd() + ['clone', '--no-checkout'] + command = self._get_scm_cmd() + ['clone', + '--no-checkout'] + if self.partial_clone: + command.insert(-1, '--filter=tree:0') use_reference = True + try: if self.args.package_meta: logging.info("Not using '--reference'") @@ -397,6 +434,22 @@ wdir = os.path.abspath(os.path.join(self.clone_dir, os.pardir)) self.helpers.safe_run( command, cwd=wdir, interactive=sys.stdout.isatty()) + if self.partial_clone: + config_command = self._get_scm_cmd() + ['config', '--local', + 'extensions.partialClone', + 'origin'] + + self.helpers.safe_run( + config_command, cwd=self.clone_dir, + interactive=sys.stdout.isatty()) + argsd = self.args.__dict__ + if 'submodules' not in argsd: + cfg_cmd = self._get_scm_cmd() + ['config', '--local', + 'fetch.recurseSubmodules', + 'false'] + self.helpers.safe_run( + cfg_cmd, cwd=self.clone_dir, + interactive=sys.stdout.isatty()) if self.revision == "@PARENT_TAG@": self.revision = self._detect_parent_tag() @@ -407,7 +460,10 @@ if self.revision and not self._ref_exists(self.revision): refspec = self.revision + ":" + self.revision - cmd = self._get_scm_cmd() + ['fetch', 'origin', refspec] + if self.partial_clone: + command.insert(-3, '--filter=tree:0') + cmd = self._get_scm_cmd() + ['fetch', 'origin', + refspec] self.helpers.safe_run( cmd, cwd=self.clone_dir, interactive=sys.stdout.isatty()) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/tasks.py new/obs-service-tar_scm-0.10.32.1662712308.31d1884/TarSCM/tasks.py --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/TarSCM/tasks.py 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/TarSCM/tasks.py 2022-09-09 10:31:48.000000000 +0200 @@ -24,6 +24,7 @@ class Tasks(): + # pylint: disable=too-many-branches ''' Class to create a task list for formats which can contain more then one scm job like snapcraft or appimage @@ -107,6 +108,18 @@ del self.data_map['parts'][part]['source-type'] self.task_list.append(copy.copy(args)) + # only try to autodetect obsinfo files if no obsinfo file is given + # as cli parameter + elif args.scm == 'tar' and args.obsinfo is None: + # use all obsinfo files in cwd if none are given + files = glob.glob('*.obsinfo') + if files: + for obsinfo in files: + args.obsinfo = obsinfo + self.task_list.append(copy.copy(args)) + else: + # Fallback if there are no obsinfo files + self.task_list.append(args) else: self.task_list.append(args) @@ -125,7 +138,7 @@ if args.snapcraft: # write the new snapcraft.yaml file # we prefix our own here to be sure to not overwrite user files, - # if he is using us in "disabled" mode + # if they are using it in "disabled" mode new_file = args.outdir + '/_service:snapcraft:snapcraft.yaml' yml_str = yaml.dump(self.data_map, default_flow_style=False) file_write_legacy(new_file, yml_str) @@ -169,6 +182,7 @@ ''' do the work for a single task ''' + self.args = self.check_for_branch_request() logging.basicConfig(format="%(message)s", stream=sys.stderr, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/dist/obs-service-tar_scm.spec new/obs-service-tar_scm-0.10.32.1662712308.31d1884/dist/obs-service-tar_scm.spec --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/dist/obs-service-tar_scm.spec 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/dist/obs-service-tar_scm.spec 2022-09-09 10:31:48.000000000 +0200 @@ -16,7 +16,7 @@ # -%if 0%{?fedora_version}%{?centos_version}%{?rhel_version}%{?almalinux} +%if 0%{?fedora_version}%{?rhel} %define _pkg_base %nil %else %define _pkg_base -base @@ -40,7 +40,7 @@ ExclusiveArch: skip-build %endif -%if 0%{?suse_version} >= 1315 || 0%{?fedora_version} >= 29 || 0%{?centos_version} >= 800 || 0%{?rhel_version} >= 800 || 0%{?almalinux} >= 8 +%if 0%{?suse_version} >= 1315 || 0%{?fedora_version} >= 29 || 0%{?rhel} >= 8 %bcond_without python3 %else %bcond_with python3 @@ -71,14 +71,14 @@ %endif %endif -%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?scientificlinux_version} || 0%{?almalinux} -%if 0%{?fedora_version} >= 29 || 0%{?rhel_version} >= 800 || 0%{?centos_version} >= 800 || 0%{?almalinux} >= 8 +%if 0%{?fedora_version} || 0%{?rhel} +%if 0%{?fedora_version} >= 29 || 0%{?rhel} >= 8 %define pyyaml_package %{use_python}-PyYAML %else %define pyyaml_package PyYAML %endif -%if 0%{?fedora_version} >= 24 || 0%{?rhel_version} >= 800 || 0%{?centos_version} >= 800 || 0%{?almalinux} >= 8 +%if 0%{?fedora_version} >= 24 || 0%{?rhel} >= 8 %define locale_package glibc-langpack-en %else %define locale_package glibc-common @@ -92,7 +92,7 @@ # Mageia 8 has package names python-* # but requires python3 in shebang -%if 0%{?mageia} >= 8 || 0%{?centos_version} >= 800 || 0%{?rhel_version} >= 800 || 0%{?almalinux} >= 8 +%if 0%{?mageia} >= 8 || 0%{?rhel} >= 8 %define python_path %{_bindir}/python3 %else %define python_path %{_bindir}/%{use_python} @@ -137,13 +137,15 @@ BuildRequires: %{pkg_name} = %{version} BuildRequires: %{use_python}-keyring BuildRequires: %{use_python}-keyrings.alt -BuildRequires: %{use_python}-mock BuildRequires: %{use_python}-six BuildRequires: %{use_python}-unittest2 BuildRequires: bzr BuildRequires: git-core BuildRequires: mercurial BuildRequires: subversion +%if !%{with python3} +BuildRequires: %{use_python}-mock +%endif %endif BuildRequires: %{locale_package} @@ -169,6 +171,7 @@ # BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch +Requires: %{python_path} %description This is a source service for openSUSE Build Service. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/requirements.txt new/obs-service-tar_scm-0.10.32.1662712308.31d1884/requirements.txt --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/requirements.txt 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/requirements.txt 2022-09-09 10:31:48.000000000 +0200 @@ -1,8 +1,8 @@ lxml -mock +mock; python_version < '3.3' pep8 python-dateutil PyYAML six -pylint +pylint < 2.14 flake8 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/commontests.py new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/commontests.py --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/commontests.py 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/commontests.py 2022-09-09 10:31:48.000000000 +0200 @@ -262,7 +262,9 @@ self.tar_scm_std(*args) logpath = self.scmlogs.current_log_path loglines = self.scmlogs.read() + if expect_cache_hit: + self.scmlogs.annotate("expected cache hit") self.assertRanUpdate(logpath, loglines) else: self.assertRanInitialClone(logpath, loglines) @@ -276,6 +278,7 @@ else: tar_handle = self.assertTarOnly(basename) tarent = 'a' + self.assertTarMemberContains( tar_handle, basename + '/' + tarent, @@ -298,11 +301,17 @@ args_subdir = args + ['--subdir', self.fixtures.subdir] args_tag2 = args + ['--revision', self.rev(2)] + + use_cache_exception = use_cache + if self.scm in ('svn', 'git'): + use_cache_exception = False + + self.scmlogs.annotate("use_cache_exception: " + str(use_cache_exception)) self._sequential_calls_with_revision( version, [ (0, args_tag2, '2', False), - (0, args_subdir, '2', use_cache and self.scm != 'svn'), + (0, args_subdir, '2', use_cache_exception), (2, args_tag2, '2', use_cache), (0, args_subdir, '4', use_cache), (2, args_tag2, '2', use_cache), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/gittests.py new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/gittests.py --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/gittests.py 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/gittests.py 2022-09-09 10:31:48.000000000 +0200 @@ -7,7 +7,11 @@ import tarfile import shutil import io -import mock + +try: + from unittest import mock +except ImportError: + import mock from utils import file_write_legacy diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/tartests.py new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/tartests.py --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/tartests.py 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/tartests.py 2022-09-09 10:31:48.000000000 +0200 @@ -2,6 +2,7 @@ from __future__ import print_function import os +import glob from utils import file_write_legacy @@ -44,3 +45,36 @@ tasks = FakeTasks() tar_obj = Tar(cli, tasks) tar_obj.finalize() + + + def test_tar_scm_multiple_obsinfo(self): + wdir = self.pkgdir + info = os.path.join(wdir, "test1.obsinfo") + print("INFOFILE: '%s'" % info) + os.chdir(self.pkgdir) + out_str = "name: pkgname1\n" \ + "version: 0.1.1\n" \ + "mtime: 1476683264\n" \ + "commit: fea6eb5f43841d57424843c591b6c8791367a9e5\n" + file_write_legacy(info, out_str) + + info = os.path.join(wdir, "test2.obsinfo") + print("INFOFILE: '%s'" % info) + os.chdir(self.pkgdir) + out_str = "name: pkgname2\n" \ + "version: 0.1.2\n" \ + "mtime: 1476683264\n" \ + "commit: fea6eb5f43841d57424843c591b6c8791367a9e5\n" + file_write_legacy(info, out_str) + + src_dir = os.path.join(wdir, "pkgname1") + os.mkdir(src_dir) + src_dir = os.path.join(wdir, "pkgname2") + os.mkdir(src_dir) + self.tar_scm_std() + self.assertTrue(os.path.isdir(src_dir)) + os.chdir(self.outdir) + files = glob.glob('*.tar') + files.sort() + expected = ['pkgname1-0.1.1-0.1.1.tar', 'pkgname2-0.1.2-0.1.2.tar'] + self.assertEqual(files, expected) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/tasks.py new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/tasks.py --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/tasks.py 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/tasks.py 2022-09-09 10:31:48.000000000 +0200 @@ -6,7 +6,10 @@ import unittest import io -from mock import MagicMock +try: + from unittest.mock import MagicMock +except ImportError: + from mock import MagicMock from tar_scm import TarSCM from tests.fake_classes import FakeSCM diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/test.py new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/test.py --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/test.py 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/test.py 2022-09-09 10:31:48.000000000 +0200 @@ -102,7 +102,7 @@ # Cleanup: if result.wasSuccessful(): - if os.path.exists(TestEnvironment.tmp_dir): + if os.path.exists(TestEnvironment.tmp_dir) and not os.environ.get('TAR_SCM_SKIP_CLEANUP'): shutil.rmtree(TestEnvironment.tmp_dir) sys.exit(0) else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/unittestcases.py new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/unittestcases.py --- old/obs-service-tar_scm-0.10.30.1641990734.bdad8f9/tests/unittestcases.py 2022-01-12 13:32:14.000000000 +0100 +++ new/obs-service-tar_scm-0.10.32.1662712308.31d1884/tests/unittestcases.py 2022-09-09 10:31:48.000000000 +0200 @@ -8,7 +8,10 @@ import unittest import six -from mock import patch +try: + from unittest.mock import patch +except ImportError: + from mock import patch from utils import file_write_legacy @@ -355,3 +358,11 @@ self.assertEqual(tc_name, bname) self.assertEqual('%s-%s' % (tc_name, version), dst) self.assertEqual(chgv, version) + + def test_cache_locking(self): + scm = Git(self.cli, self.tasks) + scm.clone_dir = '.' + scm.lock_cache() + fname = scm.lock_file.name + scm.unlock_cache() + assert os.path.exists(fname) == 0