xbps-src: reduce basename(1) usage.
This saves a few exec()s.
This commit is contained in:
parent
64061588fc
commit
1ee6a3174f
5 changed files with 19 additions and 13 deletions
|
@ -5,7 +5,8 @@ do_extract() {
|
|||
|
||||
mkdir -p ${wrksrc}
|
||||
for f in ${distfiles}; do
|
||||
curfile=$(basename "${f#*>}")
|
||||
curfile="${f#*>}"
|
||||
curfile="${curfile##*/}"
|
||||
cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${curfile} ${wrksrc}/${curfile}
|
||||
done
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
hook() {
|
||||
local srcdir="$XBPS_SRCDISTDIR/$pkgname-$version"
|
||||
local f j curfile found extractdir
|
||||
|
||||
if [ -z "$distfiles" -a -z "$checksum" ]; then
|
||||
mkdir -p $wrksrc
|
||||
|
@ -11,7 +12,8 @@ hook() {
|
|||
|
||||
# Check that distfiles are there before anything else.
|
||||
for f in ${distfiles}; do
|
||||
curfile=$(basename "${f#*>}")
|
||||
curfile="${f#*>}"
|
||||
curfile="${curfile##*/}"
|
||||
if [ ! -f $srcdir/$curfile ]; then
|
||||
msg_error "$pkgver: cannot find ${curfile}, use 'xbps-src fetch' first.\n"
|
||||
fi
|
||||
|
@ -24,7 +26,8 @@ hook() {
|
|||
msg_normal "$pkgver: extracting distfile(s), please wait...\n"
|
||||
|
||||
for f in ${distfiles}; do
|
||||
curfile=$(basename "${f#*>}")
|
||||
curfile="${f#*>}"
|
||||
curfile="${curfile##*/}"
|
||||
for j in ${skip_extraction}; do
|
||||
if [ "$curfile" = "$j" ]; then
|
||||
found=1
|
||||
|
@ -122,7 +125,7 @@ hook() {
|
|||
fi
|
||||
;;
|
||||
gem)
|
||||
tar -xOf $srcdir/$curfile data.tar.gz | tar -xz -C $extractdir --transform="s,^,$(basename $wrksrc)/,"
|
||||
tar -xOf $srcdir/$curfile data.tar.gz | tar -xz -C $extractdir --transform="s,^,${wrksrc##*/}/,"
|
||||
if [ $? -ne 0 ]; then
|
||||
msg_error "$pkgver: extracting $curfile into $XBPS_BUILDDIR.\n"
|
||||
fi
|
||||
|
|
|
@ -212,8 +212,10 @@ hook() {
|
|||
|
||||
# Detect distfiles with obsolete checksum and purge them from the cache
|
||||
for f in ${distfiles}; do
|
||||
curfile=$(basename "${f#*>}")
|
||||
curfile="${f#*>}"
|
||||
curfile="${curfile##*/}"
|
||||
distfile="$srcdir/$curfile"
|
||||
|
||||
if [ -f "$distfile" ]; then
|
||||
cksum=$(get_cksum $curfile $dfcount)
|
||||
if [ "${cksum:0:1}" = "@" ]; then
|
||||
|
@ -239,7 +241,8 @@ hook() {
|
|||
# Download missing distfiles and verify their checksums
|
||||
dfcount=0
|
||||
for f in ${distfiles}; do
|
||||
curfile=$(basename "${f#*>}")
|
||||
curfile="${f#*>}"
|
||||
curfile="${curfile##*/}"
|
||||
distfile="$srcdir/$curfile"
|
||||
|
||||
# If file lock cannot be acquired wait until it's available.
|
||||
|
|
|
@ -99,7 +99,8 @@ show_pkg_build_depends() {
|
|||
_pkgname="$f"
|
||||
fi
|
||||
_pkgname=${_pkgname/-32bit}
|
||||
_srcpkg=$(basename $(readlink -f ${XBPS_SRCPKGDIR}/${_pkgname}))
|
||||
_srcpkg=$(readlink -f ${XBPS_SRCPKGDIR}/${_pkgname})
|
||||
_srcpkg=${_srcpkg##*/}
|
||||
echo "${_srcpkg}" >> $result
|
||||
done
|
||||
sort -u $result
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue