From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6739560601010307072 X-Received: by 2002:a1c:4945:: with SMTP id w66mr10836999wma.40.1569176238428; Sun, 22 Sep 2019 11:17:18 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:adf:b1ca:: with SMTP id r10ls3648712wra.6.gmail; Sun, 22 Sep 2019 11:17:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZxAW3oPXIkywy4F4OnsY3N5nUPQhwTdY2lqv3EtoJQmQkqsb1AIdhiFdcoW8TWvruOsHx X-Received: by 2002:a5d:4709:: with SMTP id y9mr8767009wrq.129.1569176238002; Sun, 22 Sep 2019 11:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569176237; cv=none; d=google.com; s=arc-20160816; b=tdXLgDzwa7ILdburM7WIGyaH5p4A7tEIqOzDHdAOh4JJlzP3cmg7Jv3gi6OxOJv1bC cecQGit6HveNHxOXKgZhT+AxJriwb5Fpmq25LoIdR5EsTEKst7Dye5cip0Zd1wq3VV2D kN7emvFOJxcEOYd0lDJTU7gSgeCrksEOhkrNYMzGPCptHcTfq3FwxKxh0kVmhW5N+aoN U3ErItx9zw11yXG2m5Q4uqMfxCvSofioT0rOFd+E3/ExpHVaLOdTtggRNspEeJaAsHex GhbAkObIs4q1mQvfGBtePOiCj5DfxtroFDCyk+BBfJ4GgVI4SSdIDzyUDEEBvzq8gFIJ SBFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:references:in-reply-to:message-id:date :subject:to:from; bh=CogSv1OsG4AdDd3w4mQtqR8JI8K3VOZiOi+aQf2t8Bg=; b=iG0+rTpdS856+SlS2gaxeRLuPjn8dOyr87CQ+PW33tTAprT1VYX5DTe53R3/uK6qNi qQ46FS/lXwjvO5mDt1Jm7gpqZMUG9aAM/tACynY2oaDqe6sjn3ogf7w6CXtGeKVZy2c9 JT6o08sGWUJvBFWa9plR/lBEdRp5KtzRm7CzgmVdpVNJEMys9ZNJOApOLA8uU1qgEoh6 dT1SP/TD4qjee0mDH0e4nt6+biAnDV74P5umV3CsOimQryzO3OLZzlZie4vcX3x6FbY+ 5ebERwqbD7pXqJ4BwnxXjPXFR2KrZgWkVfVQNJ6dxnWpkceUPHqglJYJjzc2bl3AdBUT lBfQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id q137si822160wme.3.2019.09.22.11.17.17 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Sep 2019 11:17:17 -0700 (PDT) Received-SPF: pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of jan.kiszka@siemens.com designates 192.35.17.28 as permitted sender) smtp.mailfrom=jan.kiszka@siemens.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=siemens.com Received: from mail1.sbs.de (mail1.sbs.de [192.129.41.35]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id x8MIHHJ2030623 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Sun, 22 Sep 2019 20:17:17 +0200 Received: from md1f2u6c.ad001.siemens.net ([139.22.37.1]) by mail1.sbs.de (8.15.2/8.15.2) with ESMTP id x8MIHB9E005761 for ; Sun, 22 Sep 2019 20:17:17 +0200 From: Jan Kiszka To: isar-users Subject: [PATCH v5 26/27] dpkg-base: Add devshell target Date: Sun, 22 Sep 2019 20:17:10 +0200 Message-Id: <131a167d16d26513f9b92197d72b4129ee8e050b.1569176231.git.jan.kiszka@siemens.com> X-Mailer: git-send-email 2.16.4 In-Reply-To: References: In-Reply-To: References: X-TUID: o8dyR/witIRq From: Jan Kiszka Using the imported OE core services, this adds devshell support for dpkg package builds. The target is put after do_install_builddeps where available, otherwise do_prepare_build. Signed-off-by: Jan Kiszka --- doc/user_manual.md | 8 ++++++++ meta/classes/dpkg-base.bbclass | 26 +++++++++++++++++++++++++- meta/classes/dpkg.bbclass | 2 ++ meta/recipes-kernel/linux/linux-custom.inc | 2 ++ 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/doc/user_manual.md b/doc/user_manual.md index 47f0dd5..c2657da 100644 --- a/doc/user_manual.md +++ b/doc/user_manual.md @@ -682,6 +682,14 @@ Debian cross-compilation works out of the box starting from Debian stretch distr - qemuarm64-buster (for host >= buster) +## Examining and debugging package generation inside their buildchroot + +Just like OpenEmbedded, Isar supports a devshell target for all dpkg package +recipes. This target opens a terminal inside the buildchroot that runs the +package build. To invoke it, just call +`bitbake multiconfig:${MACHINE}-${DISTRO}: -c devshell`. + + ## Create an ISAR SDK root filesystem ### Motivation diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass index fa904b8..2e8a0d1 100644 --- a/meta/classes/dpkg-base.bbclass +++ b/meta/classes/dpkg-base.bbclass @@ -1,10 +1,11 @@ # This software is a part of ISAR. -# Copyright (C) 2017-2018 Siemens AG +# Copyright (C) 2017-2019 Siemens AG # # SPDX-License-Identifier: MIT inherit buildchroot inherit debianize +inherit terminal DEPENDS ?= "" @@ -136,3 +137,26 @@ addtask deploy_deb after do_dpkg_build before do_build do_deploy_deb[lockfiles] = "${REPO_ISAR_DIR}/isar.lock" do_deploy_deb[depends] = "isar-apt:do_cache_config" do_deploy_deb[dirs] = "${S}" + +python do_devshell() { + import sys + + oe_lib_path = os.path.join(d.getVar('LAYERDIR_core'), 'lib') + sys.path.insert(0, oe_lib_path) + + bb.build.exec_func('dpkg_do_mounts', d); + + bb.utils.export_proxies(d) + + buildchroot = d.getVar('BUILDCHROOT_DIR') + pp_pps = os.path.join(d.getVar('PP'), d.getVar('PPS')) + termcmd = "sudo -E chroot {0} sh -c 'cd {1}; $SHELL -i'" + oe_terminal(termcmd.format(buildchroot, pp_pps), "Isar devshell", d) + + bb.build.exec_func('dpkg_undo_mounts', d); +} + +addtask devshell after do_prepare_build +DEVSHELL_STARTDIR ?= "${S}" +do_devshell[dirs] = "${DEVSHELL_STARTDIR}" +do_devshell[nostamp] = "1" diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass index f5396cb..19d77a2 100644 --- a/meta/classes/dpkg.bbclass +++ b/meta/classes/dpkg.bbclass @@ -15,6 +15,8 @@ addtask install_builddeps after do_prepare_build before do_dpkg_build # apt and reprepro may not run in parallel, acquire the Isar lock do_install_builddeps[lockfiles] += "${REPO_ISAR_DIR}/isar.lock" +addtask devshell after do_install_builddeps + # Build package from sources using build script dpkg_runbuild() { E="${@ bb.utils.export_proxies(d)}" diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc index e75eed1..8ff3836 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc +++ b/meta/recipes-kernel/linux/linux-custom.inc @@ -47,6 +47,8 @@ addtask install_builddeps after do_prepare_build before do_dpkg_build # apt and reprepro may not run in parallel, acquire the Isar lock do_install_builddeps[lockfiles] += "${REPO_ISAR_DIR}/isar.lock" +addtask devshell after do_install_builddeps + dpkg_runbuild() { chmod +x ${WORKDIR}/build-kernel.sh if [ -n "${KERNEL_DEFCONFIG}" ]; then -- 2.16.4