On Wednesday, April 22, 2020 at 12:45:42 PM UTC+5:30, Henning Schild wrote:On Fri, 17 Apr 2020 15:00:31 +0530
Vijai Kumar K <vijaikumar...@gmail.com> wrote:
> 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_...@mentor.com>
> ---
> meta/classes/deb-dl-dir.bbclass | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/meta/classes/deb-dl-dir.bbclass
> b/meta/classes/deb-dl-dir.bbclass index 472b9fe..9399741 100644
> --- a/meta/classes/deb-dl-dir.bbclass
> +++ b/meta/classes/deb-dl-dir.bbclass
> @@ -32,6 +32,9 @@ EOSUDO
> if [ -z "${src}" ];then
> src="$( dpkg-deb --show --showformat '${Package}'
> "${package}" )" fi
> + # Strip epoch, if any, from version.
> + local dscfile=$(find "${DEBSRCDIR}"/"${rootfs_distro}" -name
> "${src}_${version#*:}.dsc")
Is that reliable, or might you end up exiting too early. You process
that "version" quite a bit, it needs to remain a unique identifier. So
you do not skip "foo-1.2.3_r1@deb~42" only because "foo-1.2.3" was
there. I made that up but such a version is allowed to have all sorts
of funny chars.
As per the Debian policy manual, version format is [epoch:]upstream_version[-debian_revision]
.
While downloading using apt-get source <source pkg>=<version>, I observed that epoch is needed
for downloading the source correctly. However the downloaded dsc file does not contain epoch. Hence
this stripping while checking for the presence of the corresponding dsc file.
Also, Debian policy manual[1] states that . +
-
~
(full stop, plus, hyphen, tilde) are the valid values
for use in upstream-version part and +
.
~
(plus, full stop, tilde) for debian-revision part.
So, this epoch stripping should be fine.
> + [ -z "$dscfile" ] || continue
I personally would say "-n" && continue, might be a matter of taste.
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}"