aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2021-04-15 13:35:31 +0000
committermerakor <cem@ckyln.com>2021-04-15 13:35:31 +0000
commit32fc7163d87f8fd5544cbc97dc8973c68e7fc24a (patch)
tree5b48fed234dc6db0121264748f9e1e3778926d58 /src
parente64ca397b4343502d72977fc791b8c968db17598 (diff)
parentc73369c07f7a21701b5f4801081a92602bda81ca (diff)
downloadcpt-32fc7163d87f8fd5544cbc97dc8973c68e7fc24a.tar.gz
merge maintenance branch
FossilOrigin-Name: 5e6005b5ed08fa564e6cf6eff4c721ffa2c1992214a0057dad69af5fe04cc27b
Diffstat (limited to 'src')
-rwxr-xr-xsrc/cpt2
-rw-r--r--src/cpt-lib.in31
2 files changed, 18 insertions, 15 deletions
diff --git a/src/cpt b/src/cpt
index 4ddb4df..50268ea 100755
--- a/src/cpt
+++ b/src/cpt
@@ -11,7 +11,7 @@ case "$arg" in
log "Carbs Packaging Tool"
set --
for path in $(SEARCH_PATH=$PATH pkg_find cpt-* all -x); do
- set -- "${path#*/cpt-}" "$@"
+ set -- "${path##*/cpt-}" "$@"
max=$((${#1} > max ? ${#1} : max))
done
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index bf58fbe..5416efe 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -1952,23 +1952,19 @@ pkg_clean() {
rm -rf -- "${CPT_TMPDIR:=$cac_dir/proc}/$pid"
}
+create_tmp() {
+ # Create the required temporary directories and set the variables which
+ # point to them.
+ mkdir -p "${mak_dir:=$tmp_dir/build}" \
+ "${pkg_dir:=$tmp_dir/pkg}" \
+ "${tar_dir:=$tmp_dir/export}"
+}
+
create_cache() {
- # A temporary directory can be specified apart from the cache
- # directory in order to build in a user specified directory.
- # /tmp could be used in order to build on ram, useful on SSDs.
- # The user can specify CPT_TMPDIR for this.
+ # DEPRECATED, use create_tmp() instead.
#
- # Create the required temporary directories and set the variables
- # which point to them.
- mkdir -p "${tmp_dir:=${CPT_TMPDIR:=$cac_dir/proc}/$pid}"
-
# If an argument is given, skip the creation of other cache directories.
- # This here makes shellcheck extremely angry, so I am globally disabling
- # SC2119.
- [ "$1" ] || mkdir -p "${mak_dir:=$tmp_dir/build}" \
- "${pkg_dir:=$tmp_dir/pkg}" \
- "${tar_dir:=$tmp_dir/export}"
-
+ [ "$1" ] || create_tmp
}
# main()
@@ -1987,7 +1983,14 @@ create_cache() {
# to them. This is seperate from temporary directories created in
# create_cache(). That's because we need these variables set on most
# occasions.
+ #
+ # A temporary directory can be specified apart from the cache directory in
+ # order to build in a user specified directory. /tmp could be used in order
+ # to build on ram, useful on SSDs. The user can specify CPT_TMPDIR for this.
+ # We create the temporary directory here to avoid permission issues that can
+ # arise from functions that call as_root().
mkdir -p "${cac_dir:=${CPT_CACHE:=${XDG_CACHE_HOME:-$HOME/.cache}/cpt}}" \
+ "${tmp_dir:=${CPT_TMPDIR:=$cac_dir/proc}/$pid}" \
"${src_dir:=$cac_dir/sources}" \
"${log_dir:=$cac_dir/logs}" \
"${bin_dir:=$cac_dir/bin}"