mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2025-03-11 06:37:31 +00:00
abuild: prune python cache dirs by default
these will be generated post-install in a hook. ref https://gitlab.alpinelinux.org/alpine/aports/-/issues/11906
This commit is contained in:
parent
ddc6f42ddc
commit
489fc06e40
@ -790,6 +790,15 @@ postcheck() {
|
|||||||
find "$dir" -name '*.la' -type f -delete
|
find "$dir" -name '*.la' -type f -delete
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# remove all python .pyc cache unless intentionally kept
|
||||||
|
if ! options_has "keeppycache"; then
|
||||||
|
# wildcard should always get the system python dir, and this is faster than
|
||||||
|
# trying to calculate the python version.
|
||||||
|
find "$dir"/usr/lib/python* \
|
||||||
|
\( -type d -a -name "__pycache__" \) \
|
||||||
|
-exec rm -r {} +
|
||||||
|
fi
|
||||||
|
|
||||||
# look for /usr/lib/charset.alias
|
# look for /usr/lib/charset.alias
|
||||||
if [ -e "$dir"/usr/lib/charset.alias ] \
|
if [ -e "$dir"/usr/lib/charset.alias ] \
|
||||||
&& ! options_has "charset.alias"; then
|
&& ! options_has "charset.alias"; then
|
||||||
|
@ -33,7 +33,8 @@ init_tests \
|
|||||||
abuild_devhelp \
|
abuild_devhelp \
|
||||||
abuild_check_maintainer \
|
abuild_check_maintainer \
|
||||||
abuild_cleanoldpkg \
|
abuild_cleanoldpkg \
|
||||||
abuild_path_with_spaces
|
abuild_path_with_spaces \
|
||||||
|
abuild_pycache
|
||||||
|
|
||||||
export ABUILD_SHAREDIR=$(atf_get_srcdir)/..
|
export ABUILD_SHAREDIR=$(atf_get_srcdir)/..
|
||||||
export ABUILD_CONF=/dev/null
|
export ABUILD_CONF=/dev/null
|
||||||
@ -824,3 +825,54 @@ abuild_path_with_spaces_body() {
|
|||||||
-e match:"Build complete" \
|
-e match:"Build complete" \
|
||||||
abuild
|
abuild
|
||||||
}
|
}
|
||||||
|
|
||||||
|
abuild_pycache_body() {
|
||||||
|
init_keys
|
||||||
|
|
||||||
|
mkdir -p pycachetest
|
||||||
|
cd pycachetest
|
||||||
|
|
||||||
|
cat >APKBUILD <<-EOF
|
||||||
|
# Maintainer: Joe User <juser@example.com>
|
||||||
|
pkgname="pycachetest"
|
||||||
|
pkgver="1.0"
|
||||||
|
pkgrel=0
|
||||||
|
pkgdesc="Dummy test package"
|
||||||
|
url="https://gitlab.alpinelinux.org/alpine/aports"
|
||||||
|
arch="noarch"
|
||||||
|
license="MIT"
|
||||||
|
source=""
|
||||||
|
prepare() {
|
||||||
|
mkdir -p "\$builddir"
|
||||||
|
}
|
||||||
|
|
||||||
|
check() {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
mkdir -p "\$pkgdir"/usr/lib/python3.11/site-packages/test/__pycache__/
|
||||||
|
touch "\$pkgdir"/usr/lib/python3.11/site-packages/test/__pycache__/main.cpython-311.pyc
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
|
||||||
|
abuild clean unpack prepare build rootpkg
|
||||||
|
|
||||||
|
if [ -e pkg/pycachetest/usr/lib/python3.11/site-packages/test/__pycache__/main.cpython-311.pyc ]; then
|
||||||
|
atf_fail ".pyc was not deleted"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -e pkg/pycachetest/usr/lib/python3.11/site-packages/test/__pycache__ ]; then
|
||||||
|
atf_fail "__pycache__ dir was not deleted"
|
||||||
|
fi
|
||||||
|
|
||||||
|
options="keeppycache" abuild clean unpack prepare build rootpkg
|
||||||
|
|
||||||
|
if ! [ -e pkg/pycachetest/usr/lib/python3.11/site-packages/test/__pycache__/main.cpython-311.pyc ]; then
|
||||||
|
atf_fail ".pyc was deleted but shouldn't have been"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -e pkg/pycachetest/usr/lib/python3.11/site-packages/test/__pycache__ ]; then
|
||||||
|
atf_fail "__pycache__ dir was deleted but shouldn't have been"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user