From f72d7864674b7f9e25541354ad1f0779e3ce27ef Mon Sep 17 00:00:00 2001 From: merakor Date: Mon, 11 Jan 2021 17:36:33 +0000 Subject: cpt-export: use sed to generate manifest Testing the boost package, using sed results in a significant reduction for argument generation instead of using the 'read' function. Below are the 'time' stats for the script. Previous: real 0m 58.95s user 0m 55.80s sys 0m 3.54s Current: real 0m 0.66s user 0m 0.78s sys 0m 0.27s FossilOrigin-Name: 80d891e830579822317d30b66b1b019828fca9343ada23ce17585622288deef3 --- contrib/cpt-export | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/cpt-export b/contrib/cpt-export index 5429c08..90bc3e0 100755 --- a/contrib/cpt-export +++ b/contrib/cpt-export @@ -21,11 +21,11 @@ tarball="$PWD/$1#$ver-$rel.tar.${CPT_COMPRESS:=gz}" set -- # Construct the argument list using each file. -while read -r file; do - [ -d "$CPT_ROOT/$file" ] || set -- "$@" ".$file" -done < "$CPT_ROOT/var/db/cpt/installed/$pkg/manifest" +eval set -- "$(sed '/\/$/d;s|^|".|;s|$|"|' \ + "$CPT_ROOT/var/db/cpt/installed/$pkg/manifest" | tr '\n' ' ')" # Turn the list of files back into a package. +cd "$CPT_ROOT/" tar cf - -- "$@" | case "$CPT_COMPRESS" in bz2) bzip2 -z ;; gz) gzip -6 ;; -- cgit v1.2.3