# HG changeset patch # User Christian Mesh # Date 1337417465 18000 # Node ID 0cb21eb5cf205392f2484dcaa26fbd65c76292ba # Parent d1790128faac4c14470017717a78380cbb32e353 Update to use new colorize diff -r d1790128faac -r 0cb21eb5cf20 lib/libspk.sh --- a/lib/libspk.sh Fri May 18 21:24:30 2012 +0200 +++ b/lib/libspk.sh Sat May 19 03:51:05 2012 -0500 @@ -53,10 +53,10 @@ cat $list | while read package version desc category do if [ "$short" ]; then - echo -n "$(colorize "$package" 32)"; indent 28 " $version" + echo -n "$(colorize 32 "$package")"; indent 28 " $version" else newline - gettext "Package :"; colorize " $package" 32 + gettext "Package :"; colorize 32 " $package" gettext "Version :"; echo "$version" gettext "Short desc :"; echo "$desc" fi @@ -148,13 +148,13 @@ if [ -f "$uri/$file" ]; then [ "$verbose" ] && echo "URI: $uri/" gettext "Using local mirror:"; boldify " $file" - [ "$verbose" ] && (gettext "Copying file to:"; colorize " $pwd" 34) + [ "$verbose" ] && (gettext "Copying file to:"; colorize 34 " $pwd") cp -f $uri/$file $pwd cd $pwd && return 0 fi # In cache ? Root can use --cache to set destdir. if [ -f "$CACHE_DIR/$file" ]; then - gettext "Using cache:"; colorize " ${file%.tazpkg}" 34 + gettext "Using cache:"; colorize 34 " ${file%.tazpkg}" return 0 else [ "$verbose" ] && echo "URL: $uri/" @@ -164,7 +164,7 @@ gettext "Using extra mirror:" fi boldify " $file" - [ "$verbose" ] && (gettext "Destination:"; colorize " $pwd" 34) + [ "$verbose" ] && (gettext "Destination:"; colorize 34 " $pwd") if [ -f "$pwd/$file" ]; then echo "File exist: $pwd/$file" && return 0 fi @@ -175,7 +175,7 @@ fi # Be sure the file was fetched. if [ ! -f "$pwd/$file" ] || [ ! -f "$CACHE_DIR/$file" ]; then - gettext "ERROR: Missing file:"; colorize " $file" 31 + gettext "ERROR: Missing file:"; colorize 31 " $file" newline && exit 1 fi } @@ -256,7 +256,7 @@ fi done - gettext "Missing dependencies:"; echo " $(colorize "$deps" 34)" + gettext "Missing dependencies:"; echo " $(colorize 34 "$deps")" # Return true if missing deps [ "$deps" != "0" ] diff -r d1790128faac -r 0cb21eb5cf20 spk --- a/spk Fri May 18 21:24:30 2012 +0200 +++ b/spk Sat May 19 03:51:05 2012 -0500 @@ -120,7 +120,7 @@ check_root [ -d "$installed/$pkg" ] || continue if grep -qs ^${pkg}$ $blocked; then - echo -n "$(boldify "$pkg") " + echo -n "$(boldify $pkg) " gettext "is already blocked"; newline else gettext "Blocking package:"; echo -n " $pkg" @@ -135,7 +135,7 @@ sed -i /"^${pkg}$"/d $blocked log "Unblocked package: $pkg" && status else - echo -n "$(boldify "$pkg") " + echo -n "$(boldify $pkg) " gettext "is not blocked"; newline fi && continue ;; *\ --rm\ *) @@ -148,18 +148,18 @@ if [ -f "$logdir/$pkg/install.log" ]; then count=$(($count + 1)) [ "$count" == "1" ] && newline - colorize "$(gettext "Install log for:"; echo " $pkg")" 36 + colorize 36 $(gettext "Install log for:"; echo " $pkg") separator cat $logdir/$pkg/install.log else gettext "Any install log for:"; boldify " $pkg" fi if [ -f "$logdir/$pkg/up.log" ]; then - colorize "$(gettext "Upgrade log for:"; echo " $pkg")" 36 + colorize 36 $(gettext "Upgrade log for:"; echo " $pkg") separator cat $logdir/$pkg/up.log else - colorize "$(gettext "Any upgrade log for:"; echo " $pkg")" 36 + colorize 36 $(gettext "Any upgrade log for:"; echo " $pkg") newline fi && continue ;; esac @@ -169,7 +169,7 @@ . $installed/$pkg/receipt boldify "$(gettext "Package") $pkg" separator - gettext "Status :"; colorize " installed" 32 + gettext "Status :"; colorize 32 " installed" receipt_info separator && newline continue @@ -188,7 +188,7 @@ [ "$count" == 1 ] && newline boldify "$(gettext "Package") $pkg" separator - gettext "Status :"; colorize " not installed" 31 + gettext "Status :"; colorize 31 " not installed" echo "$mirrored" | awk 'BEGIN { FS = "|" } ; { print \ "Version :" $2 "\n" \ "Short desc :" $3 "\n" \ diff -r d1790128faac -r 0cb21eb5cf20 spk-add --- a/spk-add Fri May 18 21:24:30 2012 +0200 +++ b/spk-add Sat May 19 03:51:05 2012 -0500 @@ -153,7 +153,7 @@ [ "$package_name" == "$name" ] && continue 2 count=$(($count +1)) [ "$count" == "1" ] && gettext "Modified package:"; \ - colorize " $name" 31 + colorize 31 " $name" gettext "Overwriting file:"; echo " $file" # If confirm is set, ask to remove. Do we want that ? # If gawk is installed for example we will never remove Busybox @@ -381,7 +381,7 @@ # Show all new counted packages in verbose mode if [ "$verbose" ]; then - gettext "Handled packages:"; colorize " $count" 34 + gettext "Handled packages:"; colorize 34 " $count" fi exit 0 diff -r d1790128faac -r 0cb21eb5cf20 spk-ls --- a/spk-ls Fri May 18 21:24:30 2012 +0200 +++ b/spk-ls Sat May 19 03:51:05 2012 -0500 @@ -54,7 +54,7 @@ exit 0 ;; --mirror) newline - boldify "$(gettext "Mirror") $(cat $mirrorurl)" + boldify $(gettext "Mirror") $(cat $mirrorurl) read_pkgsdesc $pkgsdesc separator boldify $(count_mirrored) @@ -64,10 +64,10 @@ for extra in $extradb/* do newline - boldify "$(gettext "Extra mirror")" + boldify $(gettext "Extra mirror") if [ ! -f "$extra/packages.desc" ]; then echo "URL: $(cat $extra/mirror)" - gettext "Missing:"; colorize " packages.desc" 31 + gettext "Missing:"; colorize 31" packages.desc" continue fi separator @@ -82,16 +82,16 @@ if [ -s "$blocked" ]; then cat $blocked else - gettext "No blocked packages"; echo "" + gettext "No blocked packages"; newline fi && exit 0 ;; --short) newline - boldify "$(gettext "Installed packages")" + boldify $(gettext "Installed packages") separator for pkg in $(ls -1 $installed) do . $installed/$pkg/receipt - echo -n "$(colorize "$pkg" 32)"; indent 28 " $VERSION" + echo -n "$(colorize 32 $pkg)"; indent 28 " $VERSION" done separator boldify $(count_installed) @@ -110,12 +110,12 @@ if [ "$modifiers" ]; then modifiers=$installed/$pkg/modifiers if [ -f "$modifiers" ]; then - boldify "$(gettext "Modifiers for") $pkg" + boldify $(gettext "Modifiers for") $pkg separator cat $modifiers separator && newline else - echo -n "$(boldify "$pkg") " + echo -n "$(boldify $pkg) " gettext "package was not modified"; newline fi continue @@ -125,7 +125,7 @@ cat $installed/$pkg/files.list separator gettext "Installed files by"; echo -n " $pkg: " - colorize "$nb" 32 && newline + colorize 32 "$nb" && newline done && exit 0 ;; esac done @@ -145,7 +145,7 @@ . $pkg/receipt count=$(($count + 1)) [ "$count" != 1 ] && newline - gettext "Package :"; colorize " $PACKAGE" 32 + gettext "Package :"; colorize 32 " $PACKAGE" receipt_info done separator diff -r d1790128faac -r 0cb21eb5cf20 spk-mirror --- a/spk-mirror Fri May 18 21:24:30 2012 +0200 +++ b/spk-mirror Sat May 19 03:51:05 2012 -0500 @@ -46,7 +46,7 @@ gettext "Checking file:"; echo -n " $file" if ! wget -q -s -T 6 ${1}${list} 2>/dev/null; then newline - gettext "Unable to reach:"; colorize " $file" 31 + gettext "Unable to reach:"; colorize 31 " $file" newline && return 1 fi status @@ -67,7 +67,7 @@ nb=$(cat $extradb/$db/packages.$SUM 2>/dev/null | wc -l) echo -n "Extra DB :"; boldify " $db" echo -n "Extra URL :"; echo " $(cat $extradb/$db/mirror)" - gettext "Packages :"; colorize " $nb" 32 + gettext "Packages :"; colorize 32 " $nb" } # Add a package to packages.* lists @@ -119,13 +119,13 @@ boldify " $(cat $mirrorurl)" if [ -f "$mirrors" ]; then nb=$(cat $mirrors | wc -l) - gettext "Mirrors :"; colorize " $nb " $excolor + gettext "Mirrors :"; colorize $excolor " $nb " fi if [ -d "$extradb" ]; then extra=$(ls $extradb | wc -l) fi [ "$extra" != 0 ] || excolor=31 - gettext "Extra :"; colorize " $extra" $excolor + gettext "Extra :"; colorize $excolor " $extra" separator newline if [ "$list" ]; then @@ -163,10 +163,10 @@ extra_db if [ -d "$extradb/$db" ]; then gettext "Removing extra mirror:" - echo -n " $(boldify "$db")" + echo -n " $(boldify $db)" rm -rf $extradb/$db && status else - gettext "Not an extra mirror:"; colorize " $db" 31 + gettext "Not an extra mirror:"; colorize 31 " $db" fi newline && continue fi @@ -180,7 +180,7 @@ i486) arch="/" ;; esac url=${url}packages/${SLITAZ_RELEASE}${arch} - echo "URL: $(boldify "$url")" + echo "URL: $(boldify $url)" echo "$url" > $mirrorurl newline && continue fi @@ -192,7 +192,7 @@ else boldify $(gettext "Enabling: extra mirror") separator - echo "URL: $(boldify "$url")" + echo "URL: $(boldify $url)" if ! check_mirror $url; then continue fi @@ -214,7 +214,7 @@ fi newline gettext "Directory:"; boldify " $pkgsdir" - gettext "Packages :"; colorize " $nb" 32 + gettext "Packages :"; colorize 32 " $nb" cd $pkgsdir if [ ! "$nodb" ]; then time=$(date +%s) @@ -247,7 +247,7 @@ time=$(($(date +%s) - $time)) echo -n "$nb " gettext "packages added in" - echo " ${time}s ($(date "+%Y%m%d %H:%M"))" + echo " ${time}s ("$(date "+%Y%m%d %H:%M")")" fi newline # Handle --extra: Use local repo as extra mirror with symlinks @@ -279,7 +279,7 @@ newline && continue fi gettext "Can't handle:" - colorize " $url" 31 && newline ;; + colorize 31 " $url"; newline ;; esac done diff -r d1790128faac -r 0cb21eb5cf20 spk-rm --- a/spk-rm Fri May 18 21:24:30 2012 +0200 +++ b/spk-rm Sat May 19 03:51:05 2012 -0500 @@ -67,9 +67,9 @@ . $installed/$pkg/receipt if [ "$altered" ]; then - gettext "The following packages depend on"; colorize " $pkg" 31 + gettext "The following packages depend on"; colorize 31 " $pkg" for i in $altered; do - echo " $(colorize "$i" 32)" + echo " $(colorize 32 $i)" done fi @@ -169,7 +169,7 @@ # Show all new counted packages in verbose mode if [ "$verbose" ]; then - gettext "Removed packages:"; colorize " $count" 34 + gettext "Removed packages:"; colorize 34 " $count" fi exit 0 diff -r d1790128faac -r 0cb21eb5cf20 testsuite.sh --- a/testsuite.sh Fri May 18 21:24:30 2012 +0200 +++ b/testsuite.sh Sat May 19 03:51:05 2012 -0500 @@ -11,8 +11,8 @@ #./spk-rm bc # Check libspk.sh functions usage. -echo -n "$(boldify "Checking: libspk.sh functions")" -indent 34 "$(colorize $(grep "[a-z]() {" lib/libspk.sh | wc -l) 32)" +echo -n $(boldify "Checking: libspk.sh functions") +indent 34 $(colorize 32 $(grep "[a-z]() {" lib/libspk.sh | wc -l)) separator grep "[a-z]() {" lib/libspk.sh | while read line do