Revert "abuild: prune python cache dirs by default"

This reverts commit 489fc06e40.

this needs way more thought to work, see
32f314f8076d509bd4c541b1d250b3744947867f in aports

we should probably just create *-pyc splits instead. these
won't reduce mirror size, but at least allow easily uninstalling the cache.
This commit is contained in:
psykose 2023-04-14 16:31:54 +02:00
parent 6321b957c1
commit af88d534d3
2 changed files with 1 additions and 62 deletions

View File

@ -790,15 +790,6 @@ postcheck() {
find "$dir" -name '*.la' -type f -delete
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
if [ -e "$dir"/usr/lib/charset.alias ] \
&& ! options_has "charset.alias"; then

View File

@ -33,8 +33,7 @@ init_tests \
abuild_devhelp \
abuild_check_maintainer \
abuild_cleanoldpkg \
abuild_path_with_spaces \
abuild_pycache
abuild_path_with_spaces
export ABUILD_SHAREDIR=$(atf_get_srcdir)/..
export ABUILD_CONF=/dev/null
@ -825,54 +824,3 @@ abuild_path_with_spaces_body() {
-e match:"Build complete" \
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
}