aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md33
-rw-r--r--LICENSE2
-rwxr-xr-xconfigure2
-rwxr-xr-xcontrib/cpt-manifest-tree2
-rwxr-xr-xcontrib/cpt-owns2
-rwxr-xr-xcontrib/cpt-reset24
-rwxr-xr-xsrc/cpt-build2
-rwxr-xr-xsrc/cpt-download2
-rwxr-xr-xsrc/cpt-install9
-rw-r--r--src/cpt-lib.in27
-rwxr-xr-xsrc/cpt-remove2
11 files changed, 78 insertions, 29 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3922eaa..403c3be 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,6 +9,39 @@ this project _somewhat_ adheres to [Semantic Versioning].
[Semantic Versioning]: https://semver.org/spec/v2.0.0.html
+[6.2.4] - 2022-02-07
+--------------------------------------------------------------------------------
+
+### Fixed
+- Fixed a bug in missing dependency where if the user had chosen 'ldd', it would
+ fail to fix dependencies due to a typo.
+
+
+[6.2.3] - 2022-02-02
+--------------------------------------------------------------------------------
+
+### Fixed
+- Fixed a checksum verification bug where adding an extra source did not require
+ checksum verification.
+- `cpt-manifest-tree` now modifies the output of `tree(1)` according to the new
+ version.
+- `cpt-reset` is now much more verbose.
+- Fixed the displayed messages on `cpt-install` when it is given a tarball as an
+ argument.
+- Fixed a faulty implementation in `pkg_tar()` where it used `pkg_find()`
+ instead of using the built package's database directory for gathering
+ information.
+
+
+[6.2.2] - 2021-11-09
+--------------------------------------------------------------------------------
+
+### Fixed
+- `cpt-alternatives` now properly logs file swaps even when the original file
+ no longer exists.
+- Minor fixes
+
+
[6.2.1] - 2021-09-20
---------------------------------------------------------------------------------
diff --git a/LICENSE b/LICENSE
index faf1233..b732ecc 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2020-2021 Cem Keylan
+Copyright (c) 2020-2022 Cem Keylan
Copyright (c) 2019-2020 Dylan Araps
Permission is hereby granted, free of charge, to any person obtaining a copy
diff --git a/configure b/configure
index 2411f90..7fd73a6 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#!/bin/sh -e
-version=6.2.0
+version=6.2.4
die() {
printf '%s: %s\n' "${0##*/}" "$*" >&2
diff --git a/contrib/cpt-manifest-tree b/contrib/cpt-manifest-tree
index 599c0bd..bc38bc2 100755
--- a/contrib/cpt-manifest-tree
+++ b/contrib/cpt-manifest-tree
@@ -21,4 +21,4 @@ case "$1" in
esac
cpt-list "$1" >/dev/null
printf '%s\n' "[$1]:"
-tree -C --fromfile "$CPT_ROOT/var/db/cpt/installed/$1/manifest" | sed 1,2d
+tree -C --fromfile "$CPT_ROOT/var/db/cpt/installed/$1/manifest" | sed 1d
diff --git a/contrib/cpt-owns b/contrib/cpt-owns
index 9bc7d77..1f362d7 100755
--- a/contrib/cpt-owns
+++ b/contrib/cpt-owns
@@ -40,7 +40,7 @@ case "$1" in
esac
# Strip 'CPT_ROOT' from the file path if passed and follow symlinks.
-file="${1#$CPT_ROOT}"
+file="${1#"$CPT_ROOT"}"
dirname=$(_readlinkf "$CPT_ROOT/${file%/*}")
file="$dirname/${file##*/}"
diff --git a/contrib/cpt-reset b/contrib/cpt-reset
index 2a1b66e..a2336e3 100755
--- a/contrib/cpt-reset
+++ b/contrib/cpt-reset
@@ -3,6 +3,7 @@
#
# Disable word-splittng warnings as they're safe here.
# shellcheck disable=SC2046
+# shellcheck source=../src/cpt-lib
## SYNOPSIS:
## .Nm
@@ -11,10 +12,10 @@
## removes all packages from the system that is not defined as a base package in
## .Pa /etc/cpt-base .
-[ "$1" ] && {
- printf 'usage: %s\n\nRemove all packages not defined in the base.\n' \
- "${0##*/}"
- exit 0
+parser_definition() {
+ setup REST help:usage -- "usage: ${0##*/}"
+ global_options compact
+ msg -- '' "Remove all packages outside of base definition"
}
. cpt-lib
@@ -27,9 +28,14 @@ set +f; for pkg in *; do
contains "$base" "$pkg" || set -- "$pkg" "$@"
done
-[ "$1" ] && {
- printf 'WARNING: This will remove \033[1m%s\033[m package(s).\n' "$#"
- printf 'Base packages can be redefined in %s\n' "$CPT_ROOT/etc/cpt-base"
- printf 'Continue? [Enter/Ctrl+C]\n'
- read -r _ && CPT_FORCE=1 cpt-remove "$@"
+[ -z "$1" ] && {
+ log "No package outside of the base definition could be found, not continuing."
+ exit 0
}
+
+warn "" "This is a potentially harmful operation, do NOT continue unless"
+warn "" "you know exactly what you are doing. Continuing will remove $#"
+warn "" "packages that are not listed in the base definition or that the"
+warn "" "base packages don't depend on. See the CPT BASE section on the"
+warn "" "user manual to learn more."
+prompt && cpt-remove "$@"
diff --git a/src/cpt-build b/src/cpt-build
index 4eccbd1..03a33b7 100755
--- a/src/cpt-build
+++ b/src/cpt-build
@@ -10,7 +10,7 @@ parser_definition() {
if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi
-[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH ;}
+[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH="${PWD%/*}:$CPT_PATH" ;}
create_cache
diff --git a/src/cpt-download b/src/cpt-download
index d2c9aeb..231e4bb 100755
--- a/src/cpt-download
+++ b/src/cpt-download
@@ -9,7 +9,7 @@ case "$1" in
exit 0
;;
--version|-v) version ;;
- '') set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH
+ '') set -- "${PWD##*/}"; export CPT_PATH="${PWD%/*}:$CPT_PATH"
esac
create_cache
diff --git a/src/cpt-install b/src/cpt-install
index 44842a3..78da9a8 100755
--- a/src/cpt-install
+++ b/src/cpt-install
@@ -10,7 +10,7 @@ parser_definition() {
if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi
-[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH ;}
+[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH="${PWD%/*}:$CPT_PATH" ;}
[ -w "$CPT_ROOT/" ] || [ "$uid" = 0 ] || {
as_root "$0" "$@"
@@ -28,13 +28,16 @@ log "Retrieving post-installation message queue"
unset msg
for pkg in $order; do
+ # Ensure that we use package names itself, and not the tarball name if given.
+ pkg=${pkg##*/} pkg=${pkg%#*}
+
[ -f "$sys_db/$pkg/message" ] && {
printf '\033[1m%s\n%s\n%s\033[m\n\n' \
"$(_multiply_char '=' 60)" \
"$pkg" \
"$(_multiply_char '=' 60)"
- cat "$sys_db/$pkg/message" >&2
+ cat "$sys_db/$pkg/message"
msg=1
}
-done
+done >&2
[ "$msg" ] || log "No message in queue"
diff --git a/src/cpt-lib.in b/src/cpt-lib.in
index 58c9a0f..3a57d00 100644
--- a/src/cpt-lib.in
+++ b/src/cpt-lib.in
@@ -100,7 +100,7 @@ sepchar() (
str_tmp=${str_tmp%?}
done
set -- "$@" "$str_tmp"
- str=${str#$str_tmp}
+ str=${str#"$str_tmp"}
done
printf '%s\n' "$@"
)
@@ -801,7 +801,7 @@ pkg_extract() {
# VCS Repository
git+*|hg+*|fossil+*)
backend=${src%%+*}
- url=${src##${backend}+} com=${url##*[@#]} com=${com#${url%[@#]*}}
+ url=${src##"${backend}"+} com=${url##*[@#]} com=${com#"${url%[@#]*}"}
log "$1" "Cloning ${url%[#@]*}"
"pkg_vcs_clone_$backend" "${url%[#@]*}" "$com"
@@ -972,7 +972,7 @@ pkg_fix_deps() {
case ${elf_prog:-ldd} in
*readelf) "$elf_prog" -d "$file" 2>/dev/null ;;
- *) pirntf '%s\n' "$lddbuf" ;;
+ *) printf '%s\n' "$lddbuf" ;;
esac |
while read -r dep; do
# Skip lines containing 'ldd'.
@@ -1033,7 +1033,7 @@ pkg_manifest() (
# sed: Remove the first character in each line (./dir -> /dir) and
# remove all lines which only contain '.'.
find . -type d -exec printf '%s/\n' {} + -o -print |
- sort -r | sed '/^\.$/d;/^\.\/$/d;ss.ss' > "${2:-$pkg_dir}/$1/$pkg_db/$1/manifest"
+ sort -r | sed '/^\.\/*$/d;ss.ss' > "${2:-$pkg_dir}/$1/$pkg_db/$1/manifest"
)
pkg_etcsums() (
@@ -1063,7 +1063,7 @@ pkg_tar() {
log "$1" "Creating tarball"
# Read the version information to name the package.
- read -r version release < "$(pkg_find "$1")/version"
+ read -r version release < "$pkg_dir/$1/$pkg_db/$1/version"
# Create a tarball from the contents of the built package.
cd "$pkg_dir/$1"
@@ -1294,7 +1294,7 @@ pkg_checksums() {
pkg_verify() {
# Verify all package checksums. This is achieved by generating a new set of
# checksums and then comparing those with the old set.
- vcmd="NR==FNR{a[\$1];next}/^git .*/{next}!((\$1)in a){exit 1}"
+ vcmd="NR==FNR{a[\$1];next}/^git .*/{next}!((\$1)in a){exit 1}END{if(NR/2!=FNR)exit 1}"
for pkg; do
repo_dir=$(pkg_find "$pkg")
@@ -1340,7 +1340,7 @@ pkg_conflicts() {
# Combine the dirname and file values, and print them into the
# temporary manifest to be parsed.
- printf '%s/%s\n' "${dirname#$CPT_ROOT}" "${file##*/}"
+ printf '%s/%s\n' "${dirname#"$CPT_ROOT"}" "${file##*/}"
done < "$tar_dir/$1/$pkg_db/$1/manifest" > "$CPT_TMPDIR/$pid/manifest"
@@ -1462,15 +1462,22 @@ pkg_swap() {
# its manifest file to reflect this. We then resort this file
# so no issues arise when removing packages.
cp -Pf "$CPT_ROOT/$2" "$pkg_owns>${alt#*>}"
- sed "s#^$(regesc "$2")\$#${PWD#$CPT_ROOT}/$pkg_owns>${alt#*>}#" \
+ sed "s#^$(regesc "$2")\$#${PWD#"$CPT_ROOT"}/$pkg_owns>${alt#*>}#" \
"../installed/$pkg_owns/manifest" |
sort -r -o "../installed/$pkg_owns/manifest"
+ else
+ # If the file doesn't exist, we assume that there was a previous owner,
+ # but the package was then removed. We want the message to be short
+ # and clear, I thought of writing "Swapping [...] from 'null' to '$1'",
+ # but that would probably sound more like a package manager bug. Instead
+ # we are printing the message below which should be informative enough.
+ log "Installing '$2' from '$1'"
fi
# Convert the desired alternative to a real file and rewrite
# the manifest file to reflect this. The reverse of above.
mv -f "$alt" "$CPT_ROOT/$2"
- sed "s#^${PWD#$CPT_ROOT}/$(regesc "$alt")\$#$2#" "../installed/$1/manifest" |
+ sed "s#^${PWD#"$CPT_ROOT"}/$(regesc "$alt")\$#$2#" "../installed/$1/manifest" |
sort -r -o "../installed/$1/manifest"
}
@@ -1714,7 +1721,7 @@ pkg_repository_update() {
# Function to update the given package repository.
cd "$1"
repo_type=$(pkg_vcs_info)
- repo_root=${repo_type#$PWD:}
+ repo_root=${repo_type#"$PWD":}
repo_type=${repo_type##*:} repo_root=${repo_root%:*}
contains "$repos" "$repo_root" || {
repos="$repos $repo_root "
diff --git a/src/cpt-remove b/src/cpt-remove
index cce3739..ae007eb 100755
--- a/src/cpt-remove
+++ b/src/cpt-remove
@@ -10,7 +10,7 @@ parser_definition() {
if [ -f ./cpt-lib ]; then . ./cpt-lib; else . cpt-lib; fi
-[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH ;}
+[ "$1" ] || { set -- "${PWD##*/}"; export CPT_PATH="${PWD%/*}:$CPT_PATH" ;}
[ -w "$CPT_ROOT/" ] || [ "$uid" = 0 ] || {
as_root "$0" "$@"