Skip to content
Snippets Groups Projects
Commit 8d11e9f4 authored by alice's avatar alice Committed by alice
Browse files

abuild: refactor duplicate python detection to not use find(1)

the previous implementation used -regex, which is subtly different between busybox and findutils

[0-9]\+ matches on busybox, but doesn't match with gnu findutils
[0-9]+ matches with findutils, but doesn't match on busybox

this means python deps were subtly broken when findutils was installed
(sometimes pulled via makedeps) vs not
parent 8f41a924
No related branches found
No related tags found
1 merge request!215abuild: refactor duplicate python detection to not use find(1)
Pipeline #167881 passed
......@@ -1705,20 +1705,25 @@ scan_symlink_targets() {
# check if python3 site packages are installed and depend on a compatible version
scan_python3_dependency() {
local controldir="$2" datadir="$3"
local site_pkg_dirs
if site_pkg_dirs="$(find "$datadir"/usr/lib/ -type d -regex '.*python3\.[0-9]\+/site-packages' -mindepth 2 -maxdepth 2 2>/dev/null)"; then
local pyver_count="$(echo "$site_pkg_dirs" | wc -l)"
if [ "$pyver_count" -gt 1 ]; then
local dir_count=0
local site_pkg_dir
for site_pkg_dir in "$datadir"/usr/lib/python3*/site-packages; do
if ! [ -d "$site_pkg_dir" ]; then
# empty iteration
continue
fi
dir_count=$((dir_count + 1))
if [ "$dir_count" -gt 1 ]; then
error "package contains python3 modules for conflicting python3 versions"
exit 1
return 1
fi
local pyver="${site_pkg_dirs##*usr/lib/python}"
local pyver="${site_pkg_dir##*usr/lib/python}"
pyver="${pyver%%/*}"
if [ -n "$pyver" ]; then
echo "python3~$pyver" \
>> "$controldir"/.python3-needs
fi
fi
done
}
#find pkg-config dependencies
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment