build: package: don't copy files that are in .gitignore (MR 2252)

This avoids copying local build artifacts and other things, if they're
in .gitignore then abuild shouldn't need them anyway.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-06-14 21:21:20 +02:00 committed by Oliver Smith
parent 19a54ee0d6
commit 91d29a1b2a
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -159,7 +159,12 @@ def override_source(apkbuild, pkgver, src, chroot: Chroot=Chroot.native()):
fetch() {
# Update source copy
msg "Copying source from host system: """ + src + """\"
rsync -a --exclude=".git/" --delete --ignore-errors --force \\
local exclude_from=\"""" + mount_path + """/.gitignore\"
local rsync_args=""
if [ -f "$exclude_from" ]; then
rsync_args="--exclude-from=\"$exclude_from\""
fi
rsync -a --exclude=".git/" $rsync_args --delete --ignore-errors --force \\
\"""" + mount_path + """\" "$_pmb_src_copy" || true
# Link local source files (e.g. kernel config)