xbps-src: handle files with spaces and other characters.

This commit is contained in:
Juan RP 2010-12-14 16:34:05 +01:00
parent 754274d635
commit f2bd4e603b
3 changed files with 46 additions and 39 deletions

View file

@ -127,30 +127,31 @@ xbps_write_metadata_pkg_real()
triggers="info-files $triggers" triggers="info-files $triggers"
msg_normal "Package '$pkgname ($lver)': processing info(1) files..." msg_normal "Package '$pkgname ($lver)': processing info(1) files..."
for f in $(find ${DESTDIR}/usr/share/info -type f -follow); do find ${DESTDIR}/usr/share/info -type f -follow | while read f
j=$(echo $f|sed -e "$fpattern") do
j=$(echo "$f"|sed -e "$fpattern")
[ "$j" = "" ] && continue [ "$j" = "" ] && continue
[ "$j" = "/usr/share/info/dir" ] && continue [ "$j" = "/usr/share/info/dir" ] && continue
# Ignore compressed files. # Ignore compressed files.
if $(echo $j|grep -q '.*.gz$'); then if $(echo "$j"|grep -q '.*.gz$'); then
continue continue
fi fi
# Ignore non info files. # Ignore non info files.
if ! $(echo $j|grep -q '.*.info$') && \ if ! $(echo "$j"|grep -q '.*.info$') && \
! $(echo $j|grep -q '.*.info-[0-9]*$'); then ! $(echo "$j"|grep -q '.*.info-[0-9]*$'); then
continue continue
fi fi
if [ -h ${DESTDIR}/$j ]; then if [ -h ${DESTDIR}/"$j" ]; then
dirat=$(dirname $j) dirat=$(dirname "$j")
lnkat=$(readlink ${DESTDIR}/$j) lnkat=$(readlink ${DESTDIR}/"$j")
newlnk=$(basename $j) newlnk=$(basename "$j")
rm -f ${DESTDIR}/$j rm -f ${DESTDIR}/"$j"
cd ${DESTDIR}/$dirat cd ${DESTDIR}/"$dirat"
ln -s ${lnkat}.gz ${newlnk}.gz ln -s "${lnkat}".gz "${newlnk}".gz
continue continue
fi fi
echo " Compressing info file: $j..." echo " Compressing info file: $j..."
gzip -q9 ${DESTDIR}/$j gzip -q9 ${DESTDIR}/"$j"
done done
fi fi
@ -160,23 +161,24 @@ xbps_write_metadata_pkg_real()
# #
if [ -d "${DESTDIR}/usr/share/man" ]; then if [ -d "${DESTDIR}/usr/share/man" ]; then
msg_normal "Package '$pkgname ($lver)': processing manual pages..." msg_normal "Package '$pkgname ($lver)': processing manual pages..."
for f in $(find ${DESTDIR}/usr/share/man -type f -follow); do find ${DESTDIR}/usr/share/man -type f -follow | while read f
j=$(echo $f|sed -e "$fpattern") do
j=$(echo "$f"|sed -e "$fpattern")
[ "$j" = "" ] && continue [ "$j" = "" ] && continue
if $(echo $j|grep -q '.*.gz$'); then if $(echo "$j"|grep -q '.*.gz$'); then
continue continue
fi fi
if [ -h ${DESTDIR}/$j ]; then if [ -h ${DESTDIR}/"$j" ]; then
dirat=$(dirname $j) dirat=$(dirname "$j")
lnkat=$(readlink ${DESTDIR}/$j) lnkat=$(readlink ${DESTDIR}/"$j")
newlnk=$(basename $j) newlnk=$(basename "$j")
rm -f ${DESTDIR}/$j rm -f ${DESTDIR}/"$j"
cd ${DESTDIR}/$dirat cd ${DESTDIR}/"$dirat"
ln -s ${lnkat}.gz ${newlnk}.gz ln -s "${lnkat}".gz "${newlnk}".gz
continue continue
fi fi
echo " Compressing manpage: $j..." echo " Compressing manpage: $j..."
gzip -q9 ${DESTDIR}/$j gzip -q9 ${DESTDIR}/"$j"
done done
fi fi
@ -188,8 +190,9 @@ xbps_write_metadata_pkg_real()
# Pass 1: add links. # Pass 1: add links.
echo "<key>links</key>" >> $TMPFPLIST echo "<key>links</key>" >> $TMPFPLIST
echo "<array>" >> $TMPFPLIST echo "<array>" >> $TMPFPLIST
for f in $(find ${DESTDIR} -type l); do find ${DESTDIR} -type l | while read f
j=$(echo $f|sed -e "$fpattern") do
j=$(echo "$f"|sed -e "$fpattern")
[ "$j" = "" ] && continue [ "$j" = "" ] && continue
echo "$j" >> $TMPFLIST echo "$j" >> $TMPFLIST
echo "<dict>" >> $TMPFPLIST echo "<dict>" >> $TMPFPLIST
@ -202,8 +205,9 @@ xbps_write_metadata_pkg_real()
# Pass 2: add regular files. # Pass 2: add regular files.
echo "<key>files</key>" >> $TMPFPLIST echo "<key>files</key>" >> $TMPFPLIST
echo "<array>" >> $TMPFPLIST echo "<array>" >> $TMPFPLIST
for f in $(find ${DESTDIR} -type f); do find ${DESTDIR} -type f | while read f
j=$(echo $f|sed -e "$fpattern") do
j=$(echo "$f"|sed -e "$fpattern")
[ "$j" = "" ] && continue [ "$j" = "" ] && continue
echo "$j" >> $TMPFLIST echo "$j" >> $TMPFLIST
# Skip configuration files. # Skip configuration files.
@ -215,7 +219,7 @@ xbps_write_metadata_pkg_real()
echo "<key>file</key>" >> $TMPFPLIST echo "<key>file</key>" >> $TMPFPLIST
echo "<string>$j</string>" >> $TMPFPLIST echo "<string>$j</string>" >> $TMPFPLIST
echo "<key>sha256</key>" >> $TMPFPLIST echo "<key>sha256</key>" >> $TMPFPLIST
echo "<string>$(${XBPS_DIGEST_CMD} $f)</string>" \ echo "<string>$(${XBPS_DIGEST_CMD} "$f")</string>" \
>> $TMPFPLIST >> $TMPFPLIST
echo "</dict>" >> $TMPFPLIST echo "</dict>" >> $TMPFPLIST
done done
@ -224,8 +228,9 @@ xbps_write_metadata_pkg_real()
# Pass 3: add directories. # Pass 3: add directories.
echo "<key>dirs</key>" >> $TMPFPLIST echo "<key>dirs</key>" >> $TMPFPLIST
echo "<array>" >> $TMPFPLIST echo "<array>" >> $TMPFPLIST
for f in $(find ${DESTDIR} -type d|sort -ur); do find ${DESTDIR} -type d|sort -ur | while read f
j=$(echo $f|sed -e "$fpattern") do
j=$(echo "$f"|sed -e "$fpattern")
[ "$j" = "" ] && continue [ "$j" = "" ] && continue
echo "$j" >> $TMPFLIST echo "$j" >> $TMPFLIST
echo "<dict>" >> $TMPFPLIST echo "<dict>" >> $TMPFPLIST
@ -240,13 +245,13 @@ xbps_write_metadata_pkg_real()
echo "<key>conf_files</key>" >> $TMPFPLIST echo "<key>conf_files</key>" >> $TMPFPLIST
echo "<array>" >> $TMPFPLIST echo "<array>" >> $TMPFPLIST
for f in ${conf_files}; do for f in ${conf_files}; do
i=${DESTDIR}/${f} i=${DESTDIR}/"${f}"
[ ! -f ${i} ] && continue [ ! -f "${i}" ] && continue
echo "<dict>" >> $TMPFPLIST echo "<dict>" >> $TMPFPLIST
echo "<key>file</key>" >> $TMPFPLIST echo "<key>file</key>" >> $TMPFPLIST
echo "<string>$f</string>" >> $TMPFPLIST echo "<string>$f</string>" >> $TMPFPLIST
echo "<key>sha256</key>" >> $TMPFPLIST echo "<key>sha256</key>" >> $TMPFPLIST
echo "<string>$(${XBPS_DIGEST_CMD} ${i})</string>" \ echo "<string>$(${XBPS_DIGEST_CMD} "${i}")</string>" \
>> $TMPFPLIST >> $TMPFPLIST
echo "</dict>" >> $TMPFPLIST echo "</dict>" >> $TMPFPLIST
done done

