cookutils rev 717 slitaz-tank
cook: Add gettext stuff thats in default branch of cookutils.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Tue Apr 14 04:30:13 2015 +0000 (2015-04-14) |
parents | 99372fa1d17e |
children | 5fb0c06f85e7 |
files | cook |
line diff
1.1 --- a/cook Fri Feb 08 03:25:37 2013 +0000 1.2 +++ b/cook Tue Apr 14 04:30:13 2015 +0000 1.3 @@ -1,7 +1,7 @@ 1.4 #!/bin/sh 1.5 # 1.6 # Cook - A tool to cook and generate SliTaz packages. Read the README 1.7 -# before adding or modifing any code in cook! 1.8 +# before adding or modifying any code in cook! 1.9 # 1.10 # Copyright (C) SliTaz GNU/Linux - GNU gpl v3 1.11 # Author: Christophe Lincoln <pankso@slitaz.org> 1.12 @@ -10,6 +10,19 @@ 1.13 . /usr/lib/slitaz/libcookorder.sh 1.14 . /usr/lib/slitaz/libcookiso.sh 1.15 1.16 +VERSION="3.2" 1.17 + 1.18 +# Internationalization. 1.19 +. /usr/bin/gettext.sh 1.20 +TEXTDOMAIN='cook' 1.21 +export TEXTDOMAIN 1.22 + 1.23 +_() echo -e "$(eval_gettext "$1")" 1.24 +_n() echo -en "$(eval_gettext "$1")" 1.25 +# to disable i18n: 1.26 +# _() echo -e "$1" 1.27 +# _n() echo -en "$1" 1.28 + 1.29 COMMAND="$1" 1.30 1.31 # 1.32 @@ -19,47 +32,49 @@ 1.33 usage() { 1.34 cat << EOT 1.35 1.36 -$(echo -e "\033[1m$(gettext "Usage:")\033[0m") cook [package|command] [list|--option] 1.37 +$(_ "\033[1mUsage:\033[0m cook [package|command] [list|--option]") 1.38 1.39 -$(echo -e "\033[1m$(gettext "Commands:")\033[0m") 1.40 - usage|help $(gettext "Display this short usage.") 1.41 - setup $(gettext "Setup your build environment.") 1.42 - *-setup $(gettext "Setup a cross environment.") 1.43 - test $(gettext "Test environment and cook a package.") 1.44 - list-wok $(gettext "List packages in the wok.") 1.45 - search $(gettext "Simple packages search function.") 1.46 - new $(gettext "Create a new package with a receipt".) 1.47 - list $(gettext "Cook a list of packages.") 1.48 - clean-wok $(gettext "Clean-up all packages files.") 1.49 - clean-src $(gettext "Clean-up all packages sources.") 1.50 - upwok $(gettext "Update wok.") 1.51 - gen-wok-db $(gettext "Build cook order files.") 1.52 - gen-src $(gettext "Build source list.") 1.53 - check-incoming $(gettext "Move incoming packages to packages folder.") 1.54 - gen-cooklist $(gettext "Make cook order list.") 1.55 - check-src $(gettext "Check upstream tarball for package in the wok.") 1.56 - maintainers $(gettext "List all maintainers in the wok.") 1.57 - maintained-by $(gettext "List packages maintained by a contributor.") 1.58 - tags $(gettext "List all tags used in wok receipts.") 1.59 - pkgdb $(gettext "Create packages DB lists and flavors.") 1.60 - unbuild $(gettext "List all unbuild packages.") 1.61 +$(_ "\033[1mCommands:\033[0m") 1.62 + usage|help $(_ "Display this short usage.") 1.63 + setup $(_ "Setup your build environment.") 1.64 + *-setup $(_ "Setup a cross environment.") 1.65 + test $(_ "Test environment and cook a package.") 1.66 + list-wok $(_ "List packages in the wok.") 1.67 + search $(_ "Simple packages search function.") 1.68 + new $(_ "Create a new package with a receipt.") 1.69 + list $(_ "Cook a list of packages.") 1.70 + clean-wok $(_ "Clean-up all packages files.") 1.71 + clean-src $(_ "Clean-up all packages sources.") 1.72 + uncook $(_ "Check for uncooked packages") 1.73 + pkgdb $(_ "Create packages DB lists and flavors.") 1.74 + upwok $(_ "Update wok.") 1.75 + gen-wok-db $(_ "Build cook order files.") 1.76 + gen-src $(_ "Build source list.") 1.77 + check-incoming $(_ "Move incoming packages to packages folder.") 1.78 + gen-cooklist $(_ "Make cook order list.") 1.79 + check-src $(_ "Check upstream tarball for package in the wok.") 1.80 + maintainers $(_ "List all maintainers in the wok.") 1.81 + maintained-by $(_ "List packages maintained by a contributor.") 1.82 + tags $(_ "List all tags used in wok receipts.") 1.83 + unbuild $(_ "List all unbuild packages.") 1.84 1.85 -$(echo -e "\033[1m$(gettext "Options:")\033[0m") 1.86 - --clean|-c Cook : $(gettext "clean the package in the wok.") 1.87 - --install|-i Cook : $(gettext "cook and install the package.") 1.88 - --getsrc|-gs Cook : $(gettext "get the package source tarball.") 1.89 - --block|-b Cook : $(gettext "Block a package so cook will skip it.") 1.90 - --unblock|-ub Cook : $(gettext "Unblock a blocked package.") 1.91 - --interactive|-x New : $(gettext "create a receipt interactively.") 1.92 - --local Upwok : $(gettext "update wok local changes in wok-hg.") 1.93 - --wok|-w Setup : $(gettext "clone the cooking wok from Hg repo.") 1.94 - --stable Setup : $(gettext "clone the stable wok from Hg repo.") 1.95 - --undigest Setup : $(gettext "clone the undigest wok from Hg repo.") 1.96 - --tiny Setup: $(gettext "clone the tiny SliTaz wok from Hg repo.") 1.97 - --forced Setup: $(gettext "force reinstall of chroot packages.") 1.98 - --flavors Pkgdb : $(gettext "create up-to-date flavors files.") 1.99 - --full Unbuild : $(gettext "create a full unbuild list.") 1.100 - --list Unbuild : $(gettext "Copy unbuild list into your cooklist.") 1.101 +$(_ "\033[1mOptions:\033[0m") 1.102 + --clean|-c Cook : $(_ "clean the package in the wok.") 1.103 + --install|-i Cook : $(_ "cook and install the package.") 1.104 + --getsrc|-gs Cook : $(_ "get the package source tarball.") 1.105 + --block|-b Cook : $(_ "block a package so cook will skip it.") 1.106 + --unblock|-ub Cook : $(_ "unblock a blocked package.") 1.107 + 1.108 + --interactive|-x New : $(_ "create a receipt interactively.") 1.109 + --local Upwok: $(_ "update wok local changes in wok-hg.") 1.110 + --wok Setup: $(_ "clone the cooking wok from Hg repo.") 1.111 + --stable Setup: $(_ "clone the stable wok from Hg repo.") 1.112 + --undigest Setup: $(_ "clone the undigest wok from Hg repo.") 1.113 + --tiny Setup: $(_ "clone the tiny SliTaz wok from Hg repo.") 1.114 + --forced Setup: $(_ "force reinstall of chroot packages.") 1.115 + --flavors Pkgdb: $(_ "create up-to-date flavors files.") 1.116 + --full Unbuild: $(_ "create a full unbuild list.") 1.117 + --list Unbuild: $(_ "Copy unbuild list into your cooklist.") 1.118 1.119 EOT 1.120 exit 0 1.121 @@ -73,15 +88,17 @@ 1.122 1.123 # check if $value is empty 1.124 if_empty_value() { 1.125 - if [ -z "$value" ]; then 1.126 - gettext "QA: empty variable:"; echo -e " ${var}=\"\"\n" 1.127 - exit 1 1.128 - fi 1.129 + if [ -z "$value" ]; then 1.130 + # L10n: QA is quality assurance 1.131 + _ "QA: empty variable: \${var}=\"\""; newline 1.132 + exit 1 1.133 + fi 1.134 } 1.135 1.136 + 1.137 # QA: check a receipt consistency before building. 1.138 receipt_quality() { 1.139 - gettext -e "QA: checking package receipt...\n" 1.140 + _ "QA: checking package receipt..." 1.141 unset online 1.142 if ifconfig | grep -q -A 1 "^[a-z]*[0-9]" | fgrep 'addr:'; then 1.143 online="online" 1.144 @@ -97,8 +114,9 @@ 1.145 [ -z "$value" ] && value="empty" 1.146 valid="$PKGS_CATEGORIES" 1.147 if ! echo "$valid" | grep -q -w "$value"; then 1.148 - gettext "QA: unknown category:"; echo -e " $value\n" 1.149 - exit 1 1.150 + _ "QA: unknown category: \$value" 1.151 + _ "Please, use one of: \$valid" | busybox fold -s 1.152 + newline; exit 1 1.153 fi ;; 1.154 WEB_SITE) 1.155 # We don't check WGET_URL since if dl is needed it will fail. 1.156 @@ -108,11 +126,11 @@ 1.157 case $value in 1.158 https://*) 1.159 if ! wget -T $TIMEOUT --spider --no-check-certificate $value 2>/dev/null; then 1.160 - gettext "QA: Unable to reach:"; echo -e " $value" 1.161 + _ "QA: Unable to reach: \$value" 1.162 fi ;; 1.163 http://*|ftp://*) 1.164 if ! busybox wget -T $TIMEOUT -s $value 2>/dev/null; then 1.165 - gettext "QA: Unable to reach:"; echo -e " $value" 1.166 + _ "QA: Unable to reach: \$value" 1.167 fi ;; 1.168 esac 1.169 esac 1.170 @@ -150,7 +168,7 @@ 1.171 kvers=$(grep ^VERSION= $WOK/linux/receipt | cut -d '"' -f 2) 1.172 kbasevers=${kvers:0:3} 1.173 fi 1.174 - # Python version 1.175 + # Python version 1.176 if [ -f "$WOK/python/receipt" ]; then 1.177 pyvers=$(grep ^VERSION= $WOK/python/receipt | cut -d '"' -f 2) 1.178 fi 1.179 @@ -167,7 +185,7 @@ 1.180 local tarball 1.181 tarball=$pkgsrc.tar.bz2 1.182 [ "$LZMA_SRC" ] && tarball=$lzma_tarball 1.183 - gettext "Creating tarball: "; echo "$tarball" 1.184 + _ "Creating tarball: \$tarball" 1.185 if [ "$LZMA_SRC" ]; then 1.186 tar -c $pkgsrc | lzma e $SRC/$tarball -si $LZMA_SET_DIR || exit 1 1.187 LZMA_SRC="" 1.188 @@ -183,7 +201,7 @@ 1.189 get_source() { 1.190 pwd=$(pwd) 1.191 for file in $@; do 1.192 - gettext "Getting source from url:"; echo " ${file#*|}" 1.193 + _ "Getting source from url: \${file#*|}" 1.194 if [ "$file" = "$PATCH" -o "$file" = "$orig_url_patch" ]; then 1.195 SAVE_FILE="$SRC/$PTARBALL" 1.196 else 1.197 @@ -193,35 +211,35 @@ 1.198 http://*|ftp://*) 1.199 # Busybox Wget is better! 1.200 busybox wget $WGET_OPTIONS -T $TIMEOUT -c -O $SAVE_FILE $file || \ 1.201 - (echo -e "ERROR: wget $file" && exit 1) ;; 1.202 + (_ "ERROR: wget \$file" && exit 1) ;; 1.203 https://*) 1.204 wget $WGET_OPTIONS -T $TIMEOUT -c --no-check-certificate -O $SAVE_FILE $file || \ 1.205 - (echo -e "ERROR: wget $file" && exit 1) ;; 1.206 + (_ "ERROR: wget \$file" && exit 1) ;; 1.207 hg*|mercurial*) 1.208 if $(echo "$file" | fgrep -q "hg|"); then 1.209 url=${file#hg|} 1.210 else 1.211 url=${file#mercurial|} 1.212 fi 1.213 - gettext -e "Getting source from Hg...\n" 1.214 - echo "URL: $url" 1.215 - gettext "Cloning to: "; echo "$pwd/$pkgsrc" 1.216 + _ "Getting source from Hg..." 1.217 + _ "URL: \$url" 1.218 + _ "Cloning to: \$pwd/\$pkgsrc" 1.219 if [ "$BRANCH" ]; then 1.220 - echo "Hg branch: $BRANCH" 1.221 + _ "Hg branch: \$BRANCH" 1.222 hg clone $url --rev $BRANCH $pkgsrc || \ 1.223 - (echo "ERROR: hg clone $url --rev $BRANCH" && exit 1) 1.224 + (_ "ERROR: hg clone \$url --rev \$BRANCH" && exit 1) 1.225 else 1.226 - hg clone $url $pkgsrc || (echo "ERROR: hg clone $url" && exit 1) 1.227 + hg clone $url $pkgsrc || (_ "ERROR: hg clone \$url" && exit 1) 1.228 fi 1.229 create_tarball ;; 1.230 git*) 1.231 [ -f $INSTALLED/git/receipt ] || tazpkg get-install git 1.232 url=${file#git|} 1.233 - gettext -e "Getting source from Git...\n" 1.234 - echo "URL: $url" 1.235 - git clone $url $pkgsrc || (echo "ERROR: git clone $url" && exit 1) 1.236 + _ "Getting source from Git..." 1.237 + _ "URL: \$url" 1.238 + git clone $url $pkgsrc || (_ "ERROR: git clone \$url" && exit 1) 1.239 if [ "$BRANCH" ]; then 1.240 - echo "Git branch: $BRANCH" 1.241 + _ "Git branch: \$BRANCH" 1.242 cd $pkgsrc && git checkout $BRANCH && cd .. 1.243 fi 1.244 create_tarball ;; 1.245 @@ -232,8 +250,8 @@ 1.246 else 1.247 url=${file#bazaar|} 1.248 fi 1.249 - gettext -e "Getting source from BZR...\n" 1.250 - echo "URL: $url" 1.251 + _ "Getting source from BZR..." 1.252 + _ "URL: \$url" 1.253 bzr branch $url $pkgsrc 1.254 create_tarball ;; 1.255 cvs*) 1.256 @@ -241,10 +259,10 @@ 1.257 url=${file#cvs|} 1.258 mod=$PACKAGE 1.259 [ "$CVS_MODULE" ] && mod=$CVS_MODULE 1.260 - gettext -e "Getting source from CVS...\n" 1.261 - echo "URL: $url" 1.262 - [ "$CVS_MODULE" ] && echo "CVS module: $mod" 1.263 - gettext "Cloning to: "; echo "$pwd/$mod" 1.264 + _ "Getting source from CVS..." 1.265 + _ "URL: \$url" 1.266 + [ "$CVS_MODULE" ] && _ "CVS module: \$mod" 1.267 + _ "Cloning to: \$pwd/\$mod" 1.268 cvs -d:$url co $mod && mv $mod $pkgsrc 1.269 create_tarball ;; 1.270 svn*|subversion*) 1.271 @@ -254,8 +272,8 @@ 1.272 else 1.273 url=${file#subversion|} 1.274 fi 1.275 - gettext -e "Getting source from SVN...\n" 1.276 - echo "URL: $url" 1.277 + _ "Getting source from SVN..." 1.278 + _ "URL: \$url" 1.279 if [ "$BRANCH" ]; then 1.280 echo t | svn co $url -r $BRANCH $pkgsrc 1.281 else 1.282 @@ -263,7 +281,7 @@ 1.283 fi 1.284 create_tarball ;; 1.285 *) 1.286 - gettext -e "\nERROR: Unable to handle:"; echo -e " $file \n" | \ 1.287 + (newline; _ "ERROR: Unable to handle: \$file"; newline)| \ 1.288 tee -a $LOGS/$PACKAGE.log 1.289 exit 1 ;; 1.290 esac 1.291 @@ -273,7 +291,7 @@ 1.292 # get source tarball 1.293 # $1 = --extract 1.294 getsrc() { 1.295 - gettext "Getting source for:"; echo " $pkg" 1.296 + _ "Getting source for: \$pkg" 1.297 set_paths 1.298 [ -f "$SRC/$lzma_tarball" ] && \ 1.299 TARBALL="$lzma_tarball" 1.300 @@ -315,8 +333,8 @@ 1.301 fi 1.302 fi 1.303 1.304 - echo -e "Tarball: $SRC/$TARBALL" 1.305 - [ "$PATCH" ] && echo -e "Patch: $SRC/$PTARBALL" 1.306 + _ "Tarball: \$SRC/\$TARBALL" 1.307 + [ "$PATCH" ] && _ "Patch: \$SRC/\$PTARBALL" 1.308 } 1.309 1.310 # the base function to download sources when offline 1.311 @@ -377,11 +395,12 @@ 1.312 1.313 # Extract source package. 1.314 extract_source() { 1.315 - gettext "Extracting:"; echo " $TARBALL" 1.316 + _ "Extracting: \$TARBALL" 1.317 case "$TARBALL" in 1.318 *.tar.gz|*.tgz) tar xzf $SRC/$TARBALL 2>/dev/null ;; 1.319 *.tar.bz2|*.tbz|*.tbz2) tar xjf $SRC/$TARBALL 2>/dev/null ;; 1.320 *.tar.lzma) tar xaf $SRC/$TARBALL ;; 1.321 + *.tar.lz|*.tlz) lzip -d < $SRC/$TARBALL | tar xf - 2>/dev/null ;; 1.322 *.tar) tar xf $SRC/$TARBALL ;; 1.323 *.zip|*.xpi) unzip -o $SRC/$TARBALL ;; 1.324 *.xz) unxz -c $SRC/$TARBALL | tar xf - ;; 1.325 @@ -417,7 +436,7 @@ 1.326 fi 1.327 fi 1.328 if [ -d "$tmpsrc/$pkgsrc" ]; then 1.329 - gettext "Repacking source is enabled:"; echo " LZMA_SRC" 1.330 + _ "Repacking source is enabled: LZMA_SRC" 1.331 TARBALL=$lzma_tarball 1.332 cd $tmpsrc 1.333 if [ -x /usr/bin/optipng ]; then 1.334 @@ -440,41 +459,49 @@ 1.335 size=$(du -sh $INCOMING/$pkg-${VERSION}*.tazpkg | awk '{print $1}') 1.336 files=$(cat $WOK/$pkg/taz/$pkg-*/files.list | wc -l) 1.337 [ "$TARBALL" ] && srcsize=$(du -sh $SRC/$TARBALL | awk '{print $1}') 1.338 - cookdate=$(date "+%Y-%m-%d %H:%M") 1.339 + cookdate=$(date "$(_ '+%Y-%m-%d %H:%M')") 1.340 sec=$time 1.341 div=$(( ($time + 30) / 60)) 1.342 - [ "$div" != 0 ] && min="~ ${div}m" 1.343 - gettext "Summary for:"; echo " $PACKAGE $VERSION" 1.344 + # L10n: 'm' is for minutes (approximate cooking time) 1.345 + min=$(_n "~ \${div}m"); [ "$div" = 0 ] && min="" 1.346 + _ "Summary for: \$PACKAGE \$VERSION" 1.347 separator 1.348 - [ "$srcdir" ] && echo "Source dir : $srcdir" 1.349 - [ "$TARBALL" ] && echo "Src file : $TARBALL" 1.350 - [ "$srcsize" ] && echo "Src size : $srcsize" 1.351 - [ "$prod" ] && echo "Produced : $prod" 1.352 - cat << EOT 1.353 -Packed : $fs 1.354 -Compressed : $size 1.355 -Files : $files 1.356 -Cook time : ${sec}s $min 1.357 -Cook date : $cookdate 1.358 -Host arch : $ARCH 1.359 -$(separator) 1.360 -EOT 1.361 + # L10n: keep the same width of translations to get a consistent view 1.362 + [ "$srcdir" ] && _ "Source dir : \$srcdir" 1.363 + [ "$TARBALL" ] && _ "Src file : \$TARBALL" 1.364 + [ "$srcsize" ] && _ "Src size : \$srcsize" 1.365 + [ "$prod" ] && _ "Produced : \$prod" 1.366 + _ "Packed : \$fs" 1.367 + _ "Compressed : \$size" 1.368 + _ "Files : \$files" 1.369 + # L10n: 's' is for seconds (cooking time) 1.370 + _ "Cook time : \${sec}s \$min" 1.371 + _ "Cook date : \$cookdate" 1.372 + _ "Host arch : \$ARCH" 1.373 + separator 1.374 } 1.375 1.376 # Display debugging error info. 1.377 debug_info() { 1.378 - echo -e "\nDebug information" 1.379 - separator 1.380 - echo "Cook date: $(date '+%Y-%m-%d %H:%M')" 1.381 + newline; _ "Debug information"; separator 1.382 + # L10n: specify your format of date and time (to help: man date) 1.383 + # L10n: not bad one is '+%x %R' 1.384 + datenow=$(date "$(_ '+%Y-%m-%d %H:%M')") 1.385 + _ "Cook date: \$datenow" 1.386 + # L10n: Please, translate all messages beginning with ERROR in a same way 1.387 + lerror=$(_n "ERROR") 1.388 for error in \ 1.389 - ERROR "No package" "cp: can't" "can't open" "can't cd" \ 1.390 - "error:" "fatal error:" "rm: can't remove" "cp: can't stat" \ 1.391 - "undefined reference to" "Unable to connect to" \ 1.392 - "link: cannot find the library" "CMake Error" 1.393 + ERROR $lerror "No package" "cp: can't" "can't open" "can't cd" \ 1.394 + "error:" "fatal error:" "undefined reference to" \ 1.395 + "Unable to connect to" "link: cannot find the library" \ 1.396 + "CMake Error" ": No such file or directory" \ 1.397 + "rm: can't remove" "cp: can't stat" 1.398 do 1.399 fgrep "$error" $LOGS/$pkg.log 1.400 - done 1.401 - separator && newline 1.402 + done > $LOGS/$pkg.log.debug_info 2>&1 1.403 + cat $LOGS/$pkg.log.debug_info 1.404 + rm -f $LOGS/$pkg.log.debug_info 1.405 + separator; newline 1.406 } 1.407 1.408 # Copy all generic files (locale, pixmaps, .desktop). We use standard paths, 1.409 @@ -532,7 +559,7 @@ 1.410 mkdir -p $fs/usr/share/applications 1.411 cp -a $stuff/$PACKAGE.desktop $fs/usr/share/applications 1.412 fi 1.413 - 1.414 + 1.415 # Add custom licenses 1.416 if [ -d "$stuff/licenses" ]; then 1.417 mkdir -p $fs/usr/share/licenses 1.418 @@ -540,16 +567,16 @@ 1.419 fi 1.420 } 1.421 1.422 -# Find and strip : --strip-all (-s) or --strip-debug on static libs as well 1.423 -# as removing uneeded files like in Python packages. Cross compiled binaries 1.424 +# Find and strip: --strip-all (-s) or --strip-debug on static libs as well 1.425 +# as removing unneeded files like in Python packages. Cross compiled binaries 1.426 # must be stripped with cross-tools aka $ARCH-slitaz-*-strip 1.427 strip_package() 1.428 { 1.429 case "$ARCH" in 1.430 - arm|x86_64) export STRIP=${HOST_SYSTEM}-strip ;; 1.431 + arm*|x86_64) export STRIP=${HOST_SYSTEM}-strip ;; 1.432 *) export STRIP=strip ;; 1.433 esac 1.434 - gettext "Executing strip on all files..." 1.435 + _n "Executing strip on all files..." 1.436 for dir in $fs/bin $fs/sbin $fs/usr/bin $fs/usr/sbin $fs/usr/games 1.437 do 1.438 if [ -d "$dir" ]; then 1.439 @@ -562,7 +589,7 @@ 1.440 1.441 # Remove Python .pyc and .pyo from packages. 1.442 if echo "$PACKAGE $DEPENDS" | fgrep -q "python"; then 1.443 - gettext "Removing Python compiled files..." 1.444 + _n "Removing Python compiled files..." 1.445 find $fs -type f -name "*.pyc" -delete 2>/dev/null 1.446 find $fs -type f -name "*.pyo" -delete 2>/dev/null 1.447 status 1.448 @@ -570,7 +597,7 @@ 1.449 1.450 # Remove Perl perllocal.pod and .packlist from packages. 1.451 if echo "$DEPENDS" | fgrep -q "perl"; then 1.452 - gettext "Removing Perl compiled files..." 1.453 + _n "Removing Perl compiled files..." 1.454 find $fs -type f -name "perllocal.pod" -delete 2>/dev/null 1.455 find $fs -type f -name ".packlist" -delete 2>/dev/null 1.456 status 1.457 @@ -581,19 +608,19 @@ 1.458 remove_deps() { 1.459 # Now remove installed build deps. 1.460 diff="$CACHE/installed.cook.diff" 1.461 - if [ -s "$CACHE/installed.cook.diff" ]; then 1.462 + if [ -s "$diff" ]; then 1.463 deps=$(cat $diff | grep ^+[a-zA-Z0-9] | sed s/^+//) 1.464 nb=$(cat $diff | grep ^+[a-zA-Z0-9] | wc -l) 1.465 - gettext "Build dependencies to remove:"; echo " $nb" 1.466 - gettext "Removing:" 1.467 + _n "Build dependencies to remove: "; echo $nb $root 1.468 + _n "Removing:" 1.469 for dep in $deps 1.470 do 1.471 echo -n " $dep" 1.472 - tazpkg remove $dep --auto --root=/ >/dev/null 1.473 + echo 'y' | tazpkg remove $dep --auto --root=$root >/dev/null 1.474 done 1.475 - echo -e "\n" 1.476 + newline; newline 1.477 # Keep the last diff for debug and info. 1.478 - mv -f $CACHE/installed.cook.diff $CACHE/installed.diff 1.479 + mv -f $diff $CACHE/installed.diff 1.480 fi 1.481 } 1.482 1.483 @@ -618,28 +645,26 @@ 1.484 1.485 # The main cook function. 1.486 cookit() { 1.487 - echo "Cook: $PACKAGE $VERSION" 1.488 - separator 1.489 + _ "Cook: \$PACKAGE \$VERSION"; separator 1.490 set_paths 1.491 1.492 # Handle cross-tools. 1.493 case "$ARCH" in 1.494 - arm|x86_64) 1.495 + arm*|x86_64) 1.496 # CROSS_COMPILE is used by at least Busybox and the kernel to set 1.497 - # the cross-tools prefix but first check if sysroot is used. 1.498 - # the cross-tools prefix. Sysroot the the root of our target arch 1.499 + # the cross-tools prefix. Sysroot is the root of our target arch 1.500 sysroot=$CROSS_TREE/sysroot 1.501 tools=$CROSS_TREE/tools 1.502 # Set root path when cross compiling. ARM tested but not x86_64 1.503 # When cross compiling we must install build deps in $sysroot. 1.504 arch="-${ARCH}" 1.505 root=$sysroot 1.506 - echo "$ARCH sysroot: $sysroot" 1.507 - echo "Adding $tools/bin to PATH" 1.508 + _ "\$ARCH sysroot: \$sysroot" 1.509 + _ "Adding \$tools/bin to PATH" 1.510 export PATH=$PATH:$tools/bin 1.511 export PKG_CONFIG_PATH=$sysroot/usr/lib/pkgconfig 1.512 export CROSS_COMPILE=${HOST_SYSTEM}- 1.513 - echo "Using cross-tools: $CROSS_COMPILE" 1.514 + _ "Using cross-tools: \$CROSS_COMPILE" 1.515 if [ "$ARCH" == "x86_64" ]; then 1.516 export CC="${HOST_SYSTEM}-gcc -m64" 1.517 export CXX="${HOST_SYSTEM}-g++ -m64" 1.518 @@ -651,27 +676,29 @@ 1.519 export AS=${HOST_SYSTEM}-as 1.520 export RANLIB=${HOST_SYSTEM}-ranlib 1.521 export LD=${HOST_SYSTEM}-ld 1.522 - export STRIP=${HOST_SYSTEM}-strip ;; 1.523 + export STRIP=${HOST_SYSTEM}-strip 1.524 + export LIBTOOL=${HOST_SYSTEM}-libtool ;; 1.525 *) 1.526 root="/" ;; 1.527 esac 1.528 1.529 [ "$QA" ] && receipt_quality 1.530 cd $pkgdir 1.531 - rm -rf install taz source 1.532 + [ "$continue" ] || rm -rf source 2> /dev/null 1.533 + rm -rf install taz 2> /dev/null 1.534 1.535 # Disable -pipe if less than 512Mb free RAM. 1.536 free=$(free | fgrep '/+ buffers' | tr -s ' ' | cut -f 4 -d ' ') 1.537 if [ "$free" -lt 524288 ] && [ "$CFLAGS" != "${CFLAGS/-pipe}" ]; then 1.538 - gettext -e "Disabling -pipe compile flag: $free RAM\n" 1.539 - CFLAGS="${CFLAGS/-pipe}" && CFLAGS=$(echo "$CFLAGS" | tr -s ' ') 1.540 - CXXFLAGS="${CXXFLAGS/-pipe}" && \ 1.541 - CXXFLAGS=$(echo "$CXXFLAGS" | tr -s ' ') 1.542 + _ "Disabling -pipe compile flag: \$free RAM" 1.543 + CFLAGS="${CFLAGS/-pipe}" && CFLAGS=$(echo "$CFLAGS" | tr -s ' ') 1.544 + CXXFLAGS="${CXXFLAGS/-pipe}" && CXXFLAGS=$(echo "$CXXFLAGS" | tr -s ' ') 1.545 fi 1.546 unset free 1.547 1.548 # Export flags and path to be used by make and receipt. 1.549 DESTDIR=$pkgdir/install 1.550 + # FIXME: L10n: Is this the right time for 'LC_ALL=C LANG=C'? 1.551 export DESTDIR MAKEFLAGS CFLAGS CXXFLAGS CONFIG_SITE LC_ALL=C LANG=C 1.552 #export LDFLAGS 1.553 1.554 @@ -690,8 +717,8 @@ 1.555 else 1.556 BDEPS="$BUILD_DEPENDS" 1.557 fi 1.558 - [ "$BDEPS" ] && gettext -e "Checking build dependencies...\n" 1.559 - [ "$root" != "/" ] && echo "Using packages DB: ${root}$DB" 1.560 + [ "$BDEPS" ] && _ "Checking build dependencies..." 1.561 + [ "$root" != "/" ] && _ "Using packages DB: \${root}\$DB" 1.562 for dep in $BDEPS 1.563 do 1.564 for i in $dep 1.565 @@ -718,7 +745,7 @@ 1.566 echo $i >> $CACHE/installed.web 1.567 else 1.568 # So package exists in wok but not available. 1.569 - gettext "Missing dep (wok/pkg):"; echo " $i $vers" 1.570 + _ "Missing dep (wok/pkg): \$i \$vers" 1.571 echo $i >> $CACHE/missing.dep 1.572 fi 1.573 else 1.574 @@ -726,7 +753,7 @@ 1.575 if fgrep -q $i-${vers}${arch} ${root}$DB/packages.list; then 1.576 echo $i >> $CACHE/installed.web 1.577 else 1.578 - echo "ERROR: unknown dep $i" && exit 1 1.579 + _ "ERROR: unknown dep \$i"; exit 1 1.580 fi 1.581 fi 1.582 fi 1.583 @@ -739,11 +766,11 @@ 1.584 1.585 # Have we a missing build dep to cook ? 1.586 if [ -s "$CACHE/missing.dep" ] && [ "$AUTO_COOK" ]; then 1.587 - gettext -e "Auto cook config is set : AUTO_COOK\n" 1.588 + _ "Auto cook config is set: AUTO_COOK" 1.589 cp -f $LOGS/$PACKAGE.log $LOGS/$PACKAGE.log.$$ 1.590 for i in $(uniq $CACHE/missing.dep) 1.591 do 1.592 - (gettext "Building dep (wok/pkg) :"; echo " $i $vers") | \ 1.593 + (_ "Building dep (wok/pkg) : \$i \$vers") | \ 1.594 tee -a $LOGS/$PACKAGE.log.$$ 1.595 cook $i || (echo -e "ERROR: can't cook dep '$i'\n" && \ 1.596 fgrep "remove: " $LOGS/$i.log && \ 1.597 @@ -757,19 +784,20 @@ 1.598 # QA: Exit on missing dep errors. We exit in both cases, if AUTO_COOK 1.599 # is enabled and cook fails we have ERROR in log, if no auto cook we have 1.600 # missing dep in cached file. 1.601 - if fgrep -q "ERROR:" $LOGS/$pkg.log || [ -s "$CACHE/missing.dep" ]; then 1.602 + lerror=$(_n "ERROR") 1.603 + if fgrep -q ^$lerror $LOGS/$pkg.log || [ -s "$CACHE/missing.dep" ]; then 1.604 [ -s "$CACHE/missing.dep" ] && nb=$(cat $CACHE/missing.dep | wc -l) 1.605 - echo "ERROR: missing dep $nb" && exit 1 1.606 + _ "ERROR: missing dep \$nb" && exit 1 1.607 fi 1.608 1.609 # Install local packages: package-version${arch} 1.610 for i in $(uniq $CACHE/installed.local) 1.611 do 1.612 if [ -f "$INCOMING/$i" ]; then 1.613 - gettext "Installing dep (pkg/local):"; echo " $i" 1.614 + _ "Installing dep (pkg/local): \$i" 1.615 tazpkg install $INCOMING/$i --root=$root >/dev/null 1.616 elif [ -f "$PKGS/$i" ]; then 1.617 - gettext "Installing dep (pkg/local):"; echo " $i" 1.618 + _ "Installing dep (pkg/local): \$i" 1.619 tazpkg install $PKGS/$i --root=$root >/dev/null 1.620 fi 1.621 done 1.622 @@ -778,7 +806,7 @@ 1.623 # use local packages). 1.624 for i in $(uniq $CACHE/installed.web) 1.625 do 1.626 - gettext "Installing dep (web/cache):"; echo " $i" 1.627 + _ "Installing dep (web/cache): \$i" 1.628 tazpkg get-install $i --root=$root >/dev/null 1.629 done 1.630 1.631 @@ -801,27 +829,28 @@ 1.632 # QA: compile_rules success so valid. 1.633 mkdir -p $install 1.634 else 1.635 - # QA: No compile_rules so no error, valid. 1.636 + # QA: no compile_rules so no error, valid. 1.637 mkdir -p $install 1.638 fi 1.639 - separator && newline 1.640 + separator; newline 1.641 1.642 # Execute testsuite. 1.643 if grep -q ^testsuite $receipt; then 1.644 - echo "Running testsuite" 1.645 - separator 1.646 + _ "Running testsuite"; separator 1.647 testsuite $@ || exit 1 1.648 - separator && newline 1.649 + separator; newline 1.650 fi 1.651 } 1.652 1.653 # Cook quality assurance. 1.654 cookit_quality() { 1.655 if [ ! -d "$WOK/$pkg/install" ] && [ ! "$WANTED" ]; then 1.656 - echo -e "ERROR: cook failed" | tee -a $LOGS/$pkg.log 1.657 + _ "ERROR: cook failed" | tee -a $LOGS/$pkg.log 1.658 fi 1.659 # ERROR can be echoed any time in cookit() 1.660 - if grep -Eq '(ERROR:|undefined reference to)' $LOGS/$pkg.log; then 1.661 + lerror=$(_n "ERROR") 1.662 + if grep -Ev "(conftest|configtest)" $LOGS/$pkg.log | \ 1.663 + grep -Eq "(^$lerror|undefined reference to)" ; then 1.664 debug_info | tee -a $LOGS/$pkg.log 1.665 rm -f $command && exit 1 1.666 fi 1.667 @@ -834,38 +863,39 @@ 1.668 1.669 # Handle cross compilation 1.670 case "$ARCH" in 1.671 - arm|x86_64) arch="-$ARCH" ;; 1.672 + arm*|x86_64) arch="-$ARCH" ;; 1.673 esac 1.674 1.675 - echo "Pack: $PACKAGE ${VERSION}${arch}" 1.676 - separator 1.677 + _ "Pack: $PACKAGE \${VERSION}\${arch}"; separator 1.678 1.679 if grep -q ^genpkg_rules $receipt; then 1.680 - gettext -e "Executing: genpkg_rules\n" 1.681 + _ "Executing: genpkg_rules"; newline 1.682 set -e && cd $pkgdir && mkdir -p $fs 1.683 - genpkg_rules || (broken && echo -e "\nERROR: genpkg_rules failed\n" >> \ 1.684 + genpkg_rules || (newline; _ "ERROR: genpkg_rules failed"; newline) >> \ 1.685 $LOGS/$pkg.log) 1.686 else 1.687 - gettext "No packages rules: meta package"; echo 1.688 + _ "No packages rules: meta package" 1.689 mkdir -p $fs 1.690 fi 1.691 1.692 # First QA check to stop now if genpkg_rules failed. 1.693 - if grep -Eq '(^ERROR|No such file or directory)' $LOGS/$pkg.log; then 1.694 - broken && exit 1 1.695 + lerror=$(_n "ERROR") 1.696 + if fgrep -q ^$lerror $LOGS/$pkg.log; then 1.697 + exit 1 1.698 fi 1.699 1.700 cd $taz 1.701 for file in receipt description.txt 1.702 do 1.703 [ ! -f "../$file" ] && continue 1.704 - gettext "Copying"; echo -n " $file..." 1.705 + _n "Copying \$file..." 1.706 cp -f ../$file $pack && chown 0.0 $pack/$file && status 1.707 done 1.708 copy_generic_files 1.709 1.710 # Create files.list with redirecting find output. 1.711 - gettext "Creating the list of files..." && cd $fs 1.712 + _n "Creating the list of files..." 1.713 + cd $fs 1.714 find . -type f -print > ../files.list 1.715 find . -type l -print >> ../files.list 1.716 cd .. && sed -i s/'^.'/''/ files.list 1.717 @@ -876,7 +906,7 @@ 1.718 [ "$STRIP" ] || strip_package 1.719 1.720 # Md5sum of files. 1.721 - gettext "Creating $CHECKSUM of files..." 1.722 + _n "Creating \$CHECKSUM of files..." 1.723 while read file; do 1.724 [ -L "fs$file" ] && continue 1.725 [ -f "fs$file" ] || continue 1.726 @@ -900,14 +930,14 @@ 1.727 cat $WOK/$PACKAGE/md5 | sed 's/^/# /' >> receipt 1.728 1.729 # Build cpio archives. 1.730 - gettext "Compressing the fs... " 1.731 + _n "Compressing the fs..." 1.732 find fs | cpio -o -H newc --quiet | lzma e fs.cpio.lzma -si $LZMA_SET_DIR 1.733 rm -rf fs 1.734 status 1.735 PACKED_SIZE=$(du -chs fs.cpio.lzma receipt files.list \ 1.736 $CHECKSUM description.txt 2> /dev/null | awk \ 1.737 '{ sz=$1 } END { print sz }') 1.738 - gettext "Updating receipt sizes..." 1.739 + _n "Updating receipt sizes..." 1.740 sed -i s/^PACKED_SIZE.*$// receipt 1.741 sed -i s/^UNPACKED_SIZE.*$// receipt 1.742 sed -i "s/^PACKAGE=/PACKED_SIZE=\"$PACKED_SIZE\"\nUNPACKED_SIZE=\"$UNPACKED_SIZE\"\nPACKAGE=/" receipt 1.743 @@ -915,18 +945,18 @@ 1.744 1.745 # Set extra version. 1.746 if [ "$EXTRAVERSION" ]; then 1.747 - gettext "Updating receipt EXTRAVERSION: "; echo -n "$EXTRAVERSION" 1.748 + _n "Updating receipt EXTRAVERSION: \$EXTRAVERSION" 1.749 sed -i s/^EXTRAVERSION.*$// receipt 1.750 sed -i "s/^VERSION=/EXTRAVERSION=\"$EXTRAVERSION\"\nVERSION=/" receipt 1.751 status 1.752 fi 1.753 1.754 # Compress. 1.755 - gettext "Creating full cpio archive... " 1.756 + _n "Creating full cpio archive..." 1.757 find . -print | cpio -o -H newc --quiet > \ 1.758 ../$PACKAGE-${VERSION}${EXTRAVERSION}${arch}.tazpkg 1.759 status 1.760 - gettext "Restoring original package tree... " 1.761 + _n "Restoring original package tree..." 1.762 unlzma -c fs.cpio.lzma | cpio -idm --quiet 1.763 status 1.764 rm fs.cpio.lzma && cd .. 1.765 @@ -938,32 +968,34 @@ 1.766 # QA and give info. 1.767 tazpkg=$(ls *.tazpkg) 1.768 packit_quality 1.769 - separator && gettext "Package:"; echo -e " $tazpkg\n" 1.770 + separator; _ "Package: \$tazpkg"; newline 1.771 } 1.772 1.773 # Verify package quality and consistency. 1.774 packit_quality() { 1.775 - #gettext "QA: Checking for broken link..." 1.776 + #gettext "QA: checking for broken link..." 1.777 #link=$(find $fs/usr -type l -follow) 1.778 #[ "$link" ] && echo -e "\nERROR: broken link in filesystem" 1.779 #status 1.780 1.781 # Exit if any error found in log file. 1.782 - if grep -Eq '(^ERROR|No such file or directory)' $LOGS/$pkg.log; then 1.783 + lerror=$(_n "ERROR") 1.784 + if fgrep -q ^$lerror $LOGS/$pkg.log; then 1.785 rm -f $command && exit 1 1.786 fi 1.787 1.788 - gettext "QA: Checking for empty package..." 1.789 + _n "QA: checking for empty package..." 1.790 files=$(cat $WOK/$pkg/taz/$pkg-*/files.list | wc -l) 1.791 if [ "$files" == 0 ] && [ "$CATEGORY" != "meta" ]; then 1.792 - echo -e "\nERROR: empty package" 1.793 + newline; _ "ERROR: empty package" 1.794 rm -f $command && exit 1 1.795 else 1.796 # Ls sort by name so the first file is the one we want. 1.797 old=$(ls $INCOMING/$pkg-[0-9]*.tazpkg 2>/dev/null | head -n 1) 1.798 status 1.799 if [ -f "$old" ]; then 1.800 - gettext "Removing old: $(basename $old)" 1.801 + old_pkg=$(basename $old) 1.802 + _n "Removing old: \$old_pkg" 1.803 rm -f $old && status 1.804 fi 1.805 mv -f $pkgdir/taz/$pkg-*.tazpkg $INCOMING 1.806 @@ -976,7 +1008,7 @@ 1.807 { 1.808 local pkg build 1.809 case "$ARCH" in 1.810 - arm|x86_64) 1.811 + arm*|x86_64) 1.812 arch="-${ARCH}" 1.813 root=$CROSS_TREE/sysroot ;; 1.814 *) 1.815 @@ -993,7 +1025,7 @@ 1.816 tazpkg install \ 1.817 $INCOMING/$pkg-${VERSION}${EXTRAVERSION}${arch}.tazpkg --root=$root --forced 1.818 else 1.819 - gettext -e "Unable to install package, build has failed.\n\n" 1.820 + _ "Unable to install package, build has failed."; newline 1.821 exit 1 1.822 fi 1.823 fi 1.824 @@ -1003,8 +1035,8 @@ 1.825 if [ -f "${root}$INSTALLED/$pkg/receipt" ]; then 1.826 . /etc/slitaz/cook.conf 1.827 . $WOK/$pkg/taz/$pkg-*/receipt 1.828 - echo "Updating $ARCH chroot environment..." 1.829 - echo "Updating chroot: $pkg (${VERSION}${EXTRAVERSION}${arch})" | log 1.830 + _ "Updating \$ARCH chroot environment..." 1.831 + _ "Updating chroot: \$pkg (${VERSION}${EXTRAVERSION}${arch})" | log 1.832 if [ -f "$PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}${arch}.tazpkg" ]; then 1.833 tazpkg install \ 1.834 $PKGS/$pkg-${VERSION}${EXTRAVERSION}${arch}.tazpkg \ 1.835 @@ -1056,13 +1088,13 @@ 1.836 1.837 base=/dev/shm/aufsmnt$$ 1.838 1.839 - # Can we setup the chroot ? Is it already done ? 1.840 + # Can we setup the chroot? Is it already done? 1.841 grep -q ^AUFS_NOT_SUPPORTED $receipt && return 1.842 [ -n "$AUFS_MOUNTS" -a ! -f /aufs-umount.sh ] || return 1.843 lsmod | grep -q aufs || modprobe aufs 2> /dev/null || return 1.844 mkdir ${base}root ${base}rw || return 1.845 1.846 - echo "Setup aufs chroot..." 1.847 + _ "Setup aufs chroot..." 1.848 1.849 # Sanity check 1.850 for i in / /proc /sys /dev/shm /dev/pts /home ; do 1.851 @@ -1074,7 +1106,7 @@ 1.852 for mnt in $(echo $AUFS_MOUNTS | sort | uniq); do 1.853 mount --bind $mnt ${base}root$mnt 1.854 if [ $mnt == / ] && ! mount -t aufs -o br=${base}rw:/ none ${base}root; then 1.855 - echo "Aufs mountage failure" 1.856 + _ "Aufs mountage failure" 1.857 umount ${base}root 1.858 rmdir ${base}* 1.859 return 1.860 @@ -1085,7 +1117,7 @@ 1.861 chroot ${base}root $(cd $(dirname $0); pwd)/$(basename $0) "$@" 1.862 status=$? 1.863 1.864 - echo "Leaving aufs chroot..." 1.865 + _ "Leaving aufs chroot..." 1.866 tac ${base}rw/aufs-umount.sh | sh 1.867 rm -rf ${base}rw 1.868 umount ${base}root 1.869 @@ -1096,7 +1128,12 @@ 1.870 exit $status 1.871 } 1.872 1.873 -# Create a XML feed for freshly built package. 1.874 +# Encode predefined XML entities 1.875 +xml_ent() { 1.876 + sed -e 's|&|\&|g; s|<|\<|g; s|>|\>|g; s|"|\"|g' -e "s|'|\'|g" 1.877 +} 1.878 + 1.879 +# Create a XML feed for freshly built packages. 1.880 gen_rss() { 1.881 pubdate=$(date "+%a, %d %b %Y %X") 1.882 cat > $FEEDS/$pkg.xml << EOT 1.883 @@ -1105,12 +1142,12 @@ 1.884 <link>${COOKER_URL}?pkg=$PACKAGE</link> 1.885 <guid>$PACKAGE-$VERSION${EXTRAVERSION}</guid> 1.886 <pubDate>$pubdate</pubDate> 1.887 - <description>$SHORT_DESC</description> 1.888 + <description>$(echo -n "$SHORT_DESC" | xml_ent)</description> 1.889 </item> 1.890 EOT 1.891 } 1.892 1.893 -# Truncate stdout log file to $1 Mb 1.894 +# Truncate stdout log file to $1 Mb. 1.895 loglimit() 1.896 { 1.897 [ -n "$DEFAULT_LOG_LIMIT" ] || return 1.898 @@ -1118,6 +1155,18 @@ 1.899 } 1.900 1.901 # 1.902 +# Receipt functions to ease packaging 1.903 +# 1.904 + 1.905 +get_dev_files() { 1.906 + _n "Getting standard devel files..." 1.907 + mkdir -p $fs/usr/lib 1.908 + cp -a $install/usr/lib/pkgconfig $fs/usr/lib 1.909 + cp -a $install/usr/include $fs/usr 1.910 + status 1.911 +} 1.912 + 1.913 +# 1.914 # Commands 1.915 # 1.916 1.917 @@ -1125,40 +1174,49 @@ 1.918 usage|help|-u|-h) 1.919 usage ;; 1.920 list-wok) 1.921 - gettext -e "\nList of packages in:"; echo " $WOK" 1.922 + newline; _ "List of \$ARCH packages in: \$WOK"; separator 1.923 + cd $WOK && ls -1 1.924 + if [ "$ARCH" != "i486" ]; then 1.925 + count=0 1.926 + for pkg in $(fgrep 'HOST_ARCH=' */receipt | egrep "$ARCH|any" | cut -d : -f 1) 1.927 + do 1.928 + unset HOST_ARCH 1.929 + . $pkg 1.930 + count=$(($count + 1)) 1.931 + colorize 34 "$PACKAGE" 1.932 + done 1.933 + else 1.934 + count=$(ls | wc -l) 1.935 + ls -1 1.936 + fi 1.937 separator 1.938 - cd $WOK && ls -1 1.939 - separator 1.940 - echo -n "Packages: " && ls | wc -l 1.941 + _n "Packages:"; colorize 32 " $count" 1.942 newline ;; 1.943 activity) 1.944 cat $activity ;; 1.945 search) 1.946 # Just a simple search function, we dont need more actually. 1.947 query="$2" 1.948 - newline 1.949 - gettext "Search results for:"; echo " $query" 1.950 - separator 1.951 + newline; _ "Search results for: \$query"; separator 1.952 cd $WOK && ls -1 | grep "$query" 1.953 - separator && newline ;; 1.954 + separator; newline ;; 1.955 setup) 1.956 # Setup a build environment 1.957 check_root 1.958 - echo "Cook: setup environment" | log 1.959 - newline 1.960 - gettext "Setting up your environment"; newline 1.961 - separator && cd $SLITAZ 1.962 + _ "Cook: setup environment" | log 1.963 + newline; _ "Setting up your environment"; separator 1.964 + cd $SLITAZ 1.965 init_db_files 1.966 - gettext "Checking for packages to install..."; echo 1.967 + _ "Checking for packages to install..." 1.968 # Use setup pkgs from cross.conf or cook.conf. When cross compiling 1.969 - # ARCH-setup or 'cross check-env' should be used before: cook setup 1.970 + # ARCH-setup or 'cross check' should be used before: cook setup 1.971 case "$ARCH" in 1.972 - arm|x86_64) 1.973 + arm*|x86_64) 1.974 if [ ! -x "/usr/bin/cross" ]; then 1.975 - gettext "ERROR: cross is not installed"; echo 1.976 + _ "ERROR: cross is not installed" 1.977 exit 1 1.978 fi 1.979 - gettext "Using config file: /etc/slitaz/cross.conf"; echo 1.980 + _ "Using config file: /etc/slitaz/cross.conf" 1.981 . /etc/slitaz/cross.conf ;; 1.982 esac 1.983 for pkg in $INSTALL_PKGS; do 1.984 @@ -1186,22 +1244,19 @@ 1.985 1.986 # SliTaz group and permissions 1.987 if ! grep -q ^slitaz /etc/group; then 1.988 - gettext -e "Adding group: slitaz\n" 1.989 + _ "Adding group: slitaz" 1.990 addgroup slitaz 1.991 fi 1.992 - gettext -e "Setting permissions for slitaz group...\n" 1.993 + _ "Setting permissions for slitaz group..." 1.994 find $SLITAZ -maxdepth 2 -exec chown root.slitaz {} \; 1.995 find $SLITAZ -maxdepth 2 -exec chmod g+w {} \; 1.996 - separator 1.997 - gettext -e "All done, ready to cook packages :-)\n\n" ;; 1.998 + separator; _ "All done, ready to cook packages :-)"; newline ;; 1.999 *-setup) 1.1000 # Setup for cross compiling. 1.1001 arch=${1%-setup} 1.1002 check_root 1.1003 - echo "Cook: setup $arch cross environment" | log 1.1004 - newline 1.1005 - boldify $(gettext "Setting up your $arch cross environment") 1.1006 - separator 1.1007 + _ "Cook: setup \$arch cross environment" | log 1.1008 + newline; boldify $(_n "Setting up your \$arch cross environment"); separator 1.1009 init_db_files 1.1010 sed -i \ 1.1011 -e s"/ARCH=.*/ARCH=\"$arch\"/" \ 1.1012 @@ -1225,13 +1280,15 @@ 1.1013 sysroot=$CROSS_TREE/sysroot 1.1014 tools=/cross/$arch/tools 1.1015 root=$sysroot 1.1016 + # L10n: keep the same width of translations to get a consistent view 1.1017 CC=$tools/bin/${HOST_SYSTEM}-gcc 1.1018 - echo "Target arch : $ARCH" 1.1019 - echo "Configure args : $CONFIGURE_ARGS" 1.1020 - echo "Arch sysroot : $sysroot" 1.1021 - echo "Tools prefix : $tools/bin" 1.1022 + _ "Target arch : \$ARCH" 1.1023 + _ "Configure args : \$CONFIGURE_ARGS" 1.1024 + _ "Build flags : \$flags" 1.1025 + _ "Arch sysroot : \$sysroot" 1.1026 + _ "Tools prefix : \$tools/bin" 1.1027 # Tell the packages manager where to find packages. 1.1028 - echo "Packages DB : ${root}$DB" 1.1029 + _ "Packages DB : \${root}\$DB" 1.1030 mkdir -p ${root}$INSTALLED 1.1031 cd ${root}$DB && rm -f *.bak 1.1032 for list in packages.list packages.desc packages.equiv packages.md5 1.1033 @@ -1242,25 +1299,25 @@ 1.1034 # i486 package will be used as dep by tazpkg and then break the 1.1035 # cross environment 1.1036 if [ ! -f "${root}$INSTALLED/glibc-base/receipt" ]; then 1.1037 - colorize 36 "WARNING: (e)glibc-base is not installed in sysroot" 1.1038 + colorize 36 $(_ "WARNING: (e)glibc-base is not installed in sysroot") 1.1039 fi 1.1040 # Show GCC version or warn if not yet compiled. 1.1041 if [ -x $CC ]; then 1.1042 - echo "Cross compiler : ${HOST_SYSTEM}-gcc" 1.1043 + _ "Cross compiler : \${HOST_SYSTEM}-gcc" 1.1044 else 1.1045 - colorize 36 "C compiler is missing: ${HOST_SYSTEM}-gcc" 1.1046 - echo "Run 'cross compile' to cook a toolchain" 1.1047 + colorize 36 $(_ "C compiler is missing: \${HOST_SYSTEM}-gcc") 1.1048 + _ "Run 'cross compile' to cook a toolchain" 1.1049 fi 1.1050 - separator && newline ;; 1.1051 + separator; newline ;; 1.1052 upwok) 1.1053 case "$2" in 1.1054 --local) 1.1055 - gettext -e "Updating local chanages in wok-hg to wok...\n" 1.1056 + _ "Updating local chanages in wok-hg to wok..." 1.1057 rsync_wok || exit 1 1.1058 exit 1 ;; 1.1059 esac 1.1060 1.1061 - gettext -e "Updating wok-hg...\n" 1.1062 + _ "Updating wok-hg..." 1.1063 if [ -d $WOKHG/.hg ]; then 1.1064 cd $WOKHG 1.1065 hg pull -u || exit 1 1.1066 @@ -1269,7 +1326,7 @@ 1.1067 rsync_wok || exit 1 ;; 1.1068 test) 1.1069 # Test a cook environment. 1.1070 - echo "Cook test: testing the cook environment" | log 1.1071 + _ "Cook test: testing the cook environment" | log 1.1072 [ ! -d "$WOK" ] && exit 1 1.1073 [ ! -d "$WOK/cooktest" ] && cp -r $DATA/cooktest $WOK 1.1074 cook cooktest ;; 1.1075 @@ -1279,12 +1336,12 @@ 1.1076 [ "$pkg" ] || usage 1.1077 newline 1.1078 if [ -d "$WOKHG/$pkg" ]; then 1.1079 - echo -n "$pkg " && gettext "package already exists." 1.1080 - echo -e "\n" && exit 1 1.1081 + _ "\$pkg package already exists." 1.1082 + exit 1 1.1083 fi 1.1084 - gettext "Creating"; echo -n " $WOKHG/$pkg" 1.1085 + _n "Creating \$WOKHG/\$pkg" 1.1086 mkdir $WOKHG/$pkg && cd $WOKHG/$pkg && status 1.1087 - gettext "Preparing the package receipt..." 1.1088 + _n "Preparing the package receipt..." 1.1089 cp $DATA/receipt . 1.1090 sed -i s"/^PACKAGE=.*/PACKAGE=\"$pkg\"/" receipt 1.1091 status && newline 1.1092 @@ -1292,71 +1349,67 @@ 1.1093 # Interactive mode, asking and seding. 1.1094 case "$3" in 1.1095 --interactive|-x) 1.1096 - gettext -e "Entering interactive mode...\n" 1.1097 + _ "Entering interactive mode..." 1.1098 separator 1.1099 - echo "Package : $pkg" 1.1100 - # Version. 1.1101 - echo -n "Version : " ; read anser 1.1102 - sed -i s/'VERSION=\"\"'/"VERSION=\"$anser\""/ receipt 1.1103 - # Category. 1.1104 - echo -n "Category : " ; read anser 1.1105 - sed -i s/'CATEGORY=\"\"'/"CATEGORY=\"$anser\""/ receipt 1.1106 - # Short description. 1.1107 - echo -n "Short desc : " ; read anser 1.1108 - sed -i s/'SHORT_DESC=\"\"'/"SHORT_DESC=\"$anser\""/ receipt 1.1109 + _ "Package : \$pkg" 1.1110 + _n "Version : " ; read answer 1.1111 + sed -i s/'VERSION=\"\"'/"VERSION=\"$answer\""/ receipt 1.1112 + _n "Category : " ; read answer 1.1113 + sed -i s/'CATEGORY=\"\"'/"CATEGORY=\"$answer\""/ receipt 1.1114 + # L10n: Short description 1.1115 + _n "Short desc : " ; read answer 1.1116 + sed -i s/'SHORT_DESC=\"\"'/"SHORT_DESC=\"$answer\""/ receipt 1.1117 # Maintainer. 1.1118 - echo -n "Maintainer : " ; read anser 1.1119 - sed -i s/'MAINTAINER=\"\"'/"MAINTAINER=\"$anser\""/ receipt 1.1120 + _n "Maintainer : " ; read answer 1.1121 + sed -i s/'MAINTAINER=\"\"'/"MAINTAINER=\"$answer\""/ receipt 1.1122 # License. 1.1123 - echo -n "License : " ; read anser 1.1124 - sed -i s/'LICENSE=\"\"'/"LICENSE=\"$anser\""/ receipt 1.1125 + _n "License : " ; read answer 1.1126 + sed -i s/'LICENSE=\"\"'/"LICENSE=\"$answer\""/ receipt 1.1127 # Web site. 1.1128 - echo -n "Web site : " ; read anser 1.1129 - sed -i s#'WEB_SITE=\"\"'#"WEB_SITE=\"$anser\""# receipt 1.1130 + _n "Web site : " ; read answer 1.1131 + sed -i s#'WEB_SITE=\"\"'#"WEB_SITE=\"$answer\""# receipt 1.1132 newline 1.1133 # Wget URL. 1.1134 - echo "Wget URL to download source tarball." 1.1135 - echo "Example : \$GNU_MIRROR/\$PACKAGE/\$TARBALL" 1.1136 - echo -n "Wget url : " ; read anser 1.1137 - sed -i s#'WGET_URL=\"$TARBALL\"'#"WGET_URL=\"$anser\""# receipt 1.1138 + _ "Wget URL to download source tarball." 1.1139 + _n "Example : " ; echo '$GNU_MIRROR/$PACKAGE/$TARBALL' 1.1140 + _n "Wget url : " ; read answer 1.1141 + sed -i s#'WGET_URL=\"$TARBALL\"'#"WGET_URL=\"$answer\""# receipt 1.1142 # Ask for a stuff dir. 1.1143 - echo -n "Do you need a stuff directory ? (y/N) : " ; read anser 1.1144 - if [ "$anser" = "y" ]; then 1.1145 - echo -n "Creating the stuff directory..." 1.1146 + _n "Do you need a stuff directory ? (y/N) : " ; read answer 1.1147 + if [ "$answer" = "y" ]; then 1.1148 + _n "Creating the stuff directory..." 1.1149 mkdir -p $WOKHG/$pkg/stuff && status 1.1150 fi 1.1151 # Ask for a description file. 1.1152 - echo -n "Are you going to write a description ? (y/N) : " ; read anser 1.1153 - if [ "$anser" = "y" ]; then 1.1154 - echo -n "Creating the description.txt file..." 1.1155 + _n "Are you going to write a description ? (y/N) : " ; read answer 1.1156 + if [ "$answer" = "y" ]; then 1.1157 + _n "Creating the description.txt file..." 1.1158 newline > $WOKHG/$pkg/description.txt && status 1.1159 fi 1.1160 - separator 1.1161 - gettext -e "Receipt is ready to use.\n" 1.1162 - newline ;; 1.1163 + separator; _ "Receipt is ready to use."; newline ;; 1.1164 esac ;; 1.1165 list) 1.1166 # Cook a list of packages (better use the Cooker since it will order 1.1167 # packages before executing cook). 1.1168 check_root 1.1169 - [ -z "$2" ] && gettext -e "\nNo list in argument.\n\n" && exit 1 1.1170 - [ ! -f "$2" ] && gettext -e "\nNo list found:" && \ 1.1171 - echo -e " $2\n" && exit 1 1.1172 - echo "Cook list starting: $2" | log 1.1173 + [ -z "$2" ] && (newline; _ "No list in argument."; newline) && exit 1 1.1174 + list2=$2 1.1175 + [ ! -f "$2" ] && (newline; _ "No list found: \$list2"; newline) && exit 1 1.1176 + _ "Cook list starting: \$list2" | log 1.1177 for pkg in $(cat $2) 1.1178 do 1.1179 cook $pkg || broken 1.1180 done ;; 1.1181 clean-wok) 1.1182 check_root 1.1183 - gettext -e "\nCleaning all packages files..." 1.1184 + newline; _n "Cleaning all packages files..." 1.1185 rm -rf $WOK/*/taz $WOK/*/install $WOK/*/source 1.1186 - status && newline ;; 1.1187 + status; newline ;; 1.1188 clean-src) 1.1189 check_root 1.1190 - gettext -e "\nCleaning all packages sources..." 1.1191 + newline; _n "Cleaning all packages sources..." 1.1192 rm -rf $WOK/*/source 1.1193 - status && newline ;; 1.1194 + status; newline ;; 1.1195 gen-cooklist) 1.1196 check_root 1.1197 [ -f "$2" ] && LIST="$2" 1.1198 @@ -1411,7 +1464,7 @@ 1.1199 maintainers) 1.1200 check_root 1.1201 newline 1.1202 - echo "List of maintainers for: $WOK" 1.1203 + _ "List of maintainers for: $WOK" 1.1204 separator 1.1205 tmp="/tmp/slitaz-maintainers" 1.1206 touch $tmp 1.1207 @@ -1511,10 +1564,10 @@ 1.1208 flavors) 1.1209 [ -d "$flavors" ] || $(echo -e "Missing flavors: $flavors\n" && exit 1) 1.1210 [ -d "$live" ] || mkdir -p $live 1.1211 - gettext "Creating flavors files in:"; echo " $live" 1.1212 + _ "Creating flavors files in: \$live" 1.1213 echo "Cook pkgdb: Creating all flavors" | log 1.1214 separator 1.1215 - gettext -e "Recharging lists to use latest packages...\n" 1.1216 + _ "Recharging lists to use latest packages..." 1.1217 tazpkg recharge >/dev/null 2>/dev/null 1.1218 1.1219 if [ ! -f "$live/cookiso.conf" ]; then 1.1220 @@ -1526,12 +1579,12 @@ 1.1221 #[ -d "$flavors/.hg" ] && $flavors && hg pull -u 1.1222 1.1223 cd $live 1.1224 - echo "Starting to generate flavors..." 1.1225 + _ "Starting to generate flavors..." 1.1226 rm -f flavors.list *.flavor 1.1227 for i in $flavors/* 1.1228 do 1.1229 fl=$(basename $i) 1.1230 - echo "Packing flavor: $(basename $i)" 1.1231 + _ "Packing flavor: \$fl" 1.1232 pack_flavor $fl >/dev/null || exit 1 1.1233 show_flavor $fl --brief --noheader 2> \ 1.1234 /dev/null >> flavors.list 1.1235 @@ -1587,7 +1640,8 @@ 1.1236 1.1237 # Skip blocked, 3 lines also for the Cooker. 1.1238 if grep -q "^$pkg$" $blocked && [ "$2" != "--unblock" ]; then 1.1239 - gettext -e "Blocked package:"; echo -e " $pkg\n" && exit 0 1.1240 + _ "Blocked package: \$pkg"; newline 1.1241 + exit 0 1.1242 fi 1.1243 1.1244 if [ "$AUFS_MODE" ]; then 1.1245 @@ -1595,11 +1649,12 @@ 1.1246 fi 1.1247 1.1248 # Log and source receipt. 1.1249 - echo "Cook started for: <a href='cooker.cgi?pkg=$pkg'>$pkg</a>" | log 1.1250 + _ "Cook started for: <a href='cooker.cgi?pkg=$pkg'>$pkg</a>" | log 1.1251 echo "cook:$pkg" > $command 1.1252 1.1253 # Display and log info if cook process stopped. 1.1254 - trap 'gettext -e "\n\nCook stopped: control-C\n\n" | \ 1.1255 + # FIXME: gettext not working (in single quotes) here! 1.1256 + trap '_ "\n\nCook stopped: control-C\n\n" | \ 1.1257 tee -a $LOGS/$pkg.log' INT 1.1258 1.1259 set_paths 1.1260 @@ -1607,7 +1662,7 @@ 1.1261 # Handle --options 1.1262 case "$2" in 1.1263 --clean|-c) 1.1264 - gettext -e "Cleaning:"; echo -n " $pkg" 1.1265 + _n "Cleaning: \$pkg" 1.1266 cd $WOK/$pkg && rm -rf install taz source 1.1267 status && newline && exit 0 ;; 1.1268 --install|-i) 1.1269 @@ -1620,11 +1675,11 @@ 1.1270 getsrc "$3" 1.1271 exit 0 ;; 1.1272 --block|-b) 1.1273 - gettext "Blocking:"; echo -n " $pkg" 1.1274 + _n "Blocking: \$pkg" 1.1275 [ $(grep "^$pkg$" $blocked) ] || echo "$pkg" >> $blocked 1.1276 status && newline && exit 0 ;; 1.1277 --unblock|-ub) 1.1278 - gettext "Unblocking:"; echo -n " $pkg" 1.1279 + _n "Unblocking: \$pkg" 1.1280 sed -i "/^${pkg}$/"d $blocked 1.1281 status && newline && exit 0 ;; 1.1282 --pack) 1.1283 @@ -1634,7 +1689,7 @@ 1.1284 packit 2>&1 | tee -a $LOGS/$pkg-pack.log 1.1285 clean_log 1.1286 else 1.1287 - gettext "Need to build $pkg." && exit 0 1.1288 + _ "Need to build \$pkg." && exit 0 1.1289 fi 1.1290 exit 0 ;; 1.1291 esac