[v6,04/13] deb-dl-dir: Make debsrc_download faster

Message ID 20200930060707.12785-1-Vijaikumar_Kanagarajan@mentor.com
State Superseded, archived
Headers show
Series Deb-src caching | expand

Commit Message

Vijai Kumar K Sept. 29, 2020, 10:06 p.m. UTC
Eventhough apt-get source skips redownloading of files, it is still
slow and takes a lot of time. Instead, lookup if the dsc file is already
present in the cache and skip based on it.

Signed-off-by: Vijai Kumar K <Vijaikumar_Kanagarajan@mentor.com>
---
 meta/classes/deb-dl-dir.bbclass | 2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/meta/classes/deb-dl-dir.bbclass b/meta/classes/deb-dl-dir.bbclass
index 659fe4b..79a9a88 100644
--- a/meta/classes/deb-dl-dir.bbclass
+++ b/meta/classes/deb-dl-dir.bbclass
@@ -20,6 +20,8 @@  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}' "${package}" )"
         local version="$( dpkg-deb --show --showformat '${source:Version}' "${package}" )"
+        local dscfile=$(find "${DEBSRCDIR}"/"${rootfs_distro}" -name "${src}_${version}.dsc")
+        [ -n "$dscfile" ] && continue
 
         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}"