View file

@ -56,13 +56,14 @@ strip_files_real()
fi fi
msg_normal "Package '$pkgname ($lver)': stripping files, please wait..." msg_normal "Package '$pkgname ($lver)': stripping files, please wait..."
for f in $(find ${DESTDIR} -type f); do find ${DESTDIR} -type f | while read f
do
case "$(file -biz $f)" in case "$(file -biz $f)" in
application/x-executable*) application/x-executable*)
strip $f && \ strip "$f" && \
echo " Stripped executable: $(basename $f)";; echo " Stripped executable: $(basename $f)";;
application/x-sharedlib*|application/x-archive*) application/x-sharedlib*|application/x-archive*)
strip -S $f && \ strip -S "$f" && \
echo " Stripped library: $(basename $f)";; echo " Stripped library: $(basename $f)";;
esac esac
done done

View file

@ -59,10 +59,11 @@ verify_rundeps()
[ -n "$noarch" -o -n "$noverifyrdeps" ] && return 0 [ -n "$noarch" -o -n "$noverifyrdeps" ] && return 0
msg_normal "Package '$pkgname ($lver)': verifying required run dependencies, please wait..." msg_normal "Package '$pkgname ($lver)': verifying required run dependencies, please wait..."
for f in $(find ${PKG_DESTDIR} -type f); do find ${PKG_DESTDIR} -type f | while read f
do
# Don't check dirs specified in ignore_vdeps_dir. # Don't check dirs specified in ignore_vdeps_dir.
for j in ${ignore_vdeps_dir}; do for j in ${ignore_vdeps_dir}; do
if grep -q ${j} ${f}; then if grep -q ${j} "${f}"; then
igndir=1 igndir=1
break break
fi fi