diff options
author | merakor <cem@ckyln.com> | 2021-01-11 17:36:33 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2021-01-11 17:36:33 +0000 |
commit | f72d7864674b7f9e25541354ad1f0779e3ce27ef (patch) | |
tree | 105d81e58972b11bb69d6a44f0952c2f77968c66 | |
parent | e76ede06d13bb8369ab57168ea5da2fd0054d42d (diff) | |
download | cpt-f72d7864674b7f9e25541354ad1f0779e3ce27ef.tar.gz |
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
-rwxr-xr-x | contrib/cpt-export | 6 |
1 files 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 ;; |