From be0ea0a881848a18fc81e5bf66c75ec1fbcc81c2 Mon Sep 17 00:00:00 2001 From: Dylan Araps Date: Mon, 19 Jul 2021 18:53:01 +0300 Subject: [PATCH] kiss: sed is gone --- kiss | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/kiss b/kiss index 62d8a4c..e6af679 100755 --- a/kiss +++ b/kiss @@ -715,7 +715,7 @@ EOF # Generate a new manifest as we may be the creator of the depends # file. This could otherwise be implemented by inserting a line # at the correct place in the existing manifest. - pkg_manifest "${PWD##*/}" + pkg_manifest "${PWD##*/}" "$pkg_dir" } } @@ -725,25 +725,27 @@ pkg_manifest() { # packages, checking for package conflicts and for general debugging. log "$1" "Generating manifest" - cd "${2:-$pkg_dir}/$1" - # Ensure manifest is added to manfiest. - : > "$PWD/$pkg_db/$1/manifest" + : > "$2/$1/$pkg_db/$1/manifest" # Ensure etcsums is added to manifest if /etc exists in package. - ! [ -d "$PWD/etc" ] || : > "$PWD/$pkg_db/$1/etcsums" + ! [ -d "$2/$1/etc" ] || : > "$2/$1/$pkg_db/$1/etcsums" + + tmp_file "$1" manifest # Create a list of all files and directories. Append '/' to the end of # directories so they can be easily filtered out later. Also filter out # all libtool .la files and charset.alias. - find . ! -path . -type d -exec printf '%s/\n' {} + \ + find "$2/$1" ! -path "$2/$1" -type d -exec printf '%s/\n' {} + \ -o \( ! -type d -a ! -name \*.la -a ! -name charset.alias \) -print | # Sort the output in reverse. Directories appear after their contents. - # Remove the first character in each line (./dir -> /dir) and - sort -r | sed ss.ss > "$PWD/$pkg_db/$1/manifest" + sort -r > "$_tmp_file" - cd "$OLDPWD" + # Remove the first character in each line (./dir -> /dir). + while read -r file; do + printf '%s\n' "${file#"$2/$1"}" + done < "$_tmp_file" > "$2/$1/$pkg_db/$1/manifest" } pkg_manifest_validate() { @@ -900,7 +902,7 @@ pkg_build_all() { ! [ -f "$repo_dir/sources" ] || pkg_extract "$pkg" pkg_build "$pkg" - pkg_manifest "$pkg" + pkg_manifest "$pkg" "$pkg_dir" pkg_strip "$pkg" cd "$pkg_dir/$pkg/$pkg_db/$pkg"