Support packaging subpath in create_dist_schroot.

This commit is contained in:
Jelmer Vernooij 2021-03-22 04:59:54 +00:00
parent b9da3cb223
commit 41d7d44b57
3 changed files with 10 additions and 10 deletions

View file

@ -31,6 +31,8 @@ class DetailedFailure(Exception):
class UnidentifiedError(Exception): class UnidentifiedError(Exception):
"""An unidentified error."""
def __init__(self, retcode, argv, lines, secondary=None): def __init__(self, retcode, argv, lines, secondary=None):
self.retcode = retcode self.retcode = retcode
self.argv = argv self.argv = argv

View file

@ -15,14 +15,14 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
import os
from debian.deb822 import Deb822 from debian.deb822 import Deb822
from ..session import Session from ..session import Session
# TODO(jelmer): move this to debian/ def satisfy_build_deps(session: Session, tree, debian_path):
def satisfy_build_deps(session: Session, tree): source = Deb822(tree.get_file(os.path.join(debian_path, "control")))
source = Deb822(tree.get_file("debian/control"))
deps = [] deps = []
for name in ["Build-Depends", "Build-Depends-Indep", "Build-Depends-Arch"]: for name in ["Build-Depends", "Build-Depends-Indep", "Build-Depends-Arch"]:
try: try:

View file

@ -141,7 +141,6 @@ def create_dist(
session: Session, session: Session,
tree: Tree, tree: Tree,
target_dir: str, target_dir: str,
packaging_tree: Optional[Tree] = None,
include_controldir: bool = True, include_controldir: bool = True,
subdir: Optional[str] = None, subdir: Optional[str] = None,
cleanup: bool = False cleanup: bool = False
@ -151,11 +150,6 @@ def create_dist(
if subdir is None: if subdir is None:
subdir = "package" subdir = "package"
if packaging_tree is not None:
from .debian import satisfy_build_deps
satisfy_build_deps(session, packaging_tree)
try: try:
export_directory, reldir = session.setup_from_vcs( export_directory, reldir = session.setup_from_vcs(
tree, include_controldir=include_controldir, subdir=subdir) tree, include_controldir=include_controldir, subdir=subdir)
@ -189,14 +183,18 @@ def create_dist_schroot(
target_dir: str, target_dir: str,
chroot: str, chroot: str,
packaging_tree: Optional[Tree] = None, packaging_tree: Optional[Tree] = None,
packaging_subpath: Optional[str] = None,
include_controldir: bool = True, include_controldir: bool = True,
subdir: Optional[str] = None, subdir: Optional[str] = None,
cleanup: bool = False cleanup: bool = False
) -> Optional[str]: ) -> Optional[str]:
with SchrootSession(chroot) as session: with SchrootSession(chroot) as session:
if packaging_tree is not None:
from .debian import satisfy_build_deps
satisfy_build_deps(session, packaging_tree, packaging_subpath)
return create_dist( return create_dist(
session, tree, target_dir, session, tree, target_dir,
packaging_tree=packaging_tree,
include_controldir=include_controldir, include_controldir=include_controldir,
subdir=subdir, subdir=subdir,
cleanup=cleanup) cleanup=cleanup)