# HG changeset patch # User Christian Mesh # Date 1338680882 18000 # Node ID 8bcd11c1cc91eb5464995cb90a084aeb1c4afe2d # Parent cab731b9a98ce58f7f5b33cc1be0b7af38a8e601 changed several tools to use lib functions diff -r cab731b9a98c -r 8bcd11c1cc91 lib/libspk.sh --- a/lib/libspk.sh Sat Jun 02 18:27:42 2012 -0500 +++ b/lib/libspk.sh Sat Jun 02 18:48:02 2012 -0500 @@ -244,7 +244,7 @@ # Usage: check_installed package check_installed() { local name="$1" - if [ -d "$installed/$name" ]; then + if is_package_installed $name; then echo $(boldify "$name") $(gettext "package is already installed") [ "$forced" ] || rm -rf $tmpdir continue @@ -258,14 +258,14 @@ if echo $i | fgrep -q : ; then # format 'alternative:newname' # if alternative is installed then substitute newname - if [ -f $installed/${i%:*}/receipt ]; then + if is_package_installed ${i%:*}; then # substitute package dependancy echo ${i#*:} return fi else # if alternative is installed then nothing to install - if [ -f $installed/$i/receipt ]; then + if is_package_installed $i/receipt; then # substitute installed package echo $i return @@ -292,7 +292,7 @@ if [ ! -d "$installed/$pkg" ]; then gettext "Missing:"; echo " $pkg" deps=$(($deps+1)) - elif [ ! -f "$installed/$pkg/receipt" ]; then + elif [ ! is_package_installed $pkg/receipt ]; then gettext "WARNING: Dependency loop between:"; newline echo " $package --> $pkg" fi diff -r cab731b9a98c -r 8bcd11c1cc91 spk --- a/spk Sat Jun 02 18:27:42 2012 -0500 +++ b/spk Sat Jun 02 18:48:02 2012 -0500 @@ -171,7 +171,7 @@ count=$(($count + 1)) [ "$count" == 1 ] && newline unset_receipt - . $installed/$pkg/receipt + source_receipt $installed/$pkg/receipt boldify $(gettext "Package") $pkg separator gettext "Status :"; colorize 32 " installed" diff -r cab731b9a98c -r 8bcd11c1cc91 spk-rm --- a/spk-rm Sat Jun 02 18:27:42 2012 -0500 +++ b/spk-rm Sat Jun 02 18:48:02 2012 -0500 @@ -56,7 +56,7 @@ # Reverse deps for i in $(ls $installed); do - [ -f $installed/$i/receipt ] || continue + is_package_installed $i || continue unset_receipt source_receipt $installed/$i/receipt case " $DEPENDS " in @@ -156,7 +156,7 @@ --*) continue esac # Be sure package is installed - if [ ! -f "$installed/$pkg/receipt" ]; then + if ! is_package_installed $pkg; then echo -n "$(boldify $pkg) " gettext "package is not installed"; newline continue diff -r cab731b9a98c -r 8bcd11c1cc91 spk-up --- a/spk-up Sat Jun 02 18:27:42 2012 -0500 +++ b/spk-up Sat Jun 02 18:48:02 2012 -0500 @@ -50,7 +50,7 @@ newline boldify $(gettext "Updating packages lists") separator - check="$extradb/*/mirror $PKGS_DB/mirror" + local check="$extradb/*/mirror $PKGS_DB/mirror" if [ "$mirror" ]; then check=$extradb/$mirror/mirror [ "$mirror" == "main" ] && check=$PKGS_DB/mirror @@ -133,7 +133,7 @@ # Check if we have an upgrade for a package check_pkgup() { unset_receipt - . $pkg/receipt + source_receipt $pkg/receipt localdb=$extradb/local sum=$(fgrep " $PACKAGE-${VERSION}$EXTRAVERSION.tazpkg" \ $installed.$SUM | awk '{print $1}') @@ -196,10 +196,10 @@ system=no check_root [ "$count" == 0 ] && up_headers - if [ -f "$installed/$pkg/receipt" ]; then + if is_package_installed $pkg; then count=$(($count +1)) cd $installed - . $pkg/receipt + source_receipt $pkg/receipt check=$(check_pkgup) if [ "$check" != "" ]; then echo "$check"