cookutils rev 862

Misc small changes.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Jan 09 04:37:12 2017 +0200 (2017-01-09)
parents 1b9bb2671837
children cb3fe032b2fb
files README cook cooks data/cooktest/receipt data/header.html init.d/cooker modules/pkgdb web/cooker.cgi web/cookiso.cgi
line diff
     1.1 --- a/README	Sun Jan 08 14:29:40 2017 +0100
     1.2 +++ b/README	Mon Jan 09 04:37:12 2017 +0200
     1.3 @@ -33,7 +33,7 @@
     1.4      * Do complex work like compiling the whole system from source in
     1.5        one command (but it can rebuild the full system step by step)
     1.6      * Check build deps for you, use: BUILD_DEPENDS
     1.7 -    * The work of a Build Bot, unix philosophy: one tool for one task
     1.8 +    * The work of a Build Bot, UNIX philosophy: one tool for one task
     1.9      * Cook a package if your receipt is crappy :-)
    1.10  
    1.11  Cook paths variables used in receipt:
     2.1 --- a/cook	Sun Jan 08 14:29:40 2017 +0100
     2.2 +++ b/cook	Mon Jan 09 04:37:12 2017 +0200
     2.3 @@ -16,11 +16,6 @@
     2.4  # Internationalization.
     2.5  
     2.6  export TEXTDOMAIN='cook'
     2.7 -_()  { local T="$1"; shift; printf "$(gettext "$T")" "$@"; echo; }
     2.8 -_n() { local T="$1"; shift; printf "$(gettext "$T")" "$@"; }
     2.9 -_p() {
    2.10 -	local S="$1" P="$2" N="$3"; shift; shift; shift;
    2.11 -	printf "$(ngettext "$S" "$P" "$N")" "$@"; }
    2.12  
    2.13  
    2.14  #
    2.15 @@ -951,7 +946,7 @@
    2.16  	comp_summary "$time0" "$time1" "$size0" "$size1"
    2.17  	sed -i '/: $/d' "$cleaner_log"
    2.18  	if [ -s "$cleaner_log" ]; then
    2.19 -		echo 'Cleaner warnings and errors:'
    2.20 +		_ 'Cleaner warnings and errors:'
    2.21  		awk '{printf "  %s\n", $0;}' "$cleaner_log"
    2.22  		echo
    2.23  	fi
     3.1 --- a/cooks	Sun Jan 08 14:29:40 2017 +0100
     3.2 +++ b/cooks	Mon Jan 09 04:37:12 2017 +0200
     3.3 @@ -33,4 +33,6 @@
     3.4  	[ -d "$WOK/$i" ] && cook $i
     3.5  done
     3.6  
     3.7 +# TODO: check the "split quality": whether the file belongs to a few (or no one) packages
     3.8 +
     3.9  exit 0
     4.1 --- a/data/cooktest/receipt	Sun Jan 08 14:29:40 2017 +0100
     4.2 +++ b/data/cooktest/receipt	Mon Jan 09 04:37:12 2017 +0200
     4.3 @@ -16,31 +16,32 @@
     4.4  	echo -e "\n./configure && make && make install"
     4.5  	echo "-----------------------------------"
     4.6  	echo -e " * Log file  : $LOGS/$PACKAGE.log"
     4.7 -	
     4.8 +
     4.9  	# Test if a package is installed.
    4.10 -	[ -d "$INSTALLED/make" ] && echo " * Package   : make is installed"
    4.11 +	[   -d "$INSTALLED/make" ] && echo " * Package   : make is installed"
    4.12  	[ ! -d "$INSTALLED/make" ] && echo " * Package   : make not installed"
    4.13 -	
    4.14 -	echo ""
    4.15 +
    4.16 +	echo
    4.17  }
    4.18  
    4.19  # Rules to gen a SliTaz package suitable for Tazpkg.
    4.20  genpkg_rules()
    4.21  {
    4.22  	mkdir -p $fs/tmp
    4.23 -	cat << EOT
    4.24 +	cat <<EOT
    4.25  cp -a \$install/usr/bin \$fs/usr
    4.26  ------------------------------
    4.27 - * \$fs       : $fs"
    4.28 - * \$stuff    : $stuff"
    4.29 - * \$install  : $install"
    4.30 - * \$src      : $src"
    4.31 + * \$fs       : $fs
    4.32 + * \$stuff    : $stuff
    4.33 + * \$install  : $install
    4.34 + * \$src      : $src
    4.35  
    4.36  EOT
    4.37  	# A file to have something to package. Cook fails if package is empty.
    4.38  	echo "NOTE: Create, copy files from \$install or \$stuff"
    4.39  	echo -n "cook-test:" > $fs/tmp/cook-test
    4.40  	date >> $fs/tmp/cook-test
    4.41 -	echo ""
    4.42 +	echo
    4.43  	echo -n "End of receipt: press ENTER to continue"; read i
    4.44 +	echo
    4.45  }
     5.1 --- a/data/header.html	Sun Jan 08 14:29:40 2017 +0100
     5.2 +++ b/data/header.html	Mon Jan 09 04:37:12 2017 +0200
     5.3 @@ -1,10 +1,10 @@
     5.4  <!DOCTYPE html>
     5.5 -<html xmlns="http://www.w3.org/1999/xhtml">
     5.6 +<html lang="en">
     5.7  <head>
     5.8 +	<meta charset="UTF-8">
     5.9  	<title>SliTaz Cooker</title>
    5.10 -	<meta charset="utf-8" />
    5.11 -	<link rel="shortcut icon" href="favicon.ico" />
    5.12 -	<link rel="stylesheet" type="text/css" href="style.css" />
    5.13 +	<link rel="shortcut icon" href="favicon.ico">
    5.14 +	<link rel="stylesheet" href="style.css">
    5.15  </head>
    5.16  <body>
    5.17  
     6.1 --- a/init.d/cooker	Sun Jan 08 14:29:40 2017 +0100
     6.2 +++ b/init.d/cooker	Mon Jan 09 04:37:12 2017 +0200
     6.3 @@ -15,10 +15,10 @@
     6.4  				echo "Starting $version cooker..."
     6.5  				rootfs=$SLITAZ/$version/chroot
     6.6  				if [ ! -d $rootfs/proc/1 ]; then
     6.7 -					mount -t proc proc $rootfs/proc
     6.8 -					mount -t sysfs sysfs $rootfs/sys
     6.9 +					mount -t proc   proc   $rootfs/proc
    6.10 +					mount -t sysfs  sysfs  $rootfs/sys
    6.11  					mount -t devpts devpts $rootfs/dev/pts
    6.12 -					mount -t tmpfs shm $rootfs/dev/shm
    6.13 +					mount -t tmpfs  shm    $rootfs/dev/shm
    6.14  				fi
    6.15  				if [ ! $(mount | grep -q ${rootfs}$SLITAZ/src) ]; then
    6.16  					mount -o bind $SLITAZ/src ${rootfs}$SLITAZ/src
     7.1 --- a/modules/pkgdb	Sun Jan 08 14:29:40 2017 +0100
     7.2 +++ b/modules/pkgdb	Mon Jan 09 04:37:12 2017 +0200
     7.3 @@ -8,7 +8,6 @@
     7.4  
     7.5  export output=raw
     7.6  
     7.7 -echo "flavors='$flavors' rmpkg='$rmpkg' 1='$1' 2='$2'"
     7.8  
     7.9  # Internationalization.
    7.10  
    7.11 @@ -68,7 +67,7 @@
    7.12  _n 'Creating file "%s"' 'packages.md5' | dblog
    7.13  md5sum *.tazpkg > $PKGS/packages.md5
    7.14  echo " ($(filesize $PKGS/packages.md5))" | dblog
    7.15 -cp $PKGS/packages.md5 $PKGS/packages.toremove			# list of duplicates
    7.16 +cp $PKGS/packages.md5 $PKGS/packages.toremove			# list of unnecessary packages
    7.17  
    7.18  md5sum packages.md5 | cut -d' ' -f1 > ID
    7.19  ( cat ./ID | tr $'\n' ' '; date -ur ./ID +%s ) > IDs	# md5 and timestamp
    7.20 @@ -136,7 +135,7 @@
    7.21  		cat $pkg/taz/*/files.list | sed s/^/"$pkg: \0"/ >> \
    7.22  			$PKGS/files.list
    7.23  
    7.24 -		# list of duplicates
    7.25 +		# list of unnecessary packages
    7.26  		sed -i "/ $PACKAGE-$VERSION$EXTRAVERSION.tazpkg/d" $PKGS/packages.toremove
    7.27  	else
    7.28  		# if receipt variable HOST_ARCH absent/empty or contains ARCH
    7.29 @@ -155,10 +154,13 @@
    7.30  cd $PKGS
    7.31  
    7.32  
    7.33 -# Check package duplicates
    7.34 +# Check for unnecessary packages
    7.35  if [ -s "$PKGS/packages.toremove" ]; then
    7.36  	newline | dblog
    7.37 -	_ 'Removing duplicates:' | dblog
    7.38 +	case x$rmpkg in
    7.39 +		x) _ 'Found unnecessary packages (use `cook pkgdb --rmpkg` to remove):' | dblog;;
    7.40 +		*) _ 'Removing unnecessary packages:' | dblog;;
    7.41 +	esac
    7.42  	while read pkgsum pkgfile; do
    7.43  		echo "  - $pkgfile" | dblog
    7.44  		sed -i "/${pkgfile%.tazpkg}/d" $PKGS/packages.list
    7.45 @@ -187,13 +189,6 @@
    7.46  [ -e files.list.md5 ] && rm files.list.md5
    7.47  md5sum files-list.lzma | cut -d' ' -f1 | tr -d $'\n' > files-list.md5
    7.48  
    7.49 -# packages.info.lzma
    7.50 -PI=packages.info
    7.51 -_n 'Creating file "%s"' 'packages.info.lzma' | dblog
    7.52 -touch $PI
    7.53 -lzma e $PI $PI.lzma
    7.54 -echo " ($(filesize $PKGS/packages.info.lzma))" | dblog
    7.55 -
    7.56  # Make bundle to fast recharge
    7.57  _n 'Creating file "%s"' 'bundle.tar.lzma' | dblog
    7.58  [ -f bundle.tar.lzma ] && rm bundle.tar.lzma
     8.1 --- a/web/cooker.cgi	Sun Jan 08 14:29:40 2017 +0100
     8.2 +++ b/web/cooker.cgi	Mon Jan 09 04:37:12 2017 +0200
     8.3 @@ -222,7 +222,7 @@
     8.4  
     8.5  list_packages() {
     8.6  	cd $PKGS
     8.7 -	ls -1t *.tazpkg | head -20 | \
     8.8 +	ls -1t *.tazpkg | head -n 20 | \
     8.9  	while read file; do
    8.10  		echo -n $(TZ=UTC stat -c '%y' $PKGS/$file | cut -d . -f 1 | sed s/:[0-9]*$//)
    8.11  		echo " : $file"
    8.12 @@ -267,10 +267,10 @@
    8.13  <!DOCTYPE html>
    8.14  <html lang="en">
    8.15  <head>
    8.16 -	<meta charset="utf-8"/>
    8.17 +	<meta charset="UTF-8">
    8.18  	<title>SliTaz Cooker</title>
    8.19 -	<link rel="shortcut icon" href="favicon.ico"/>
    8.20 -	<link rel="stylesheet" type="text/css" href="style.css"/>
    8.21 +	<link rel="shortcut icon" href="favicon.ico">
    8.22 +	<link rel="stylesheet" href="style.css">
    8.23  	<meta name="robots" content="nofollow">
    8.24  </head>
    8.25  <body>
    8.26 @@ -355,7 +355,7 @@
    8.27  			[ -n "$(echo $REQUEST_URI | sed 's|/[^/]*?pkg.*||')" ] ||
    8.28  			echo "<a href='ftp://${HTTP_HOST%:*}/$pkg/'>browse</a>"
    8.29  		else
    8.30 -			if [ $(ls $wok/*$pkg*/receipt 2> /dev/null | wc -l) -eq 0 ]; then
    8.31 +			if [ $(ls $wok/*$pkg*/receipt 2>/dev/null | wc -l) -eq 0 ]; then
    8.32  				echo "No package named: $pkg"
    8.33  			else
    8.34  				ls $wok/$pkg/receipt >/dev/null 2>&1 || pkg="*$pkg*"
    8.35 @@ -689,8 +689,7 @@
    8.36  <div id="footer">
    8.37  	<a href="http://www.slitaz.org/">SliTaz Website</a>
    8.38  	<a href="cooker.cgi">Cooker</a>
    8.39 -	<a href="http://hg.slitaz.org/cookutils/raw-file/tip/doc/cookutils.en.html">
    8.40 -		Documentation</a>
    8.41 +	<a href="doc/cookutils/cookutils.en.html">Documentation</a>
    8.42  </div>
    8.43  
    8.44  </body>
     9.1 --- a/web/cookiso.cgi	Sun Jan 08 14:29:40 2017 +0100
     9.2 +++ b/web/cookiso.cgi	Mon Jan 09 04:37:12 2017 +0200
     9.3 @@ -63,10 +63,10 @@
     9.4  <!DOCTYPE html>
     9.5  <html lang="en">
     9.6  <head>
     9.7 -	<meta charset="utf-8"/>
     9.8 +	<meta charset="UTF-8">
     9.9  	<title>SliTaz ISO Cooker</title>
    9.10 -	<link rel="shortcut icon" href="favicon.ico"/>
    9.11 -	<link rel="stylesheet" type="text/css" href="style.css"/>
    9.12 +	<link rel="shortcut icon" href="favicon.ico">
    9.13 +	<link rel="stylesheet" href="style.css">
    9.14  </head>
    9.15  <body>
    9.16  
    9.17 @@ -169,8 +169,7 @@
    9.18  <div id="footer">
    9.19  	<a href="http://www.slitaz.org/">SliTaz Website</a>
    9.20  	<a href="cookiso.cgi">Cookiso</a>
    9.21 -	<a href="http://hg.slitaz.org/cookutils/raw-file/tip/doc/cookutils.en.html">
    9.22 -		Documentation</a>
    9.23 +	<a href="doc/cookutils/cookutils.en.html">Documentation</a>
    9.24  </div>
    9.25  
    9.26  </body>