From aefe26d30cd86f455ecd4c9294462808cd9bc4fd Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 28 Feb 2009 17:31:47 +0100 Subject: [PATCH] binpkg.sh: do the files processing in 3 steps: 1- links, 2- files and 3- dirs. --HG-- extra : convert_revision : d68324f39af442b089e71083316c16bc4690a4e2 --- shutils/binpkg.sh | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/shutils/binpkg.sh b/shutils/binpkg.sh index 8484e32bb1f..fae005e321b 100644 --- a/shutils/binpkg.sh +++ b/shutils/binpkg.sh @@ -110,14 +110,29 @@ xbps_write_metadata_pkg_real() write_metadata_flist_header $TMPFPLIST - # First add the regular files. - for f in $(find -L $destdir -type f); do + # Pass 1: add links. + for f in $(find $destdir -type l); do j=$(echo $f|sed -e "$fpattern") [ "$j" = "" ] && continue printf "$j\n" >> $TMPFLIST printf "\n" >> $TMPFPLIST printf "file\n" >> $TMPFPLIST printf "$j\n" >> $TMPFPLIST + printf "type\n" >> $TMPFPLIST + printf "link\n" >> $TMPFPLIST + printf "\n" >> $TMPFPLIST + done + + # Pass 2: add regular files. + for f in $(find $destdir -type f); do + j=$(echo $f|sed -e "$fpattern") + [ "$j" = "" ] && continue + printf "$j\n" >> $TMPFLIST + printf "\n" >> $TMPFPLIST + printf "file\n" >> $TMPFPLIST + printf "$j\n" >> $TMPFPLIST + printf "type\n" >> $TMPFPLIST + printf "file\n" >> $TMPFPLIST printf "sha256\n" >> $TMPFPLIST printf "$(xbps-digest $f)\n" >> $TMPFPLIST for i in ${conf_files}; do @@ -130,14 +145,16 @@ xbps_write_metadata_pkg_real() printf "\n" >> $TMPFPLIST done - # Add directories at the end. - for f in $(find -L $destdir -type d|sort -ur); do + # Pass 3: add directories. + for f in $(find $destdir -type d|sort -ur); do j=$(echo $f|sed -e "$fpattern") [ "$j" = "" ] && continue printf "$j\n" >> $TMPFLIST printf "\n" >> $TMPFPLIST - printf "dir\n" >> $TMPFPLIST + printf "file\n" >> $TMPFPLIST printf "$j\n" >> $TMPFPLIST + printf "type\n" >> $TMPFPLIST + printf "dir\n" >> $TMPFPLIST for i in ${keep_dirs}; do if [ "$j" = "$i" ]; then printf "keep\n" >> $TMPFPLIST