From: Anton Mikanovich <amikan@ilbers.de>
To: isar-users@googlegroups.com
Cc: Anton Mikanovich <amikan@ilbers.de>
Subject: [PATCH 3/5] meta: Implement two stage build
Date: Fri, 15 Sep 2023 21:54:37 +0300 [thread overview]
Message-ID: <20230915185439.2954192-4-amikan@ilbers.de> (raw)
In-Reply-To: <20230915185439.2954192-1-amikan@ilbers.de>
Split package build into two stages: building source package and
building binary package. This allows to obtain Debian package
dependencies before any build steps will actually start.
Signed-off-by: Anton Mikanovich <amikan@ilbers.de>
---
meta/classes/dpkg-gbp.bbclass | 2 +-
meta/classes/dpkg-source.bbclass | 33 ++++++++++++++++++++++
meta/classes/dpkg.bbclass | 4 +--
meta/classes/rootfs.bbclass | 2 ++
meta/recipes-kernel/linux/linux-custom.inc | 2 +-
5 files changed, 38 insertions(+), 5 deletions(-)
create mode 100644 meta/classes/dpkg-source.bbclass
diff --git a/meta/classes/dpkg-gbp.bbclass b/meta/classes/dpkg-gbp.bbclass
index 2bd09eaa..a151ade2 100644
--- a/meta/classes/dpkg-gbp.bbclass
+++ b/meta/classes/dpkg-gbp.bbclass
@@ -11,7 +11,7 @@ PATCHTOOL ?= "git"
GBP_EXTRA_OPTIONS ?= "--git-pristine-tar"
-dpkg_runbuild:prepend() {
+do_dpkg_source:prepend() {
sh -c "
cd ${WORKDIR}/${PPS}
gbp buildpackage --git-ignore-new --git-builder=/bin/true ${GBP_EXTRA_OPTIONS}
diff --git a/meta/classes/dpkg-source.bbclass b/meta/classes/dpkg-source.bbclass
new file mode 100644
index 00000000..434f1752
--- /dev/null
+++ b/meta/classes/dpkg-source.bbclass
@@ -0,0 +1,33 @@
+# This software is a part of ISAR.
+# Copyright (C) 2023 ilbers GmbH
+#
+# SPDX-License-Identifier: MIT
+
+inherit dpkg-base
+
+do_dpkg_source() {
+ # Create a .dsc file from source directory to use it with sbuild
+ DEB_SOURCE_NAME=$(dpkg-parsechangelog --show-field Source --file ${WORKDIR}/${PPS}/debian/changelog)
+ find ${WORKDIR} -name "${DEB_SOURCE_NAME}*.dsc" -maxdepth 1 -delete
+ if [ ! -z "${SOURCE_DATE_EPOCH}" ]; then
+ export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH}"
+ fi
+ sh -c "cd ${WORKDIR}; dpkg-source -I -b ${PPS}"
+}
+addtask dpkg_source after do_prepare_build before do_dpkg_build
+
+do_deploy_source[depends] += "isar-apt:do_cache_config"
+do_deploy_source[lockfiles] = "${REPO_ISAR_DIR}/isar.lock"
+do_deploy_source[dirs] = "${S}"
+do_deploy_source() {
+ repo_del_srcpackage "${REPO_ISAR_DIR}"/"${DISTRO}" \
+ "${REPO_ISAR_DB_DIR}"/"${DISTRO}" "${DEBDISTRONAME}" "${BPN}"
+ find "${S}/../" -name '*\.dsc' -maxdepth 1 | while read package; do
+ repo_add_srcpackage "${REPO_ISAR_DIR}"/"${DISTRO}" \
+ "${REPO_ISAR_DB_DIR}"/"${DISTRO}" \
+ "${DEBDISTRONAME}" \
+ "${package}"
+ done
+}
+addtask deploy_source after do_dpkg_source before do_dpkg_build
+
diff --git a/meta/classes/dpkg.bbclass b/meta/classes/dpkg.bbclass
index 90d717ca..2bb167e4 100644
--- a/meta/classes/dpkg.bbclass
+++ b/meta/classes/dpkg.bbclass
@@ -2,6 +2,7 @@
# Copyright (C) 2015-2018 ilbers GmbH
inherit dpkg-base
+inherit dpkg-source
PACKAGE_ARCH ?= "${DISTRO_ARCH}"
@@ -95,10 +96,7 @@ dpkg_runbuild() {
echo '$apt_keep_downloaded_packages = 1;' >> ${SBUILD_CONFIG}
- # Create a .dsc file from source directory to use it with sbuild
DEB_SOURCE_NAME=$(dpkg-parsechangelog --show-field Source --file ${WORKDIR}/${PPS}/debian/changelog)
- find ${WORKDIR} -name "${DEB_SOURCE_NAME}*.dsc" -maxdepth 1 -delete
- sh -c "cd ${WORKDIR}; dpkg-source -q -b ${PPS}"
DSC_FILE=$(find ${WORKDIR} -name "${DEB_SOURCE_NAME}*.dsc" -maxdepth 1 -print)
sbuild -A -n -c ${SBUILD_CHROOT} --extra-repository="${ISAR_APT_REPO}" \
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 7dec7b36..65574a6c 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -90,6 +90,8 @@ rootfs_configure_isar_apt() {
mkdir -p '${ROOTFSDIR}/etc/apt/sources.list.d'
echo 'deb [trusted=yes] file:///isar-apt ${DEBDISTRONAME} main' > \
'${ROOTFSDIR}/etc/apt/sources.list.d/isar-apt.list'
+ echo 'deb-src [trusted=yes] file:///isar-apt ${DEBDISTRONAME} main' >> \
+ '${ROOTFSDIR}/etc/apt/sources.list.d/isar-apt.list'
mkdir -p '${ROOTFSDIR}/etc/apt/preferences.d'
cat << EOF > '${ROOTFSDIR}/etc/apt/preferences.d/isar-apt'
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 8b367a2f..fa5d957d 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -212,6 +212,6 @@ EOF
fi
}
-dpkg_runbuild:prepend() {
+do_dpkg_source:prepend() {
dpkg_configure_kernel
}
--
2.34.1
next prev parent reply other threads:[~2023-09-15 18:54 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 18:54 [PATCH 0/5] Separate prebuild activities Anton Mikanovich
2023-09-15 18:54 ` [PATCH 1/5] repository: Add source package remove function Anton Mikanovich
2023-09-15 18:54 ` [PATCH 2/5] dpkg: Limit dsc searching by workdir Anton Mikanovich
2023-09-15 18:54 ` Anton Mikanovich [this message]
2023-10-12 8:48 ` [PATCH 3/5] meta: Implement two stage build Jan Kiszka
2023-10-12 9:07 ` Anton Mikanovich
2023-10-12 11:12 ` Jan Kiszka
2023-10-12 14:39 ` Baurzhan Ismagulov
2023-10-12 14:53 ` Jan Kiszka
2023-10-12 15:20 ` Baurzhan Ismagulov
2023-10-12 9:15 ` Jan Kiszka
2023-09-15 18:54 ` [PATCH 4/5] dpkg-base: Copy isar_apt to workdir in separate task Anton Mikanovich
2023-09-15 18:54 ` [PATCH 5/5] RECIPE-API-CHANGELOG.md: Note tasks separation Anton Mikanovich
2023-09-21 13:45 ` [PATCH 0/5] Separate prebuild activities Anton Mikanovich
2023-09-29 6:43 ` Uladzimir Bely
2023-10-30 4:44 ` MOESSBAUER, Felix
2023-10-30 8:00 ` Schmidt, Adriaan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230915185439.2954192-4-amikan@ilbers.de \
--to=amikan@ilbers.de \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox