diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 046c1488..ed59fd84 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,7 +20,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ '2.7', '3.7', '3.8', '3.9' ] + python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12'] # Steps represent a sequence of tasks that will be executed as part of the job steps: @@ -39,9 +39,10 @@ jobs: locale - name: Setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} + allow-prereleases: true - name: Install python dependencies run: pip install -r requirements.txt diff --git a/.pylintrc b/.pylintrc index 740cdc01..4fe13a90 100644 --- a/.pylintrc +++ b/.pylintrc @@ -93,7 +93,7 @@ confidence= # * E0015 - unrecognized-option -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,R0022,W0012,E0012,E0015 +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,R0022,W0012,E0012,E0015,no-member [REPORTS] diff --git a/.pylinttestsrc b/.pylinttestsrc index 946686d5..84d315ad 100644 --- a/.pylinttestsrc +++ b/.pylinttestsrc @@ -92,7 +92,7 @@ confidence= # * W0012 - unknown-option-value # * E0015 - unrecognized-option -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,duplicate-code,too-many-public-methods,protected-access,too-many-locals,consider-using-with,consider-using-f-string,super-with-arguments,E0012,R0022,W0012,E0015 +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,duplicate-code,too-many-public-methods,protected-access,too-many-locals,consider-using-with,consider-using-f-string,super-with-arguments,E0012,R0022,W0012,E0015,no-member [REPORTS] diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 48d00cfe..00000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: python -python: - - "2.7" - - "3.6" -before_install: - - sudo apt-get update -qq - - sudo apt-get install -qq bzr git subversion tar - - sudo locale-gen en_US.UTF-8 -install: - - pip install -r requirements.txt - - mkdir bin - - ln -s /usr/bin/true bin/obs-service-download_files # we don't test other services here - - export PATH="$PWD/bin:$PATH" - - export TAR_SCM_TC=UnitTestCases,TasksTestCases,SCMBaseTestCases,GitTests,SvnTests,TarTestCases -script: PV=${TRAVIS_PYTHON_VERSION:0:1};echo $PV;make check$PV diff --git a/KankuFile b/KankuFile index c1956825..90c7ebfa 100644 --- a/KankuFile +++ b/KankuFile @@ -4,7 +4,7 @@ Kanku::Util::IPTables: domain_name: obs-service-tar_scm -default_job: kanku-job +default_job: tw login_user: root login_pass: kankudai @@ -12,7 +12,7 @@ qemu: user: jobs: - kanku-job: + tw: - use_module: Kanku::Handler::SetJobContext options: @@ -25,9 +25,9 @@ jobs: # https://build.opensuse.org/project/show/devel:kanku:immages # to find more official Images project: devel:kanku:images - repository: images_leap_15_3 - package: openSUSE-Leap-15.3-JeOS - use_oscrc: 0 + package: openSUSE-Tumbleweed-JeOS:ext4 + repository: images_tumbleweed + arch: x86_64 - use_module: Kanku::Handler::ImageDownload options: @@ -47,7 +47,6 @@ jobs: options: 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-pylint python3-flake8 - use_module: Kanku::Handler::ExecuteCommandViaSSH @@ -56,5 +55,3 @@ jobs: commands: # test python3 - make -C /tmp/kanku clean check3 - # test python2 - - make -C /tmp/kanku clean test2 diff --git a/README.md b/README.md index 97cceecc..332147b8 100644 --- a/README.md +++ b/README.md @@ -128,8 +128,7 @@ under the `tests/fixtures/` subdirectory. ### gbp The `obs_gbp` service can be used to create Debian source artefacts (.dsc, .orig.tar.gz and if non-native .debian.tar.gz or .diff.gz) from -Git repositories, following the very popular [git-buildpackage workflow.] -(https://honk.sigxcpu.org/piki/projects/git-buildpackage/) +Git repositories, following the very popular [git-buildpackage workflow](https://honk.sigxcpu.org/piki/projects/git-buildpackage/). Requires git-buildpackage to be installed. ## Archive Formats diff --git a/TarSCM/config.py b/TarSCM/config.py index 013e44f2..92891d82 100644 --- a/TarSCM/config.py +++ b/TarSCM/config.py @@ -66,11 +66,17 @@ def _init_config(self, fname): if self.fakeheader: logging.debug("Using fakeheader for file '%s'", fname) - tmp_fp = StringIO() - tmp_fp.write('[' + self.default_section + ']\n') - tmp_fp.write(open(fname, 'r').read()) - tmp_fp.seek(0, os.SEEK_SET) - config.readfp(tmp_fp) + try: + fake_header = '[' + self.default_section + ']\n' + config.read_string(fake_header + open(fname, 'r').read(), + source=fname) + except AttributeError: + tmp_fp = StringIO() + tmp_fp.write('[' + self.default_section + ']\n') + tmp_fp.write(open(fname, 'r').read()) + tmp_fp.seek(0, os.SEEK_SET) + config.readfp(tmp_fp) + else: config.read(fname) diff --git a/TarSCM/exceptions.py b/TarSCM/exceptions.py index 4a8e946b..8442d343 100644 --- a/TarSCM/exceptions.py +++ b/TarSCM/exceptions.py @@ -1,2 +1,6 @@ class OptionsError(BaseException): pass + + +class GitError(BaseException): + pass diff --git a/TarSCM/scm/git.py b/TarSCM/scm/git.py index dba0ccfa..87bdfdb6 100644 --- a/TarSCM/scm/git.py +++ b/TarSCM/scm/git.py @@ -5,6 +5,7 @@ import shutil from TarSCM.scm.base import Scm +from TarSCM.exceptions import GitError def search_tags(comment, limit=None): @@ -585,7 +586,7 @@ def get_parents(self, sha1): parents = result[1].rstrip().split(" ") fcm = parents.pop(0) if fcm != sha1: - raise Exception("First commit %s no equal sha1 %s" % (fcm, sha1)) + raise GitError("First commit %s no equal sha1 %s" % (fcm, sha1)) if parents: return parents return [] diff --git a/TarSCM/tasks.py b/TarSCM/tasks.py index cefff3a8..55fd7f36 100644 --- a/TarSCM/tasks.py +++ b/TarSCM/tasks.py @@ -115,8 +115,9 @@ def generate_list(self): files = glob.glob('*.obsinfo') if files: for obsinfo in files: - args.obsinfo = obsinfo - self.task_list.append(copy.copy(args)) + if obsinfo != '_scmsync.obsinfo': + args.obsinfo = obsinfo + self.task_list.append(copy.copy(args)) else: # Fallback if there are no obsinfo files self.task_list.append(args) diff --git a/debian/changelog b/debian/changelog index faa4ebbd..73ff774b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,22 @@ +obs-service-tar-scm (0.10.41) unstable; urgency=medium + + * update to upstream version 0.10.41 + + -- Frank Schreiner Thu, 20 Jul 2023 15:55:12 +0200 + +obs-service-tar-scm (0.10.40) unstable; urgency=medium + + * update to upstream version 0.10.40 + + -- Frank Schreiner Tue, 18 Jul 2023 14:08:09 +0200 + +obs-service-tar-scm (0.10.37) unstable; urgency=medium + + [ Frank Schreiner] + * update to version 0.10.37 + + -- Frank Schreiner Tue, 13 Jun 2023 15:39:11 +0200 + obs-service-tar-scm (0.10.14) unstable; urgency=medium [ Roman Neuhauser ] diff --git a/dist/debian.dsc b/dist/debian.dsc new file mode 100644 index 00000000..d876c10e --- /dev/null +++ b/dist/debian.dsc @@ -0,0 +1,19 @@ +Format: 1.0 +Source: obs-service-tar-scm +Version: 0.10.36 +Provides: obs-service-obs_scm, obs-service-tar +Binary: obs-service-tar_scm +Maintainer: Adrian Schroeter +Architecture: all +Standards-Version: 3.7.2 +Build-Depends: debhelper (>= 8.0.0), python3, python3-dateutil, dh-python, python3-yaml + +Package: obs-service-tar-scm +Architecture: all +Provides: obs-service-obs-scm, obs-service-tar +Depends: ${misc:Depends}, ${python3:Depends}, bzr, git, subversion, cpio, python3-dateutil, python3-yaml +Recommends: mercurial +Description: An OBS source service: fetches SCM tarballs + This is a source service for openSUSE Build Service. + It supports downloading from svn, git, hg and bzr repositories. + diff --git a/dist/obs-service-tar_scm.spec b/dist/obs-service-tar_scm.spec index 1b065d57..efe3dcdc 100644 --- a/dist/obs-service-tar_scm.spec +++ b/dist/obs-service-tar_scm.spec @@ -120,7 +120,7 @@ Recommends: %{use_python}-keyrings.alt \ %define pkg_name obs-service-tar_scm Name: %{pkg_name}%{nsuffix} %define version_unconverted 0.10.18.1600256320.569e5be -Version: 0.10.18.1600256320.569e5be +Version: 0.10.35 Release: 0 Summary: An OBS source service: create tar ball from svn/git/hg License: GPL-2.0-or-later @@ -138,8 +138,8 @@ BuildRequires: %{pkg_name} = %{version} BuildRequires: %{use_python}-keyring BuildRequires: %{use_python}-keyrings.alt BuildRequires: %{use_python}-six -BuildRequires: %{use_python}-unittest2 BuildRequires: bzr +BuildRequires: gpg BuildRequires: git-core BuildRequires: mercurial BuildRequires: subversion diff --git a/tests/fixtures/GitTests/test_find_valid_commit/fixtures.tar b/tests/fixtures/GitTests/test_find_valid_commit/fixtures.tar index 621b1bd7..d711ab9c 100644 Binary files a/tests/fixtures/GitTests/test_find_valid_commit/fixtures.tar and b/tests/fixtures/GitTests/test_find_valid_commit/fixtures.tar differ diff --git a/tests/gittests.py b/tests/gittests.py index 8c23c7ca..bc456d31 100644 --- a/tests/gittests.py +++ b/tests/gittests.py @@ -155,10 +155,10 @@ def test_submodule_update(self): '--version', 'tag3') tar_path = os.path.join(self.outdir, self.basename(version='tag3') + '.tar') - tar = tarfile.open(tar_path) - submod_path = os.path.join(self.basename(version='tag3'), - submod_name, 'a') - self.assertTarMemberContains(tar, submod_path, '5') + with tarfile.open(tar_path) as tar: + submod_path = os.path.join( + self.basename(version='tag3'), submod_name, 'a') + self.assertTarMemberContains(tar, submod_path, '5') def test_submodule_disabled_update(self): submod_name = 'submod1' @@ -169,9 +169,9 @@ def test_submodule_disabled_update(self): '--version', 'tag3') tar_path = os.path.join(self.outdir, self.basename(version='tag3') + '.tar') - tar = tarfile.open(tar_path) - self.assertRaises(KeyError, tar.getmember, os.path.join( - self.basename(version='tag3'), submod_name, 'a')) + with tarfile.open(tar_path) as tar: + self.assertRaises(KeyError, tar.getmember, os.path.join( + self.basename(version='tag3'), submod_name, 'a')) def test_submodule_in_other_branch(self): submod_name = 'submod1' @@ -185,10 +185,10 @@ def test_submodule_in_other_branch(self): '--version', rev) tar_path = os.path.join(self.outdir, self.basename(version=rev) + '.tar') - tar = tarfile.open(tar_path) - submod_path = os.path.join(self.basename(version=rev), - submod_name, 'a') - self.assertTarMemberContains(tar, submod_path, '3') + with tarfile.open(tar_path) as tar: + submod_path = os.path.join(self.basename(version=rev), + submod_name, 'a') + self.assertTarMemberContains(tar, submod_path, '3') def test_latest_submodule_in_other_branch(self): # pylint: disable=C0103 submod_name = 'submod1' @@ -202,10 +202,10 @@ def test_latest_submodule_in_other_branch(self): # pylint: disable=C0103 '--version', rev) tar_path = os.path.join(self.outdir, self.basename(version=rev) + '.tar') - tar = tarfile.open(tar_path) - submod_path = os.path.join(self.basename(version=rev), - submod_name, 'a') - self.assertTarMemberContains(tar, submod_path, '5') + with tarfile.open(tar_path) as tar: + submod_path = os.path.join( + self.basename(version=rev), submod_name, 'a') + self.assertTarMemberContains(tar, submod_path, '5') def _check_servicedata(self, expected_dirents=2, revision=2): expected_sha1 = self.sha1s('tag%d' % revision) @@ -289,12 +289,12 @@ def test_gitlab_github_files(self): 'gitlab_hub', "--versionformat", "@PARENT_TAG@") tar_path = os.path.join(self.outdir, self.basename(version='gitlab_hub') + '.tar') - tar = tarfile.open(tar_path) - submod_path = os.path.join(self.basename(version='gitlab_hub')) - hub_path = os.path.join(submod_path, '.github/test') - lab_path = os.path.join(submod_path, '.gitlab/test') - self.assertTarMemberContains(tar, hub_path, '') - self.assertTarMemberContains(tar, lab_path, '') + with tarfile.open(tar_path) as tar: + submod_path = os.path.join(self.basename(version='gitlab_hub')) + hub_path = os.path.join(submod_path, '.github/test') + lab_path = os.path.join(submod_path, '.gitlab/test') + self.assertTarMemberContains(tar, hub_path, '') + self.assertTarMemberContains(tar, lab_path, '') def test_no_parent_tag(self): fix = self.fixtures @@ -439,11 +439,12 @@ def test_find_valid_commit(self): tar_path = os.path.join(basedir, 'fixtures', cln, fnn, 'fixtures.tar') if not os.path.isfile(tar_path): raise AssertionError("File does not exist: %s" % tar_path) - basedir = os.path.abspath(os.path.join(os.getcwd(),'..')) + basedir = os.path.abspath(os.path.join(os.getcwd(), '..')) org_gnupghome = os.getenv('GNUPGHOME') os.environ["GNUPGHOME"] = os.path.join(basedir, '.gnupg') with tarfile.open(tar_path, "r") as tar: tar.extractall(basedir) + tar.close() # prepare test f_args = FakeCli() @@ -556,7 +557,7 @@ def test_find_valid_commit(self): rev = git.find_latest_signed_commit(case[0]) self.assertEqual(rev, case[1]) - empty=git.merge_is_empty('181fb87') + empty = git.merge_is_empty('181fb87') self.assertEqual(empty, 0) if org_gnupghome: