From e9a44fbb075bc2eac9ae182bc31bcbb6b21ac0af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C4=9Bj=20Cepl?= Date: Fri, 6 Dec 2024 19:49:33 +0100 Subject: [PATCH] Remove support for Bazaar (bzr) There is just no other way how to see it: Bazaar is now truly dead (including its fork Breezy [1]), and even launchpad.net seems to be non-functional. There is no reason for us to support this. [1] https://github.com/breezy-team/breezy/commits/master/ --- .github/workflows/main.yml | 2 +- GNUmakefile | 3 -- KankuFile | 2 +- README.md | 8 ++-- TESTING.md | 12 +++--- TarSCM/archive.py | 2 +- TarSCM/cli.py | 2 +- TarSCM/scm/__init__.py | 1 - TarSCM/scm/base.py | 7 +--- TarSCM/scm/bzr.py | 75 ----------------------------------- TarSCM/tasks.py | 3 +- debian/control | 4 +- dist/debian.dsc | 4 +- dist/obs-service-tar_scm.spec | 6 +-- tar_scm.service.in | 8 ++-- tests/bzrfixtures.py | 38 ------------------ tests/bzrtests.py | 42 -------------------- tests/commontests.py | 2 +- tests/tasks.py | 19 --------- tests/test.py | 4 +- tests/unittestcases.py | 15 ------- tests/utils.py | 3 -- 22 files changed, 27 insertions(+), 235 deletions(-) delete mode 100644 TarSCM/scm/bzr.py delete mode 100644 tests/bzrfixtures.py delete mode 100644 tests/bzrtests.py diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ed59fd84..b1e30aea 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: - uses: actions/checkout@v3 - name: Install required dpkg packages - run: sudo apt-get install libxslt1-dev bzr subversion mercurial + run: sudo apt-get install libxslt1-dev subversion mercurial - name: Generate default locales run: | diff --git a/GNUmakefile b/GNUmakefile index 4321ec96..1730b30c 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -10,7 +10,6 @@ SYSCFG = /etc CLEAN_PYFILES = \ ./tar_scm.py \ - ./TarSCM/scm/bzr.py \ ./TarSCM/scm/svn.py \ ./TarSCM/exceptions.py \ @@ -23,13 +22,11 @@ CLEAN_TEST_PYFILES = \ ./tests/archiveobscpiotestcases.py \ ./tests/gittests.py \ ./tests/fixtures.py \ - ./tests/bzrfixtures.py \ ./tests/gitfixtures.py \ ./tests/hgfixtures.py \ ./tests/svnfixtures.py \ ./tests/tarfixtures.py \ ./tests/commontests.py \ - ./tests/bzrtests.py \ ./tests/svntests.py \ PYLINT_READY_TEST_MODULES = \ diff --git a/KankuFile b/KankuFile index 90c7ebfa..e5a7cad2 100644 --- a/KankuFile +++ b/KankuFile @@ -46,7 +46,7 @@ jobs: use_module: Kanku::Handler::ExecuteCommandViaSSH options: commands: - - zypper -n in git bzr mercurial subversion make tar + - zypper -n in git mercurial subversion make tar - zypper -n in python3-PyYAML python3-python-dateutil python3-pylint python3-flake8 - use_module: Kanku::Handler::ExecuteCommandViaSSH diff --git a/README.md b/README.md index 7a00701b..372d8257 100644 --- a/README.md +++ b/README.md @@ -15,16 +15,16 @@ https://github.com/openSUSE/obs-service-tar_scm. `tar_scm` is the legacy source service used to create a source tarball from one of the supported SCM (source code management) tools: `git`, -`hg`, `svn`, and `bzr`. +`hg`, and `svn`. `tar_scm` supports many options, e.g. it can adjust resulting tarball parameters, include or exclude particular files when creating the tarball, or generate an `rpm` changelog from the SCM commit log. For the full list of options please see `tar_scm.service.in`. -Apart from various SCM like git, hg, bzr or svn, it additionally -supports `--url` option that allows you to specify URL of the upstream -tarball to be downloaded. +Apart from various SCM like git, hg, or svn, it additionally supports +`--url` option that allows you to specify URL of the upstream tarball to +be downloaded. `tar_scm` can be used in combination with other services like [download_files](https://github.com/openSUSE/obs-service-download_files), diff --git a/TESTING.md b/TESTING.md index 32ce4289..f765a8c5 100644 --- a/TESTING.md +++ b/TESTING.md @@ -29,12 +29,12 @@ development, you can provide command-line arguments: Currently this filtering only applies to the git tests, but you can easily tweak `test.py` to change that. -Note that for each test, a fresh `svn`/`git`/`hg`/`bzr` repository is -created, and `tar_scm` is invoked one *or more* times in a faked-up -OBS source service environment. Whenever `tar_scm` invokes the VCS -for which its functionality is being tested, through modification of -`$PATH` it actually invokes `scm-wrapper`, which logs the VCS -invocation before continuing. +Note that for each test, a fresh `svn`/`git`/`hg` repository is created, +and `tar_scm` is invoked one *or more* times in a faked-up OBS source +service environment. Whenever `tar_scm` invokes the VCS for which its +functionality is being tested, through modification of `$PATH` it +actually invokes `scm-wrapper`, which logs the VCS invocation before +continuing. ### Persistence between test runs diff --git a/TarSCM/archive.py b/TarSCM/archive.py index b7c1cf41..29530e3b 100644 --- a/TarSCM/archive.py +++ b/TarSCM/archive.py @@ -17,7 +17,7 @@ except: from StringIO import StringIO -METADATA_PATTERN = re.compile(r'.*/\.(bzr|git|hg|svn)(\/.*|$)') +METADATA_PATTERN = re.compile(r'.*/\.(git|hg|svn)(\/.*|$)') class BaseArchive(): diff --git a/TarSCM/cli.py b/TarSCM/cli.py index 322a559c..ba0978a4 100644 --- a/TarSCM/cli.py +++ b/TarSCM/cli.py @@ -66,7 +66,7 @@ def parse_args(self, options): help='Enable verbose output') parser.add_argument('--scm', help='Specify SCM', - choices=['git', 'hg', 'bzr', 'svn', 'tar']) + choices=['git', 'hg', 'svn', 'tar']) parser.add_argument('--url', help='Specify URL of upstream tarball to download') parser.add_argument('--user', diff --git a/TarSCM/scm/__init__.py b/TarSCM/scm/__init__.py index 265fdf58..8bac5904 100644 --- a/TarSCM/scm/__init__.py +++ b/TarSCM/scm/__init__.py @@ -1,5 +1,4 @@ from TarSCM.scm.git import Git -from TarSCM.scm.bzr import Bzr from TarSCM.scm.hg import Hg from TarSCM.scm.svn import Svn from TarSCM.scm.tar import Tar diff --git a/TarSCM/scm/base.py b/TarSCM/scm/base.py index 8b7f9daa..a36e7d21 100644 --- a/TarSCM/scm/base.py +++ b/TarSCM/scm/base.py @@ -97,14 +97,9 @@ def __del__(self): self._revert_gpg_settings() def auth_url(self): - if self.scm not in ('bzr', 'git', 'hg'): + if self.scm not in ('git', 'hg'): return auth_patterns = {} - auth_patterns['bzr'] = {} - auth_patterns['bzr']['proto'] = r'^(ftp|bzr|https?)://.*' - auth_patterns['bzr']['already'] = r'^(ftp|bzr|https?)://.*:.*@.*' - auth_patterns['bzr']['sub'] = r'^((ftp|bzr|https?)://)(.*)' - auth_patterns['bzr']['format'] = r'\g<1>{user}:{pwd}@\g<3>' auth_patterns['git'] = {} auth_patterns['git']['proto'] = r'^(ftps?|https?)://.*' auth_patterns['git']['already'] = r'^(ftps?|https?)://.*:.*@.*' diff --git a/TarSCM/scm/bzr.py b/TarSCM/scm/bzr.py deleted file mode 100644 index 21907d4a..00000000 --- a/TarSCM/scm/bzr.py +++ /dev/null @@ -1,75 +0,0 @@ -import sys -import re -import os -import dateutil.parser -from TarSCM.scm.base import Scm - - -class Bzr(Scm): - scm = 'bzr' - - def _get_scm_cmd(self): - """Compose a BZR-specific command line using http proxies.""" - # Bazaar honors the http[s]_proxy variables, no action needed - return [self.scm] - - def fetch_upstream_scm(self): - """SCM specific version of fetch_uptream for bzr.""" - - self.auth_url() - command = self._get_scm_cmd() + ['checkout', self.url, self.clone_dir] - if self.revision: - command.insert(3, '-r') - command.insert(4, self.revision) - if not self.is_sslverify_enabled(): - command.insert(2, '-Ossl.cert_reqs=None') - wdir = os.path.abspath(os.path.join(self.clone_dir, os.pardir)) - self.helpers.safe_run(command, wdir, interactive=sys.stdout.isatty()) - - 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, - interactive=sys.stdout.isatty() - ) - - def detect_version(self, args): - """ - Automatic detection of version number for checked-out BZR repository. - """ - versionformat = args['versionformat'] - if versionformat is None: - versionformat = '%r' - - version = self.helpers.safe_run(self._get_scm_cmd() + ['revno'], - self.clone_dir)[1] - return re.sub('%r', version.strip(), versionformat) - - def get_timestamp(self): - log = self.helpers.safe_run( - self._get_scm_cmd() + ['log', '--limit=1', '--log-format=long'], - self.clone_dir - )[1] - match = re.search(r'timestamp:(.*)', log, re.MULTILINE) - if not match: - return 0 - tsm = match.group(1).strip() - timestamp = dateutil.parser.parse(tsm).strftime("%s") - return int(timestamp) - - # no cleanup is necessary for bzr - def cleanup(self): - pass - - def check_url(self): - """check if url is a remote url""" - if not re.match("^((a?ftp|bzr|https?)://|lp:)", self.url): - return False - return True diff --git a/TarSCM/tasks.py b/TarSCM/tasks.py index 65c8838d..668c3983 100644 --- a/TarSCM/tasks.py +++ b/TarSCM/tasks.py @@ -65,7 +65,7 @@ def generate_list(self): job from cli arguments. ''' args = self.args - scms = ['git', 'tar', 'svn', 'bzr', 'hg'] + scms = ['git', 'tar', 'svn', 'hg'] if args.appimage: # we read the SCM config from appimage.yml @@ -194,7 +194,6 @@ def process_single_task(self, args): scm2class = { 'git': 'Git', - 'bzr': 'Bzr', 'hg': 'Hg', 'svn': 'Svn', 'tar': 'Tar', diff --git a/debian/control b/debian/control index f0758916..80a02dd5 100644 --- a/debian/control +++ b/debian/control @@ -9,8 +9,8 @@ Homepage: https://github.com/openSUSE/obs-service-tar_scm Package: obs-service-tar-scm Architecture: all Provides: obs-service-obs-scm, obs-service-tar, obs-service-gbp -Depends: ${misc:Depends}, ${python3:Depends}, python3, bzr, git, subversion, cpio, python3-dateutil, python3-yaml, locales-all +Depends: ${misc:Depends}, ${python3:Depends}, python3, git, subversion, cpio, python3-dateutil, python3-yaml, locales-all Recommends: mercurial, git-buildpackage, git-lfs Description: 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. + It supports downloading from svn, git, and hg repositories. diff --git a/dist/debian.dsc b/dist/debian.dsc index 58f0dbcc..9d0d0f09 100644 --- a/dist/debian.dsc +++ b/dist/debian.dsc @@ -11,9 +11,9 @@ Build-Depends: debhelper (>= 8.0.0), python3, python3-dateutil, dh-python, pytho Package: obs-service-tar-scm Architecture: all Provides: obs-service-obs-scm, obs-service-tar -Depends: ${misc:Depends}, ${python3:Depends}, python3, bzr, git, subversion, cpio, python3-dateutil, python3-yaml +Depends: ${misc:Depends}, ${python3:Depends}, python3, git, subversion, cpio, python3-dateutil, python3-yaml Recommends: mercurial, git-buildpackage, git-lfs 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. + It supports downloading from svn, git, and hg repositories. diff --git a/dist/obs-service-tar_scm.spec b/dist/obs-service-tar_scm.spec index a88abb48..3f566b4e 100644 --- a/dist/obs-service-tar_scm.spec +++ b/dist/obs-service-tar_scm.spec @@ -106,7 +106,6 @@ Requires: obs-service-obs_scm-common = %version-%release \ %define scm_dependencies \ Requires: git-core \ %if 0%{?suse_version} >= 1315 \ -Recommends: bzr \ Recommends: mercurial \ Recommends: subversion \ Recommends: obs-service-download_files \ @@ -138,7 +137,6 @@ BuildRequires: %{pkg_name} = %{version} BuildRequires: %{use_python}-keyring BuildRequires: %{use_python}-keyrings.alt BuildRequires: %{use_python}-six -BuildRequires: bzr BuildRequires: gpg BuildRequires: git-core BuildRequires: mercurial @@ -179,7 +177,7 @@ Requires: %{python_path} %description This is a source service for openSUSE Build Service. -It supports downloading from svn, git, hg and bzr repositories. +It supports downloading from svn, git, and hg repositories. %package -n obs-service-obs_scm-common Summary: Common parts of SCM handling services @@ -194,7 +192,7 @@ Requires: %{use_python}-argparse %description -n obs-service-obs_scm-common This is a source service for openSUSE Build Service. -It supports downloading from svn, git, hg and bzr repositories. +It supports downloading from svn, git, and hg repositories. This package holds the shared files for different services. diff --git a/tar_scm.service.in b/tar_scm.service.in index 0e68da6d..bf8340dc 100644 --- a/tar_scm.service.in +++ b/tar_scm.service.in @@ -1,14 +1,14 @@ ===OBS_ONLY Create a special OBS archive from a SCM - This service uses a SCM client to checkout or update from a given repository. Supported are svn, git, hg and bzr. The result will archived in a format which can be stored + This service uses a SCM client to checkout or update from a given repository. Supported are svn, git, and hg. The result will archived in a format which can be stored incremental by the OBS source server, currently a cpio format. This archive will be extracted again inside of the build root. === ===TAR_ONLY Create a tarball from SCM repository - This service uses a SCM client to checkout or update from a given repository. Supported are svn, git, hg and bzr. + This service uses a SCM client to checkout or update from a given repository. Supported are svn, git, and hg. === ===GBP_ONLY @@ -30,7 +30,6 @@ svn git hg - bzr @@ -51,7 +50,6 @@ Its only available for the following combination of SCM / protocols: - git: ftp(s),http(s) - svn - - bzr: bzr,ftp,http(s) - hg: http(s) @@ -93,7 +91,7 @@ For hg, the value is passed to hg log --template=.... See the hg documentation for more information. The default is '{rev}' - For bzr and svn, '%r' is expanded to the revision, and is the default. + For svn, '%r' is expanded to the revision, and is the default. diff --git a/tests/bzrfixtures.py b/tests/bzrfixtures.py deleted file mode 100644 index 2a1dcaf1..00000000 --- a/tests/bzrfixtures.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env python - -import os - -from fixtures import Fixtures -from utils import run_bzr - - -class BzrFixtures(Fixtures): - """Methods to create and populate a bzr repository. - - bzr tests use this class in order to have something to test against. - """ - - def init(self): - self.create_repo() - self.create_commits(2) - - def run(self, cmd): - return run_bzr(self.repo_path, cmd) - - def create_repo(self): - os.makedirs(self.repo_path) - os.chdir(self.repo_path) - self.safe_run('init') - self.safe_run('whoami "%s"' % self.name_and_email) - self.wdir = self.repo_path - print("created repo %s" % self.repo_path) - - def record_rev(self, *args): - rev_num = args[0] - self.revs[rev_num] = str(rev_num) - self.scmlogs.annotate("Recorded rev %d" % rev_num) - - def get_committer_date(self): - '''There seems to be no way to create a commit with a given timestamp - set for Bazar.''' - return '' diff --git a/tests/bzrtests.py b/tests/bzrtests.py deleted file mode 100644 index ad023e22..00000000 --- a/tests/bzrtests.py +++ /dev/null @@ -1,42 +0,0 @@ -#!/usr/bin/env python - -from commontests import CommonTests -from bzrfixtures import BzrFixtures - - -class BzrTests(CommonTests): - - """Unit tests for 'tar_scm --scm bzr'. - - bzr-specific tests are in this class. Other shared tests are - included via the class inheritance hierarchy. - """ - - scm = 'bzr' - initial_clone_command = 'bzr checkout' - update_cache_command = 'bzr update' - sslverify_false_args = '-Ossl.cert_reqs=None' - fixtures_class = BzrFixtures - - def default_version(self): - return self.rev(2) - - def test_versionformat_rev(self): - self.tar_scm_std('--versionformat', 'myrev%r.svn') - self.assertTarOnly(self.basename(version='myrev2.svn')) - - def test_version_versionformat(self): - self.tar_scm_std('--version', '3.0', '--versionformat', 'myrev%r.svn') - self.assertTarOnly(self.basename(version='myrev2.svn')) - - def test_versionformat_revision(self): - self.fixtures.create_commits(4) - self.tar_scm_std('--versionformat', 'foo%r', '--revision', self.rev(2)) - basename = self.basename(version='foo2') - tar = self.assertTarOnly(basename) - self.assertTarMemberContains(tar, basename + '/a', '2') - - def assertDirentsMtime(self, entries): - '''Skip this test with bazaar because there seem to be no way to create - commits with a given timestamp.''' - return True diff --git a/tests/commontests.py b/tests/commontests.py index b0db042b..66938cc6 100644 --- a/tests/commontests.py +++ b/tests/commontests.py @@ -15,7 +15,7 @@ class CommonTests(TestEnvironment, TestAssertions): """Unit tests common to all version control systems. Unit tests here are not specific to any particular version control - system, and will be run for all of git / hg / svn / bzr. + system, and will be run for all of git / hg / svn. """ scm = None diff --git a/tests/tasks.py b/tests/tasks.py index ecae3e8a..a0a702d0 100644 --- a/tests/tasks.py +++ b/tests/tasks.py @@ -68,14 +68,6 @@ def _generate_tl_common(self, expected, func): self.assertEqual(tasks.task_list[0].__dict__[key], val) self.assertEqual(len(tasks.task_list), 1) - def test_generate_tl_single_task(self): - expected = { - 'scm': 'bzr', 'clone_prefix': '_obs_', 'snapcraft': True, - 'revision': None, 'url': 'lp:~mterry/libpipeline/printf', - 'filename': 'libpipeline', 'use_obs_scm': True, - 'outdir': self.cli.outdir, 'changesgenerate': False} - self._generate_tl_common(expected, 'test_generate_tl_single_task') - def test_generate_tl_st_appimage(self): '''Test generates task list with single task from appimage.yml''' self.cli.snapcraft = False @@ -106,17 +98,6 @@ def test_appimage_empty_build_git(self): def test_generate_tl_multi_tasks(self): expected = { - 'libpipeline': { - 'changesgenerate': False, - 'clone_prefix': '_obs_', - 'filename': 'libpipeline', - 'outdir': self.cli.outdir, - 'revision': None, - 'scm': 'bzr', - 'snapcraft': True, - 'url': 'lp:~mterry/libpipeline/printf', - 'use_obs_scm': True - }, 'kanku': { 'changesgenerate': False, 'clone_prefix': '_obs_', diff --git a/tests/test.py b/tests/test.py index 191070f9..e6450ab6 100755 --- a/tests/test.py +++ b/tests/test.py @@ -15,7 +15,6 @@ from tests.gittests import GitTests from tests.svntests import SvnTests from tests.hgtests import HgTests -from tests.bzrtests import BzrTests from tests.testenv import TestEnvironment from tests.unittestcases import UnitTestCases from tests.tasks import TasksTestCases @@ -42,8 +41,7 @@ def prepare_testclasses(): GitTests, SvnTests, HgTests, - TarTestCases, - BzrTests + TarTestCases ] if os.getenv('TAR_SCM_TC'): diff --git a/tests/unittestcases.py b/tests/unittestcases.py index 917afdf4..60afbb3f 100644 --- a/tests/unittestcases.py +++ b/tests/unittestcases.py @@ -23,7 +23,6 @@ from TarSCM.scm.git import Git from TarSCM.scm.svn import Svn from TarSCM.scm.hg import Hg -from TarSCM.scm.bzr import Bzr # pylint: disable=duplicate-code @@ -219,17 +218,6 @@ def test_check_url_valid(self): 'user.name@example.com:/path/to/remote/repo', ] }, - { - 'obj' : Bzr(self.cli, self.tasks), - 'urls' : [ - 'http://example.com', - 'https://example.com', - 'ftp://example.com', - 'aftp://example.com', - 'bzr://example.com', - 'lp://example.com', - ] - }, { 'obj' : Hg(self.cli, self.tasks), 'urls' : [ @@ -259,8 +247,6 @@ def test_check_url_invalid(self): 'Xftp://example.com', 'Xftps://example.com', 'Xaftp://example.com', - 'Xbzr://example.com', - 'Xlp://example.com', 'Xgit://example.com', 'Xssh://example.com', 'Xsvn://example.com', @@ -271,7 +257,6 @@ def test_check_url_invalid(self): scms = [ Git(self.cli, self.tasks), - Bzr(self.cli, self.tasks), Hg(self.cli, self.tasks), Svn(self.cli, self.tasks), ] diff --git a/tests/utils.py b/tests/utils.py index 856163e0..3a9ad41e 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -90,9 +90,6 @@ def run_hg(repo, args): return run_scm('hg', repo, args) -def run_bzr(repo, args): - return run_scm('bzr', repo, args) - def file_write_legacy(fname, string, *args): '''function to write string to file python 2/3 compatible''' mode = 'w'