I have a local patch doing just that, I can post something as RFC

On Monday, February 11, 2019 at 10:35:30 AM UTC+1, Henning Schild wrote:
Here i see an often repeating pattern. That "apt-get update" is now
present in many entry points to the buildchroot.
I guess we should factor it out and put it into a central place. And
the rule of thumb probably is ... whenever you use anything apt,
apt-get update before you do ...

Henning

Am Mon, 11 Feb 2019 10:33:24 +0100
schrieb Henning Schild <henning...@siemens.com>:

> From: Henning Schild <henning...@siemens.com>
>
> When rebuilding we can run into an inconsistent view where buildchroot
> assumes it could download the sources of a modified upstream package.
> After a "reprepro ... remove" we always need to "apt-get update" to
> not operate on an old version of the metadata.
>
> Signed-off-by: Henning Schild <henning...@siemens.com>
> ---
>  meta/classes/dpkg-base.bbclass | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/meta/classes/dpkg-base.bbclass
> b/meta/classes/dpkg-base.bbclass index 175dc80..5425df8 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -31,6 +31,10 @@ do_apt_fetch() {
>          fi
>          dpkg_do_mounts
>          E="${@ bb.utils.export_proxies(d)}"
> +        sudo -E chroot ${BUILDCHROOT_DIR} /usr/bin/apt-get update \
> +                -o
> Dir::Etc::sourcelist="sources.list.d/isar-apt.list" \
> +                -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 source ${SRC_APT}'
>          dpkg_undo_mounts