cpt

[ARCHIVED] Carbs Packaging Tools
git clone git://git.ckyln.com/~cem/cpt.git
Log | Files | Refs | README | LICENSE

commit 8f8042672e99a70db355ec4b0b2ae764e320c21e
parent 750b779a96df01f91905d01d5b2329138a20e0de
Author: Dylan Araps <dylan.araps@gmail.com>
Date:   Thu,  4 Jul 2019 09:36:22 +0300

kiss: Make update pull latest repositories.

Diffstat:
Mkiss | 29++++++++++++++++++++++++++++-
1 file changed, 28 insertions(+), 1 deletion(-)

diff --git a/kiss b/kiss @@ -680,6 +680,29 @@ pkg_updates() { # Check all installed packages for updates. So long as the installed # version and the version in the repositories differ, it's considered # an update. + + # Disable globbing with 'set -f' to ensure that the unquoted + # variable doesn't expand into anything nasty. + # shellcheck disable=2086,2046 + { + set -f + IFS=: + set -- $KISS_PATH + IFS=$old_ifs + set +f + } + + log "Updating repositories..." + + # Update each repository in '$KISS_PATH'. It is assumed that + # each repository is 'git' tracked. + for repo; do + log "[${repo##*/}]: Updating repository." + (cd "$repo"; git rev-parse --git-dir >/dev/null && git pull) + done + + log "Checking for new package versions..." + for pkg in "$KISS_ROOT/var/db/kiss/"*; do # Find the package's repository files. This needs to keep # happening as we can't store this data in any kind of data @@ -693,7 +716,7 @@ pkg_updates() { # Compare installed packages to repository packages. [ "$db_ver-$db_rel" != "$re_ver-$re_rel" ] && - printf '%s\n' "${pkg##*/} $re_ver-$re_rel" + printf '%s\n' "${pkg##*/} $db_ver-$db_rel ==> $re_ver-$re_rel" done } @@ -837,6 +860,10 @@ main() { # that it doesn't change beneath us. pid=$$ + # Store the original value of IFS so we can revert back to it if the + # variable is ever changed. + old_ifs=$IFS + # Catch errors and ensure that build files and directories are cleaned # up before we die. This occurs on 'Ctrl+C' as well as sucess and error. trap pkg_clean EXIT INT