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