xbps-src: replace basename(1) with ${var##*/}.
Reduce number of fork+exec due to using a subshell to execute basename(1).
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
# vim: set ts=4 sw=4 et:
|
||||
|
||||
bulk_getlink() {
|
||||
local p="$(basename $1)"
|
||||
local p="${1##*/}"
|
||||
local target="$(readlink $XBPS_SRCPKGDIR/$p)"
|
||||
|
||||
if [ $? -eq 0 -a -n "$target" ]; then
|
||||
|
@@ -182,7 +182,7 @@ run_pkg_hooks() {
|
||||
eval unset -f hook
|
||||
for f in ${XBPS_COMMONDIR}/hooks/${phase}/*.sh; do
|
||||
[ ! -r $f ] && continue
|
||||
hookn=$(basename $f)
|
||||
hookn=${f##*/}
|
||||
hookn=${hookn%.sh}
|
||||
. $f
|
||||
run_func hook "$phase hook: $hookn" ${phase}_${hookn}
|
||||
|
@@ -75,7 +75,7 @@ purge_distfiles() {
|
||||
hashes=($XBPS_SRCDISTDIR/by_sha256/*)
|
||||
readonly HASHLEN=64
|
||||
for file in ${hashes[@]}; do
|
||||
hash_distfile=$(basename "$file")
|
||||
hash_distfile=${file##*/}
|
||||
hash=${hash_distfile:0:$HASHLEN}
|
||||
[ -n "${my_hashes[$hash]}" ] && continue
|
||||
inode=$(stat "$file" --printf "%i")
|
||||
|
@@ -6,7 +6,7 @@ update_hash_cache() {
|
||||
mkdir -p "$cache"
|
||||
find "$XBPS_SRCDISTDIR" -type f | grep -v by_sha256 | while read -r distfile; do
|
||||
cksum=$(cat "$distfile" | sha256sum | cut -d " " -f 1)
|
||||
curfile="$(basename ${distfile})"
|
||||
curfile="${distfile##*/}"
|
||||
ln -vf "$distfile" "${cache}/${cksum}_${curfile}"
|
||||
done
|
||||
}
|
||||
|
Reference in New Issue
Block a user