From f550b1ba9a507f91fb29f00dc5762ae74afb41a7 Mon Sep 17 00:00:00 2001 From: Helmut Grohne Date: Sun, 16 May 2021 14:05:40 +0200 Subject: mmdebstrap: reorder source unpack vs build-dep By doing the unpack before the satisfying build dependencies, we can point apt at the extracted source package and stop talking about the .dsc file. It also means that we can clean those artifacts earlier. --- mdbp/mmdebstrap.py | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/mdbp/mmdebstrap.py b/mdbp/mmdebstrap.py index de855f6..d1e13f4 100644 --- a/mdbp/mmdebstrap.py +++ b/mdbp/mmdebstrap.py @@ -83,31 +83,31 @@ def main() -> None: tempfile.NamedTemporaryFile("w+") as script: dscfiles = [dscpath] + get_dsc_files(dscpath) - script.write("#!/bin/sh\nset -u\nset -e\n") - script.write("%s\n" % priv_drop(["chown", "-R", "build:build", - str(buildpath.parent)], - chroot=True)) + script.write("#!/bin/sh\nset -u\nset -e\n%s\n%s\n%s\n" % ( + priv_drop(["chown", "-R", "build:build", "."], + chroot=True, chdir=buildpath.parent), + priv_drop(["dpkg-source", "--no-check", "--extract", dscpath.name, + buildpath.name], + setuid="build", chroot=True, chdir=buildpath.parent), + priv_drop(["rm", *(f.name for f in dscfiles)], + chroot=True, chdir=buildpath.parent))) cmd = ["apt-get", "build-dep", "--yes", - "--host-architecture", hostarch] - cmd.extend(dict(any=["--arch-only"], - all=["--indep-only"]).get(build.get("type"), [])) - cmd.extend(profile_option(build, "--build-profiles")) - cmd.append(str(buildpath.parent / dscpath.name)) + "--host-architecture", hostarch, + *dict(any=["--arch-only"], + all=["--indep-only"]).get(build.get("type"), ()), + *profile_option(build, "--build-profiles"), + "./"] if build.get("bd-uninstallable-explainer") == "apt" and enablelog: - script.write("if ! %s\nthen\n" % priv_drop(cmd, chroot=True)) + script.write("if ! %s\nthen\n" % priv_drop(cmd, chroot=True, + chdir=buildpath)) cmd[-1:-1] = ['-oDebug::pkgProblemResolver=true', '-oDebug::pkgDepCache::Marker=1', '-oDebug::pkgDepCache::AutoInstall=1', '-oDebug::BuildDeps=1'] - script.write("%s\nfi\n" % priv_drop(cmd, chroot=True)) + script.write("%s\nfi\n" % priv_drop(cmd, chroot=True, + chdir=buildpath)) else: - script.write("%s\n" % priv_drop(cmd, chroot=True)) - script.write("%s\n" % priv_drop( - ["dpkg-source", "--no-check", "--extract", dscpath.name, - buildpath.name], - setuid="build", chroot=True, chdir=buildpath.parent)) - script.write("%s\n" % priv_drop(["rm"] + [f.name for f in dscfiles], - chroot=True, chdir=buildpath.parent)) + script.write("%s\n" % priv_drop(cmd, chroot=True, chdir=buildpath)) cmd = ["dpkg-buildpackage", "-uc", "--host-arch=" + hostarch, "--build=" + build.get("type", "binary")] cmd.extend(profile_option(build, "--build-profiles=")) -- cgit v1.2.3