diff --git a/ognibuild/debian/fix_build.py b/ognibuild/debian/fix_build.py index 4abf1c5..6dc7eb0 100644 --- a/ognibuild/debian/fix_build.py +++ b/ognibuild/debian/fix_build.py @@ -22,6 +22,7 @@ __all__ = [ from datetime import datetime import logging import os +import shutil import sys from typing import List, Set, Optional, Type, Tuple @@ -543,7 +544,9 @@ class PgBuildExtOutOfDateControlFixer(BuildFixer): def _fix(self, error, context): logging.info("Running 'pg_buildext updatecontrol'") self.session.check_call(["pg_buildext", "updatecontrol"]) - # TODO(jelmer): Copy control file back + shutil.copy( + self.session.external_path('debian/control'), + context.tree.abspath(os.path.join(context.subpath, 'debian/control'))) return commit_debian_changes( context.tree, context.subpath, @@ -744,6 +747,8 @@ def main(argv=None): args = parser.parse_args() from breezy.workingtree import WorkingTree + import breezy.git + import breezy.bzr from .apt import AptManager from ..session.plain import PlainSession from ..session.schroot import SchrootSession diff --git a/ognibuild/session/__init__.py b/ognibuild/session/__init__.py index 0908903..f9f0225 100644 --- a/ognibuild/session/__init__.py +++ b/ognibuild/session/__init__.py @@ -97,6 +97,9 @@ class Session(object): def setup_from_directory(self, path, subdir="package") -> Tuple[str, str]: raise NotImplementedError(self.setup_from_directory) + def external_path(self, path: str) -> str: + raise NotImplementedError + class SessionSetupFailure(Exception): """Session failed to be set up.""" diff --git a/ognibuild/session/plain.py b/ognibuild/session/plain.py index bec2ae8..a27631e 100644 --- a/ognibuild/session/plain.py +++ b/ognibuild/session/plain.py @@ -92,6 +92,9 @@ class PlainSession(Session): def chdir(self, path): os.chdir(path) + def external_path(self, path): + return os.path.abspath(path) + def setup_from_vcs( self, tree, include_controldir=None, subdir="package"): from ..vcs import dupe_vcs_tree, export_vcs_tree diff --git a/ognibuild/session/schroot.py b/ognibuild/session/schroot.py index 4026669..2faeeb6 100644 --- a/ognibuild/session/schroot.py +++ b/ognibuild/session/schroot.py @@ -177,17 +177,17 @@ class SchrootSession(Session): self.check_call(["mkdir", "-p", home], cwd="/", user="root") self.check_call(["chown", user, home], cwd="/", user="root") - def _fullpath(self, path: str) -> str: + def external_path(self, path: str) -> str: if self._cwd is None: raise ValueError("no cwd set") return os.path.join(self.location, os.path.join(self._cwd, path).lstrip("/")) def exists(self, path: str) -> bool: - fullpath = self._fullpath(path) + fullpath = self.external_path(path) return os.path.exists(fullpath) def scandir(self, path: str): - fullpath = self._fullpath(path) + fullpath = self.external_path(path) return os.scandir(fullpath) def setup_from_vcs(