update scripts/bin/update-whatprovides-db
also add reminder comment in packages/whatprovides/build.sh
This commit is contained in:
parent
c208332fcd
commit
80ff50d6bd
@ -9,6 +9,8 @@ TERMUX_PKG_DEPENDS="bash, coreutils, curl, gawk, gzip, sqlite"
|
||||
TERMUX_PKG_BUILD_IN_SRC=true
|
||||
TERMUX_PKG_PLATFORM_INDEPENDENT=true
|
||||
|
||||
# Remember to update ../../scripts/bin/update-whatprovides-db
|
||||
|
||||
termux_step_create_debscripts() {
|
||||
cat <<- EOF > ./postinst
|
||||
#!${TERMUX_PREFIX}/bin/sh
|
||||
|
@ -3,7 +3,7 @@
|
||||
## Script that generates or updates a Whatprovides
|
||||
## database for Termux.
|
||||
##
|
||||
## Copy of https://github.com/termux/whatprovides/blob/96a9fd100a84af1bf2fd3fbeedbaab082381f5e8/update-whatprovides-db.sh
|
||||
## Copy of https://github.com/termux/whatprovides/blob/8fdd508949e754e8ea758e8c1b3c063e41cce3f2/update-whatprovides-db.sh
|
||||
## but edited for special use in termux-packages.
|
||||
##
|
||||
|
||||
@ -12,9 +12,15 @@ set -e -u
|
||||
DEBS_DIR_PATH=$(realpath "$(dirname "$0")/../../debs")
|
||||
|
||||
list_files() {
|
||||
dpkg-deb --fsys-tarfile "${1}" | tar -t | cut -b2- \
|
||||
FILES=$(dpkg-deb --fsys-tarfile "${1}" | tar -t | cut -b2- \
|
||||
| xargs -rd\\n realpath -sm --relative-base="/data/data/com.termux/files/usr" -- \
|
||||
| grep -vEx '[./]|/data(/data(/com\.termux(/files)?)?)?'
|
||||
| grep -vEx '[./]|/data(/data(/com\.termux(/files)?)?)?')
|
||||
SORTKEYS='-k1,1'
|
||||
for ((x=2; x<=$(wc -L <<< "${FILES//[^\/$'\n']/}")+1; x++)); do
|
||||
SORTKEYS="$SORTKEYS -k$x,$x"
|
||||
done
|
||||
sort -t/ $SORTKEYS <<< "$FILES" \
|
||||
| awk 'NR == 1 { p=$0; next } substr($0, 1, length(p) +1 ) != p"/" { print p } { p=$0 } END { print p }'
|
||||
}
|
||||
|
||||
write_sql_script() {
|
||||
|
Loading…
Reference in New Issue
Block a user