source: fix apt warnings

the source stage emitted the following output for each packages downloaded.
note the troubling warning at the end.

```
Reading package lists... Done
NOTICE: 'grep' packaging is maintained in the 'Git' version control system at:
https://salsa.debian.org/debian/grep.git
Please use:
git clone https://salsa.debian.org/debian/grep.git
to retrieve the latest (possibly unreleased) updates to the package.
Need to get 1579 kB of source archives.
Get:1 http://deb.debian.org/debian buster/main grep 3.3-1 (dsc) [2038 B]
Get:2 http://deb.debian.org/debian buster/main grep 3.3-1 (tar) [1473 kB]
Get:3 http://deb.debian.org/debian buster/main grep 3.3-1 (diff) [104 kB]
Fetched 1579 kB in 1s (1293 kB/s)
Download complete and in download only mode
W: Download is performed unsandboxed as root as file 'grep_3.3-1.dsc' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)
```

this occurred because the '_apt' user did not have permission to write to
the destination directory and so was falling back to downloading as root
in order to do its work.

prior to 158950b873 all source packages were
downloaded directly to the root of the chroot. that commit changed this to
save them into a new clean directory within it instead. thus to fix the
problem we can simply set the ownership of this new directory to '_apt'.

Gbp-Dch: Short
This commit is contained in:
Lyndon Brown 2020-03-10 17:51:24 +00:00
parent e3da1b6f8d
commit 744141c60f
1 changed files with 4 additions and 0 deletions

View File

@ -130,7 +130,11 @@ case "${LB_MODE}" in
;;
esac
# Make a clean directory to download the packages to.
# We need to set the ownership to user `_apt` to give write access to the apt user,
# otherwise we get a lot of warnings from apt about downloading as root.
mkdir -p chroot/source.pkgs
chown _apt:root chroot/source.pkgs
cat > chroot/missing-source.txt << EOF
This file contains the list of binary packages that are installed on the "live"