tazwok rev 381

Fix gen_package); check for empty fs; add !fs COOK_OPT to allow packages without fs.
author Antoine Bodin <gokhlayeh@slitaz.org>
date Mon Feb 28 23:09:40 2011 +0100 (2011-02-28)
parents 10cdaa252324
children 873c800ecd9e
files tazwok
line diff
     1.1 --- a/tazwok	Mon Feb 28 16:53:48 2011 +0100
     1.2 +++ b/tazwok	Mon Feb 28 23:09:40 2011 +0100
     1.3 @@ -870,6 +870,11 @@
     1.4  check_fsh()
     1.5  {
     1.6  	cd $WOK/$PACKAGE/taz/*/fs
     1.7 +	if ! [ "$(find * -type f)" ]; then
     1.8 +		echo "$PACKAGE fs is empty." >&2
     1.9 +		cd $WOK/$PACKAGE && rm -rf taz
    1.10 +		return 1
    1.11 +	fi
    1.12  	[ -n "$FSH" ] || FSH="bin boot dev etc home init lib media mnt proc \
    1.13  root sbin share sys tmp usr var vz usr/bin usr/games usr/include usr/lib \
    1.14  usr/local usr/sbin usr/share usr/src"
    1.15 @@ -902,8 +907,9 @@
    1.16  
    1.17  		# Dont generate a corrupted package.
    1.18  		cd $WOK/$PACKAGE && rm -rf taz
    1.19 -		report exit
    1.20 +		return 1
    1.21  	fi
    1.22 +	return 0
    1.23  }
    1.24  
    1.25  gen_cookmd5()
    1.26 @@ -920,6 +926,22 @@
    1.27  	fi
    1.28  }
    1.29  
    1.30 +set_pkg_broken()
    1.31 +{
    1.32 +	if ! grep -q ^$PACKAGE$ $PACKAGES_REPOSITORY/broken; then
    1.33 +		echo $PACKAGE >> $PACKAGES_REPOSITORY/broken
    1.34 +	fi
    1.35 +
    1.36 +	# Remove pkg from cooklist to avoid re-cook it if no changes happens
    1.37 +	# in the cook stuff.
    1.38 +	sed "/^$PACKAGE$/d" -i $PACKAGES_REPOSITORY/cooklist
    1.39 +
    1.40 +	gen_cookmd5
    1.41 +
    1.42 +	# Return 1 to make report know that's mother-function failed.
    1.43 +	return 1
    1.44 +}
    1.45 +
    1.46  # Create a package tree and build the gziped cpio archive
    1.47  # to make a SliTaz (.tazpkg) package.
    1.48  gen_package()
    1.49 @@ -927,8 +949,7 @@
    1.50  	check_root
    1.51  	check_for_package_on_cmdline
    1.52  	check_for_receipt
    1.53 -	EXTRAVERSION=""
    1.54 -	. $RECEIPT
    1.55 +	source_receipt
    1.56  	
    1.57  	# May compute VERSION
    1.58  	if grep -q ^get_version $RECEIPT; then
    1.59 @@ -941,8 +962,8 @@
    1.60  	[ -d "taz" ] &&	rm -rf taz
    1.61  	
    1.62  	# Create the package tree and set useful variables.
    1.63 -	mkdir -p $WOK/$PACKAGE/taz/$PACKAGE-$VERSION/fs
    1.64  	fs=$WOK/$PACKAGE/taz/$PACKAGE-$VERSION/fs
    1.65 +	mkdir -p $fs
    1.66  	
    1.67  	# Set $src for standard package and $_pkg variables.
    1.68  	set_src_path
    1.69 @@ -952,16 +973,18 @@
    1.70  	# the package.
    1.71  	report step "Building $PACKAGE with the receipt"
    1.72  	report open-bloc
    1.73 -	if grep -q ^genpkg_rules $RECEIPT; then
    1.74 +	if look_for_cookopt !fs; then
    1.75 +		:
    1.76 +	elif grep -q ^genpkg_rules $RECEIPT; then
    1.77  		
    1.78  		# Log process.
    1.79  		echo "executing genpkg_rules" >> $LOG
    1.80  		report step "Executing genpkg_rules"
    1.81 -		( set -e;  genpkg_rules ) || return 1
    1.82 +		( set -e;  genpkg_rules ) || { set_pkg_broken; report close-bloc; return 1; }
    1.83 +		check_fsh || { set_pkg_broken; report close-bloc; return 1; }
    1.84 +		cd $WOK/$PACKAGE
    1.85  		report end-step
    1.86 -		check_fsh
    1.87 -		cd $WOK/$PACKAGE
    1.88 -		
    1.89 +
    1.90  		# Skip generic files for packages with a WANTED variable
    1.91  		# (dev and splited pkgs).
    1.92  		if [ ! "$WANTED" ]; then
    1.93 @@ -971,7 +994,9 @@
    1.94  		py_compiled_files_remove
    1.95  	else
    1.96  		echo "No package rules to gen $PACKAGE..." >&2
    1.97 -		report exit
    1.98 +		set_pkg_broken
    1.99 +		report close-bloc
   1.100 +		return 1
   1.101  	fi
   1.102  	
   1.103  	# Copy the receipt and description (if exists) into the binary package tree.
   1.104 @@ -2065,7 +2090,7 @@
   1.105  
   1.106  	clean $PACKAGE
   1.107  	[ -s $tmp/cooklist ] && sed "/^$PACKAGE$/d" -i $tmp/cooklist
   1.108 -	
   1.109 +
   1.110  	if compile_package; then
   1.111  		remove_src
   1.112  		refresh_packages_from_compile
   1.113 @@ -2088,12 +2113,7 @@
   1.114  		done
   1.115  		report end-step
   1.116  	else
   1.117 -
   1.118 -		# Set package as broken.
   1.119 -		if ! grep -q ^$PACKAGE$ $PACKAGES_REPOSITORY/broken; then
   1.120 -			echo $PACKAGE >> $PACKAGES_REPOSITORY/broken
   1.121 -		fi
   1.122 -		gen_cookmd5
   1.123 +		set_pkg_broken
   1.124  		cook_code=1
   1.125  	fi
   1.126