Avoid use of breezy-debian.

This commit is contained in:
Jelmer Vernooij 2021-02-10 01:54:29 +00:00
parent dc29ed8b1d
commit 3fe7cb2a7e
No known key found for this signature in database
GPG key ID: 579C160D4C9E23E8
6 changed files with 55 additions and 31 deletions

View file

@ -20,13 +20,12 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip flake8 cython
mkdir -p $HOME/.config/breezy/plugins
bzr branch lp:brz-debian $HOME/.config/breezy/plugins/debian
python -m pip install --upgrade pip flake8 cython mypy
python setup.py develop
- name: Style checks
run: |
python -m flake8
python -m mypy
- name: Typing checks
run: |
pip install -U mypy

View file

@ -21,7 +21,7 @@ from typing import List
import apt_pkg
import os
from buildlog_consultant.sbuild import (
from buildlog_consultant.apt import (
find_apt_get_failure,
)

View file

@ -34,10 +34,6 @@ from debian.changelog import Changelog
from debmutate.changelog import get_maintainer, format_datetime
from breezy import osutils
from breezy.plugins.debian.util import (
changes_filename,
get_build_architecture,
)
from breezy.mutabletree import MutableTree
from silver_platter.debian import (
BuildFailedError,
@ -57,6 +53,22 @@ class MissingChangesFile(Exception):
self.filename = filename
def changes_filename(package, version, arch):
non_epoch_version = version.upstream_version
if version.debian_version is not None:
non_epoch_version += "-%s" % version.debian_version
return "%s_%s_%s.changes" % (package, non_epoch_version, arch)
def get_build_architecture():
try:
return subprocess.check_output(
['dpkg-architecture', '-qDEB_BUILD_ARCH']).strip().decode()
except subprocess.CalledProcessError as e:
raise Exception(
"Could not find the build architecture: %s" % e)
def add_dummy_changelog_entry(
tree: MutableTree, subpath: str, suffix: str, suite: str,
message: str, timestamp=None, maintainer=None):

View file

@ -66,7 +66,6 @@ from silver_platter.debian import (
DEFAULT_BUILDER,
)
from breezy.plugins.debian.util import get_build_architecture
from .build import attempt_build
from buildlog_consultant import Problem
from buildlog_consultant.common import (

View file

@ -28,17 +28,8 @@ from debian.deb822 import Deb822
from breezy.tree import Tree
from breezy.workingtree import WorkingTree
from breezy.plugins.debian.repack_tarball import get_filetype
from . import apt, DetailedFailure, shebang_binary
from . import DetailedFailure
from .buildsystem import detect_buildsystems, NoBuildToolsFound
from .session import run_with_tee, Session
from .session.schroot import SchrootSession
from .debian.fix_build import (
DependencyContext,
resolve_error,
APT_FIXERS,
)
from buildlog_consultant.common import (
find_build_failure_description,
Problem,
@ -47,12 +38,29 @@ from buildlog_consultant.common import (
NoSpaceOnDevice,
)
from . import DetailedFailure
from .buildsystem import detect_buildsystems, NoBuildToolsFound
from .session.schroot import SchrootSession
from .vcs import dupe_vcs_tree, export_vcs_tree
SUPPORTED_DIST_EXTENSIONS = [
".tar.gz",
".tgz",
".tar.bz2",
".tar.xz",
".tar.lzma",
".tbz2",
".tar",
".zip",
]
def is_dist_file(fn):
for ext in SUPPORTED_DIST_EXTENSIONS:
if fn.endswith(ext):
return True
return False
class DistNoTarball(Exception):
"""Dist operation did not create a tarball."""
@ -83,18 +91,16 @@ class DistCatcher(object):
def find_files(self):
new_files = os.listdir(self.export_directory)
diff_files = set(new_files) - set(self.existing_files)
diff = set([n for n in diff_files if get_filetype(n) is not None])
diff = set([n for n in diff_files if is_dist_file(n)])
if len(diff) == 1:
fn = diff.pop()
logging.info('Found tarball %s in package directory.', fn)
self.files.append(os.path.join(self.export_directory, fn))
return fn
if 'dist' in diff_files:
for entry in os.scandir(
os.path.join(self.export_directory, 'dist')):
if get_filetype(entry.name) is not None:
logging.info(
'Found tarball %s in dist directory.', entry.name)
if "dist" in diff_files:
for entry in os.scandir(os.path.join(self.export_directory, "dist")):
if is_dist_file(entry.name):
logging.info("Found tarball %s in dist directory.", entry.name)
self.files.append(entry.path)
return entry.name
logging.info('No tarballs found in dist directory.')

View file

@ -16,9 +16,9 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import datetime
from ..debian.build import add_dummy_changelog_entry
from ..debian.build import add_dummy_changelog_entry, get_build_architecture
from breezy.tests import TestCaseWithTransport
from breezy.tests import TestCaseWithTransport, TestCase
class AddDummyChangelogEntryTests(TestCaseWithTransport):
@ -105,4 +105,12 @@ janitor (0.1-1jan+some1) UNRELEASED; urgency=medium
* Initial release. (Closes: #XXXXXX)
-- Jelmer Vernooij <jelmer@debian.org> Sat, 04 Apr 2020 14:12:13 +0000
""", 'debian/changelog')
""",
"debian/changelog",
)
class BuildArchitectureTests(TestCase):
def test_is_str(self):
self.assertIsInstance(get_build_architecture(), str)