diff options
author | merakor <cem@ckyln.com> | 2020-08-23 13:35:11 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-08-23 13:35:11 +0000 |
commit | d6ea0d937ec534d146eecbcd60eebf94a05b73f2 (patch) | |
tree | 379d0522977f7286589c56b422d6facbf606578b /src | |
parent | 1df4ecaf961d124ab31ca74407eabd874a521403 (diff) | |
download | cpt-d6ea0d937ec534d146eecbcd60eebf94a05b73f2.tar.gz |
pkg_cache(): prefer CPT_COMPRESS value if available.
cpt should prefer the user's CPT_COMPRESS in the case that two tarballs of
different compression algorithms exist. In such a case, 90% of the time, the
tarball with the CPT_COMPRESS is newer.
FossilOrigin-Name: 8fe3706e32137cf0ae536012fd68ac0c5d9f75fc71ddd3f1ac03658bb3ec6620
Diffstat (limited to 'src')
-rw-r--r-- | src/cpt-lib | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/cpt-lib b/src/cpt-lib index a0c2130..c7a47c3 100644 --- a/src/cpt-lib +++ b/src/cpt-lib @@ -475,8 +475,14 @@ pkg_list() { pkg_cache() { read -r version release 2>/dev/null < "$(pkg_find "$1")/version" - set +f; set -f -- "$bin_dir/$1#$version-$release.tar."* - tar_file=$1 + # Initially assume that the package tarball is built with the CPT_COMPRESS + # value. + if [ -f "$bin_dir/$1#$version-$release.tar.$CPT_COMPRESS" ]; then + tar_file="$bin_dir/$1#$version-$release.tar.$CPT_COMPRESS" + else + set +f; set -f -- "$bin_dir/$1#$version-$release.tar."* + tar_file=$1 + fi [ -f "$tar_file" ] } |