On Monday, December 16, 2019 at 5:20:15 PM UTC+5:30, Henning Schild wrote:From: Henning Schild <hennin...@siemens.com>
Store the results of "apt-get source" in the DL_DIR. This means we
really only need to fetch once on incremental rebuilds or if multiple
recipes use the same SRC_URI.
We can also later collect the results and put them in a repository.
Signed-off-by: Henning Schild <hennin...@siemens.com>
---
meta/classes/dpkg-base.bbclass | 20 ++++++++++++++++++--
meta/conf/bitbake.conf | 1 +
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index f38168c..7a97d91 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -63,14 +63,30 @@ do_apt_fetch() {
-o Dir::Etc::SourceParts="-" \
-o APT::Get::List-Cleanup="0"
- sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} \
- sh -c 'cd ${PP} && apt-get -y --only-source source ${SRC_APT}'
+ for uri in "${SRC_APT}"; do
+ sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} \
+ sh -c 'mkdir -p /downloads/deb-src/"$1"/"$2" && cd /downloads/deb-src/"$1"/"$2" && apt-get -y --download-only --only-source source "$2"' my_script "${DISTRO}" "${uri}"
+ sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} \
+ sh -c 'cp /downloads/deb-src/"$1"/"$2"/* ${PP} && cd ${PP} && apt-get -y --only-source source "$2"' my_script "${DISTRO}" "${uri}"
Hi Henning,
Thank you for the base-apt rework.
BTW. What does my_script do here?
Thanks,
Vijai Kumar K
+ done
+
dpkg_undo_mounts
}
addtask apt_fetch after do_unpack before do_patch
do_apt_fetch[lockfiles] += "${REPO_ISAR_DIR}/isar.lock"
+addtask cleanall_apt before do_cleanall
+do_cleanall_apt[nostamp] = "1"
+do_cleanall_apt() {
+ if [ -z "${@d.getVar("SRC_APT", True).strip()}" ]; then
+ exit
+ fi
+ for uri in "${SRC_APT}"; do
+ rm -rf "${DEBSRCDIR}"/"${DISTRO}"/"$uri"
+ done
+}
+
def get_package_srcdir(d):
s = os.path.abspath(d.getVar("S", True))
workdir = os.path.abspath(d.getVar("WORKDIR", True))
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 0eb3b54..ab608da 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -26,6 +26,7 @@ DEPLOY_DIR = "${TMPDIR}/deploy"
FILE_DIRNAME = "${@os.path.dirname(d.getVar('FILE', False))}"
FILESEXTRAPATHS ?= "__default:"
GITDIR = "${DL_DIR}/git"
+DEBSRCDIR = "${DL_DIR}/deb-src"
P = "${PN}-${PV}"
PF = "${PN}-${PV}-${PR}"
PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
--
2.24.1