Skip to content

Commit ff0c001

Browse files
committed
Simplified method for picking out shared libraries from system package query result
1 parent 935f4f5 commit ff0c001

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

packaging/packager

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,41 +56,35 @@ if ! type zip > /dev/null 2>&1; then
5656
exit 1
5757
fi
5858

59-
function pluck_so_files() {
59+
function find_so_files() {
6060
sed -E '/\.so$|\.so\.[0-9]+$/!d'
6161
}
6262

6363
function package_libc_alpine() {
6464
if grep -F "Alpine Linux" < /etc/os-release > /dev/null; then
6565
if type apk > /dev/null 2>&1; then
66-
apk info --contents musl 2>/dev/null | pluck_so_files | sed 's/^/\//'
66+
apk info --contents musl 2>/dev/null | find_so_files | sed 's/^/\//'
6767
fi
6868
fi
6969
}
7070

7171
function package_libc_pacman() {
7272
if grep --extended-regexp "Arch Linux|Manjaro Linux" < /etc/os-release > /dev/null 2>&1; then
7373
if type pacman > /dev/null 2>&1; then
74-
pacman --query --list --quiet glibc | pluck_so_files
74+
pacman --query --list --quiet glibc | find_so_files
7575
fi
7676
fi
7777
}
7878

7979
function package_libc_dpkg() {
8080
if type dpkg-query > /dev/null 2>&1; then
81-
if [[ $(dpkg-query --listfiles libc6 | wc -l) -gt 0 ]]; then
82-
dpkg-query --listfiles libc6 | pluck_so_files
83-
fi
81+
dpkg-query --listfiles libc6 | find_so_files
8482
fi
8583
}
8684

8785
function package_libc_rpm() {
88-
arch=$(uname -m)
89-
9086
if type rpm > /dev/null 2>&1; then
91-
if [[ $(rpm --query --list glibc.$arch | wc -l) -gt 1 ]]; then
92-
rpm --query --list glibc.$arch | pluck_so_files
93-
fi
87+
rpm --query --list glibc.$(uname -m) | find_so_files
9488
fi
9589
}
9690

0 commit comments

Comments
 (0)