From: Henning Schild <henning.schild@siemens.com>
To: Vijai Kumar K <vijaikumar.kanagarajan@gmail.com>
Cc: <isar-users@googlegroups.com>, <ibr@radix50.net>,
<jan.kiszka@siemens.com>,
Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
Subject: Re: [PATCH v5 03/13] meta: cache deb srcs as part of postprocessing
Date: Wed, 22 Apr 2020 09:06:39 +0200 [thread overview]
Message-ID: <20200422090639.645bf93b@md1za8fc.ad001.siemens.net> (raw)
In-Reply-To: <20200417093040.15130-4-Vijaikumar_Kanagarajan@mentor.com>
On Fri, 17 Apr 2020 15:00:30 +0530
Vijai Kumar K <vijaikumar.kanagarajan@gmail.com> wrote:
> Collect the deb sources of the corresponding deb binaries cached
> in DEBDIR as part of image postprocess.
>
> Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
> ---
> meta/classes/deb-dl-dir.bbclass | 39
> +++++++++++++++++++++++++++++++++ meta/classes/image.bbclass |
> 2 +- meta/classes/rootfs.bbclass | 8 +++++++
> 3 files changed, 48 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/deb-dl-dir.bbclass
> b/meta/classes/deb-dl-dir.bbclass index 29a3d67..472b9fe 100644
> --- a/meta/classes/deb-dl-dir.bbclass
> +++ b/meta/classes/deb-dl-dir.bbclass
> @@ -5,6 +5,45 @@
>
> inherit repository
>
> +debsrc_download() {
> + export rootfs="$1"
> + export rootfs_distro="$2"
> + mkdir -p "${DEBSRCDIR}"/"${rootfs_distro}"
> + ( flock 9
I think you can grab that lock only for the actual writes, and keep the
generation of the list out of the critical section.
Note that i played with this "flock 9" syntax instead of what is used in
deb-dl-dir, it did not work as expected. Probably because it will be
many shells and 9 is a different fd in all of them.
> + set -e
> + printenv | grep -q BB_VERBOSE_LOGS && set -x
> + sudo -E -s <<'EOSUDO'
> + mkdir -p "${rootfs}/deb-src"
> + mountpoint -q "${rootfs}/deb-src" || \
> + mount --bind "${DEBSRCDIR}" "${rootfs}/deb-src"
> +EOSUDO
> + find "${rootfs}/var/cache/apt/archives/" -maxdepth 1 -type f
> -iname '*\.deb' | while read package; do
> + local src="$( dpkg-deb --show --showformat '${Source}'
> "${package}" )"
> + # If the binary package version and source package version
> are different, then the
> + # source package version will be present inside "()" of the
> Source field.
dpkg-query(1)
dpkg-deb --show --showformat '${source:Version}'
dpkg-deb --show --showformat '${source:Upstream-Version}'
might help to write this cleaner.
> + local version="$( echo "$src" | cut -sd "(" -f2 | cut -sd
> ")" -f1 )"
> + if [ -z ${version} ]; then
> + version="$( dpkg-deb --show --showformat '${Version}'
> "${package}" )"
> + fi
> + # Now strip any version information that might be available.
> + src="$( echo "$src" | cut -d' ' -f1 )"
> + # If there is no source field, then the source package has
> the same name as the
> + # binary package.
> + if [ -z "${src}" ];then
> + src="$( dpkg-deb --show --showformat '${Package}'
> "${package}" )"
> + fi
I still could not find those proxies that all downloading functions
need in their env.
Henning
> + sudo -E chroot --userspec=$( id -u ):$( id -g ) ${rootfs} \
> + sh -c ' mkdir -p "/deb-src/${1}/${2}" && cd
> "/deb-src/${1}/${2}" && apt-get -y --download-only --only-source
> source "$2"="$3" ' download-src "${rootfs_distro}" "${src}"
> "${version}"
> + done
> + sudo -E -s <<'EOSUDO'
> + mountpoint -q "${rootfs}/deb-src" && \
> + umount -l "${rootfs}/deb-src"
> + rm -rf "${rootfs}/deb-src"
> +EOSUDO
> + ) 9>"${DEBSRCDIR}/${rootfs_distro}.lock"
> +}
> +
> deb_dl_dir_import() {
> export pc="${DEBDIR}/${2}"
> export rootfs="${1}"
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 6b04c0a..fcaebd6 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -63,7 +63,7 @@ image_do_mounts() {
> }
>
> ROOTFSDIR = "${IMAGE_ROOTFS}"
> -ROOTFS_FEATURES += "clean-package-cache generate-manifest"
> +ROOTFS_FEATURES += "clean-package-cache generate-manifest
> cach-deb-src" ROOTFS_PACKAGES += "${IMAGE_PREINSTALL}
> ${IMAGE_INSTALL}" ROOTFS_MANIFEST_DEPLOY_DIR ?= "${DEPLOY_DIR_IMAGE}"
>
> diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
> index cee358c..ee57989 100644
> --- a/meta/classes/rootfs.bbclass
> +++ b/meta/classes/rootfs.bbclass
> @@ -185,6 +185,14 @@ python do_rootfs_install() {
> }
> addtask rootfs_install before do_rootfs_postprocess after do_unpack
>
> +ROOTFS_POSTPROCESS_COMMAND +=
> "${@bb.utils.contains('ROOTFS_FEATURES', 'cache-deb-src',
> 'cache_deb_src', '', d)}" +cache_deb_src() {
> + rootfs_install_resolvconf
> + deb_dl_dir_import ${ROOTFSDIR} ${ROOTFS_DISTRO}
> + debsrc_download ${ROOTFSDIR} ${ROOTFS_DISTRO}
> + rootfs_install_clean_files
> +}
> +
> ROOTFS_POSTPROCESS_COMMAND +=
> "${@bb.utils.contains('ROOTFS_FEATURES', 'clean-package-cache',
> 'rootfs_postprocess_clean_package_cache', '', d)}"
> rootfs_postprocess_clean_package_cache() { sudo -E chroot
> '${ROOTFSDIR}' \
next prev parent reply other threads:[~2020-04-22 7:06 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-17 9:30 [PATCH v5 00/13] Deb-src caching implementation Vijai Kumar K
2020-04-17 9:30 ` [PATCH v5 01/13] rootfs: Make rootfs finalize a separate task Vijai Kumar K
2020-04-17 9:30 ` [PATCH v5 02/13] deb-dl-dir: Cache host distro debs separately Vijai Kumar K
2020-04-22 6:52 ` Henning Schild
2020-04-17 9:30 ` [PATCH v5 03/13] meta: cache deb srcs as part of postprocessing Vijai Kumar K
2020-04-22 7:06 ` Henning Schild [this message]
2020-04-22 9:57 ` vijai kumar
2020-04-29 6:19 ` Henning Schild
2020-05-04 8:42 ` vijai kumar
2020-05-08 5:44 ` vijai kumar
2020-06-11 11:44 ` vijai kumar
2020-09-03 11:43 ` vijaikumar....@gmail.com
2020-09-03 18:58 ` Henning Schild
2020-09-04 5:12 ` vijaikumar....@gmail.com
2020-04-22 7:28 ` Henning Schild
2020-04-22 10:35 ` vijai kumar
2020-04-17 9:30 ` [PATCH v5 04/13] deb-dl-dir: Make debsrc_download faster Vijai Kumar K
2020-04-22 7:15 ` Henning Schild
2020-04-22 10:11 ` vijai kumar
2020-04-29 7:05 ` Henning Schild
2020-04-17 9:30 ` [PATCH v5 05/13] deb-dl-dir: Download files only belonging to the current image Vijai Kumar K
2020-04-22 7:25 ` Henning Schild
2020-04-22 10:20 ` vijai kumar
2020-04-17 9:30 ` [PATCH v5 06/13] deb-dl-dir: Factor out the mounting part Vijai Kumar K
2020-04-17 9:30 ` [PATCH v5 07/13] deb-dl-dir: Fix skipping of removed files Vijai Kumar K
2020-04-17 9:30 ` [PATCH v5 08/13] repository: Add a sanity test to check missing sources Vijai Kumar K
2020-04-17 9:30 ` [PATCH v5 09/13] base-apt: Introduce BASE_REPO_FEATURES Vijai Kumar K
2020-04-17 9:30 ` [PATCH v5 10/13] repository: Fix failures due to missing section Vijai Kumar K
2020-04-17 9:30 ` [PATCH v5 11/13] scripts/ci_build.sh: Enable deb-src caching Vijai Kumar K
2020-04-17 9:30 ` [PATCH v5 12/13] rootfs: Fix possible overwrite of existing resolv.conf Vijai Kumar K
2020-04-17 9:30 ` [PATCH v5 13/13] rootfs: Handle failures when postprocess is rerun Vijai Kumar K
2020-04-17 14:21 ` [PATCH v5 00/13] Deb-src caching implementation vijai kumar
2020-04-22 7:41 ` Henning Schild
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=20200422090639.645bf93b@md1za8fc.ad001.siemens.net \
--to=henning.schild@siemens.com \
--cc=Vijaikumar_Kanagarajan@mentor.com \
--cc=ibr@radix50.net \
--cc=isar-users@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=vijaikumar.kanagarajan@gmail.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