cookutils rev 662

cook: add uncook command to check for uncooked packages
author Christophe Lincoln <pankso@slitaz.org>
date Thu Mar 27 21:08:02 2014 +0100 (2014-03-27)
parents d17c28b4d83f
children 82c059c72765
files cook
line diff
     1.1 --- a/cook	Fri Mar 14 23:45:55 2014 +0100
     1.2 +++ b/cook	Thu Mar 27 21:08:02 2014 +0100
     1.3 @@ -42,6 +42,7 @@
     1.4    list               $(_ "Cook a list of packages.")
     1.5    clean-wok          $(_ "Clean-up all packages files.")
     1.6    clean-src          $(_ "Clean-up all packages sources.")
     1.7 +  uncook             $(_ "Check for uncooked packages")
     1.8    pkgdb              $(_ "Create packages DB lists and flavors.")
     1.9  
    1.10  $(_ "\033[1mOptions:\033[0m")
    1.11 @@ -52,6 +53,7 @@
    1.12    --unblock|-ub      Cook : $(_ "unblock a blocked package.")
    1.13    --cdeps            Cook : $(_ "check dependencies of cooked package.")
    1.14    --pack             Cook : $(_ "repack an already built package.")
    1.15 +  --debug            Cook : $(_ "display debugging messages.")
    1.16    --interactive|-x   New  : $(_ "create a receipt interactively.")
    1.17    --wok              Setup: $(_ "clone the cooking wok from Hg repo.")
    1.18    --stable           Setup: $(_ "clone the stable wok from Hg repo.")
    1.19 @@ -163,8 +165,8 @@
    1.20  	elif [ -f "$INSTALLED/linux-api-headers/receipt" ]; then
    1.21  		kvers=$(grep ^VERSION= $INSTALLED/linux-api-headers/receipt | cut -d '"' -f 2)
    1.22  		kbasevers=${kvers:0:3}
    1.23 -	fi	
    1.24 -	# Python version 
    1.25 +	fi
    1.26 +	# Python version
    1.27  	if [ -f "$WOK/python/receipt" ]; then
    1.28  		pyvers=$(grep ^VERSION= $WOK/python/receipt | cut -d '"' -f 2)
    1.29  	fi
    1.30 @@ -418,7 +420,7 @@
    1.31  		mkdir -p $fs/usr/share/applications
    1.32  		cp -a $stuff/$PACKAGE.desktop $fs/usr/share/applications
    1.33  	fi
    1.34 -	
    1.35 +
    1.36  	# Add custom licenses
    1.37  	if [ -d "$stuff/licenses" ]; then
    1.38  		mkdir -p $fs/usr/share/licenses
    1.39 @@ -676,7 +678,7 @@
    1.40  			mv * ../$PACKAGE-$VERSION
    1.41  		cd .. && rm -rf tmp
    1.42  	fi
    1.43 -	
    1.44 +
    1.45  	# Libtool shared libs path hack.
    1.46  	case "$ARCH" in
    1.47  		arm*) cross libhack ;;
    1.48 @@ -954,7 +956,7 @@
    1.49  EOT
    1.50  }
    1.51  
    1.52 -# Truncate stdout log file to $1 Mb. 
    1.53 +# Truncate stdout log file to $1 Mb.
    1.54  loglimit()
    1.55  {
    1.56  	if [ -n "$DEFAULT_LOG_LIMIT" ]; then
    1.57 @@ -1036,7 +1038,7 @@
    1.58  		cd $WOK
    1.59  		if [ "$ARCH" != "i486" ]; then
    1.60  			count=0
    1.61 -			for pkg in $(fgrep 'HOST_ARCH=' */receipt | fgrep $ARCH | cut -d : -f 1) 
    1.62 +			for pkg in $(fgrep 'HOST_ARCH=' */receipt | fgrep $ARCH | cut -d : -f 1)
    1.63  			do
    1.64  				unset HOST_ARCH
    1.65  				. $pkg
    1.66 @@ -1260,6 +1262,45 @@
    1.67  		newline; _n "Cleaning all packages sources..."
    1.68  		rm -rf $WOK/*/source
    1.69  		status; newline ;;
    1.70 +	uncook)
    1.71 +		cd $WOK
    1.72 +		count=0
    1.73 +		newline
    1.74 +		_ "Checking for uncook packages"
    1.75 +		separator
    1.76 +		for pkg in *
    1.77 +		do
    1.78 +			unset HOST_ARCH
    1.79 +			. $pkg/receipt
    1.80 +			# Source cooked pkg receipt to get EXTRAVERSION
    1.81 +			if [ -f "$WOK/$pkg/taz/*/receipt" ]; then
    1.82 +				. $WOK/$pkg/taz/*/receipt
    1.83 +			fi 
    1.84 +			case "$ARCH" in
    1.85 +				i486)
    1.86 +					debug "Package: $PKGS/${PACKAGE}-${VERSION}${EXTRAVERSION}.tazpkg"
    1.87 +					if [ ! -f "$PKGS/${PACKAGE}-${VERSION}${EXTRAVERSION}.tazpkg" ]; then
    1.88 +						count=$(($count + 1))
    1.89 +						colorize 34 "$pkg"
    1.90 +					fi ;;
    1.91 +				arm)
    1.92 +					# Check only packages include in arch
    1.93 +					if echo "$HOST_ARCH" | fgrep -q "$ARCH"; then
    1.94 +						# *.tazpkg
    1.95 +						if [ ! -f "$PKGS/${PACKAGE}-${VERSION}${EXTRAVERSION}-${ARCH}.tazpkg" ]; then
    1.96 +							count=$(($count + 1))
    1.97 +							colorize 34 "$pkg"
    1.98 +						fi
    1.99 +					fi ;;
   1.100 +			esac
   1.101 +		done
   1.102 +		if [ "$count" -gt "0" ]; then
   1.103 +			separator
   1.104 +			_n "Uncook packages: "; colorize 31 "$count"
   1.105 +		else
   1.106 +			_ "All packages are cooked :-)"
   1.107 +		fi
   1.108 +		newline ;;
   1.109  	pkgdb)
   1.110  		# Create suitable packages list for TazPKG and only for built packages
   1.111  		# as well as flavors files for TazLiTo. We dont need logs since we do it
   1.112 @@ -1424,6 +1465,7 @@
   1.113  
   1.114  		# Some packages are not included in some arch or fail to cross compile.
   1.115  		: ${HOST_ARCH=i486}
   1.116 +		debug "Host arch $HOST_ARCH"
   1.117  		if ! $(echo "$HOST_ARCH" | fgrep -q $ARCH); then
   1.118  			_ "cook: HOST_ARCH=\$HOST_ARCH"
   1.119  			_ "cook: \$pkg doesn't cook or is not included in: \$ARCH"