cookutils rev 427
cook: use libtaz.sh newline()
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sun May 20 00:04:46 2012 +0200 (2012-05-20) |
parents | 539039df832c |
children | e8f17691e9fb |
files | cook |
line diff
1.1 --- a/cook Sat May 19 23:42:58 2012 +0200 1.2 +++ b/cook Sun May 20 00:04:46 2012 +0200 1.3 @@ -308,7 +308,7 @@ 1.4 do 1.5 fgrep "$error" $LOGS/$pkg.log 1.6 done 1.7 - separator && echo "" 1.8 + separator && newline 1.9 } 1.10 1.11 # Copy all generic files (locale, pixmaps, .desktop). We use standard paths, 1.12 @@ -527,7 +527,7 @@ 1.13 tee -a $LOGS/$PACKAGE.log.$$ 1.14 cook $i || (echo -e "ERROR: can't cook dep '$i'\n" && \ 1.15 fgrep "remove: " $LOGS/$i.log && \ 1.16 - fgrep "Removing: " $LOGS/$i.log && echo "") | \ 1.17 + fgrep "Removing: " $LOGS/$i.log && newline) | \ 1.18 tee -a $LOGS/$PACKAGE.log.$$ && break 1.19 done 1.20 rm -f $CACHE/missing.dep 1.21 @@ -617,14 +617,14 @@ 1.22 # QA: No compile_rules so no error, valid. 1.23 mkdir -p $install 1.24 fi 1.25 - separator && echo "" 1.26 + separator && newline 1.27 1.28 # Execute testsuite. 1.29 if grep -q ^testsuite $receipt; then 1.30 echo "Running testsuite" 1.31 separator 1.32 testsuite $@ || exit 1 1.33 - separator && echo "" 1.34 + separator && newline 1.35 fi 1.36 } 1.37 1.38 @@ -772,6 +772,7 @@ 1.39 fi 1.40 } 1.41 1.42 +# Tic tac, tic tac... 1.43 tac() { 1.44 sed '1!G;h;$!d' $1 1.45 } 1.46 @@ -870,21 +871,23 @@ 1.47 cd $WOK && ls -1 1.48 separator 1.49 echo -n "Packages: " && ls | wc -l 1.50 - echo "" ;; 1.51 + newline ;; 1.52 activity) 1.53 cat $activity ;; 1.54 search) 1.55 # Just a simple search function, we dont need more actually. 1.56 query="$2" 1.57 - gettext -e "\nSearch results for:"; echo " $query" 1.58 + newline 1.59 + gettext "Search results for:"; echo " $query" 1.60 separator 1.61 cd $WOK && ls -1 | grep "$query" 1.62 - separator && echo "" ;; 1.63 + separator && newline ;; 1.64 setup) 1.65 # Setup a build environment 1.66 check_root 1.67 - echo "Cook: setting up the environment" | log 1.68 - gettext -e "\nSetting up your environment\n" 1.69 + echo "Cook: setup environment" | log 1.70 + newline 1.71 + gettext "Setting up your environment"; newline 1.72 separator && cd $SLITAZ 1.73 init_db_files 1.74 gettext "Checking for packages to install..."; echo 1.75 @@ -933,7 +936,8 @@ 1.76 # Setup for cross compiling. 1.77 arch=${1%-setup} 1.78 check_root 1.79 - echo "" 1.80 + echo "Cook: setup $ARCH cross environment" | log 1.81 + newline 1.82 boldify $(gettext "Setting up your cross environment") 1.83 separator 1.84 init_db_files 1.85 @@ -980,7 +984,7 @@ 1.86 colorize "C compiler is missing: ${HOST_SYSTEM}-gcc" 36 1.87 echo "Run 'cross compile' to cook a toolchain" 1.88 fi 1.89 - separator && echo "" ;; 1.90 + separator && newline ;; 1.91 test) 1.92 # Test a cook environment. 1.93 echo "Cook test: testing the cook environment" | log 1.94 @@ -991,7 +995,7 @@ 1.95 # Create the package folder and an empty receipt. 1.96 pkg="$2" 1.97 [ "$pkg" ] || usage 1.98 - echo "" 1.99 + newline 1.100 if [ -d "$WOK/$pkg" ]; then 1.101 echo -n "$pkg " && gettext "package already exists." 1.102 echo -e "\n" && exit 1 1.103 @@ -1001,7 +1005,7 @@ 1.104 gettext "Preparing the package receipt..." 1.105 cp $DATA/receipt . 1.106 sed -i s"/^PACKAGE=.*/PACKAGE=\"$pkg\"/" receipt 1.107 - status && echo "" 1.108 + status && newline 1.109 1.110 # Interactive mode, asking and seding. 1.111 case "$3" in 1.112 @@ -1024,7 +1028,7 @@ 1.113 # Web site. 1.114 echo -n "Web site : " ; read anser 1.115 sed -i s#'WEB_SITE=\"\"'#"WEB_SITE=\"$anser\""# receipt 1.116 - echo "" 1.117 + newline 1.118 # Wget URL. 1.119 echo "Wget URL to download source tarball." 1.120 echo "Example : \$GNU_MIRROR/\$PACKAGE/\$TARBALL" 1.121 @@ -1040,11 +1044,11 @@ 1.122 echo -n "Are you going to write a description ? (y/N) : " ; read anser 1.123 if [ "$anser" = "y" ]; then 1.124 echo -n "Creating the description.txt file..." 1.125 - echo "" > $WOK/$pkg/description.txt && status 1.126 + newline > $WOK/$pkg/description.txt && status 1.127 fi 1.128 separator 1.129 gettext -e "Receipt is ready to use.\n" 1.130 - echo "" ;; 1.131 + newline ;; 1.132 esac ;; 1.133 list) 1.134 # Cook a list of packages (better use the Cooker since it will order 1.135 @@ -1062,12 +1066,12 @@ 1.136 check_root 1.137 gettext -e "\nCleaning all packages files..." 1.138 rm -rf $WOK/*/taz $WOK/*/install $WOK/*/source 1.139 - status && echo "" ;; 1.140 + status && newline ;; 1.141 clean-src) 1.142 check_root 1.143 gettext -e "\nCleaning all packages sources..." 1.144 rm -rf $WOK/*/source 1.145 - status && echo "" ;; 1.146 + status && newline ;; 1.147 pkgdb) 1.148 # Create suitable packages list for TazPKG and only for built packages 1.149 # as well as flavors files for TazLiTo. We dont need logs since we do it 1.150 @@ -1085,7 +1089,7 @@ 1.151 live=$SLITAZ/live 1.152 echo "cook:pkgdb" > $command 1.153 echo "Cook pkgdb: Creating all packages lists" | log 1.154 - echo "" 1.155 + newline 1.156 gettext "Creating lists for: "; echo "$PKGS" 1.157 separator 1.158 gettext "Cook pkgdb started: "; date "+%Y-%m-%d %H:%M" 1.159 @@ -1189,7 +1193,7 @@ 1.160 done 1.161 cp -f $live/*.flavor $live/flavors.list $PKGS 1.162 separator && gettext "Flavors size: "; du -sh $live | awk '{print $1}' 1.163 - echo "" && rm -f $command ;; 1.164 + newline && rm -f $command ;; 1.165 *) 1.166 # Just cook and generate a package. 1.167 check_root 1.168 @@ -1197,7 +1201,7 @@ 1.169 pkg="$1" 1.170 [ -z "$pkg" ] && usage 1.171 receipt="$WOK/$pkg/receipt" 1.172 - check_pkg_in_wok && echo "" 1.173 + check_pkg_in_wok && newline 1.174 1.175 unset inst 1.176 unset_receipt 1.177 @@ -1220,7 +1224,7 @@ 1.178 echo "cook: This package is not included in: $ARCH" 1.179 [ "$CROSS_BUGS" ] && echo "bugs: $CROSS_BUGS" 1.180 echo "Cook skip: $pkg is not included in: $ARCH" | log 1.181 - echo "" && exit 1 1.182 + newline && exit 1 1.183 fi ;; 1.184 esac 1.185 1.186 @@ -1231,7 +1235,7 @@ 1.187 echo "cook: $pkg doesn't cook or is not included in: $ARCH" 1.188 [ "$CROSS_BUGS" ] && echo "bugs: $CROSS_BUGS" 1.189 echo "Cook skip: $pkg doesn't cook or is not included in: $ARCH" | log 1.190 - echo "" && exit 1 1.191 + newline && exit 1 1.192 fi 1.193 1.194 # Skip blocked, 3 lines also for the Cooker. 1.195 @@ -1254,7 +1258,7 @@ 1.196 --clean|-c) 1.197 gettext -e "Cleaning:"; echo -n " $pkg" 1.198 cd $WOK/$pkg && rm -rf install taz source 1.199 - status && echo "" && exit 0 ;; 1.200 + status && newline && exit 0 ;; 1.201 --install|-i) 1.202 inst='yes' ;; 1.203 --getsrc|-gs) 1.204 @@ -1264,11 +1268,11 @@ 1.205 --block|-b) 1.206 gettext "Blocking:"; echo -n " $pkg" 1.207 [ $(grep "^$pkg$" $blocked) ] || echo "$pkg" >> $blocked 1.208 - status && echo "" && exit 0 ;; 1.209 + status && newline && exit 0 ;; 1.210 --unblock|-ub) 1.211 gettext "Unblocking:"; echo -n " $pkg" 1.212 sed -i "/^${pkg}$/"d $blocked 1.213 - status && echo "" && exit 0 ;; 1.214 + status && newline && exit 0 ;; 1.215 1.216 esac 1.217 1.218 @@ -1276,11 +1280,11 @@ 1.219 for wanted in $WANTED ; do 1.220 if grep -q "^$wanted$" $blocked; then 1.221 echo "WANTED package is blocked: $wanted" | tee $LOGS/$pkg.log 1.222 - echo "" && rm -f $command && exit 1 1.223 + newline && rm -f $command && exit 1 1.224 fi 1.225 if grep -q "^$wanted$" $broken; then 1.226 echo "WANTED package is broken: $wanted" | tee $LOGS/$pkg.log 1.227 - echo "" && rm -f $command && exit 1 1.228 + newline && rm -f $command && exit 1 1.229 fi 1.230 if [ ! -d "$WOK/$wanted/install" ]; then 1.231 cook "$wanted" || exit 1 1.232 @@ -1306,7 +1310,7 @@ 1.233 # Time and summary 1.234 time=$(($(date +%s) - $time)) 1.235 summary | tee -a $LOGS/$pkg.log 1.236 - echo "" 1.237 + newline 1.238 1.239 # Install package if requested 1.240 if [ "$inst" ]; then