tazwok rev 28

clean_wok + packages.txt (list with more info for the mirror)
author Christophe Lincoln <pankso@slitaz.org>
date Wed Feb 06 15:07:36 2008 +0100 (2008-02-06)
parents 455c8f46f7c3
children 8ea35aad6aeb
files tazwok
line diff
     1.1 --- a/tazwok	Wed Feb 06 00:36:56 2008 +0100
     1.2 +++ b/tazwok	Wed Feb 06 15:07:36 2008 +0100
     1.3 @@ -93,7 +93,7 @@
     1.4    cook-list      Cook all packages specified in the list by order.
     1.5    clean          Clean all generated files in the package tree.
     1.6    new-tree       Prepare a new package tree and receipt (--interactive).
     1.7 -  gen-list       Generate a packages.list and md5sum for a repository.
     1.8 +  gen-list       Generate a packages lists for a repository (--text).
     1.9    gen-clean-wok  Gen a clean wok in a dir ('clean-wok' cleans current wok).
    1.10    remove         Remove a package from the wok.\n"
    1.11  }
    1.12 @@ -227,7 +227,7 @@
    1.13  	echo "Starting to cook $PACKAGE..."
    1.14  	echo "================================================================================"
    1.15  	# Check for src tarball and wget if needed.
    1.16 -	if [ ! "$TARBALL" = "" ]; then
    1.17 +	if [ ! "$WGET_URL" = "" ]; then
    1.18  		echo "Checking for source tarball... "
    1.19  		if [ ! -f "$SOURCES_REPOSITORY/$TARBALL" ]; then
    1.20  			cd $SOURCES_REPOSITORY
    1.21 @@ -262,7 +262,7 @@
    1.22  	cd $WOK/$PACKAGE
    1.23  	# Log and execute compile_rules function if it exist, to configure and
    1.24  	# make the package if it exist.
    1.25 -	if [ `cat $RECEIPT | grep compile_rules` ]; then
    1.26 +	if grep -q ^compile_rules $RECEIPT; then
    1.27  		echo "executing compile_rules" >> $LOG
    1.28  		compile_rules
    1.29  		# Exit if compilation failed so the binary package
    1.30 @@ -375,7 +375,7 @@
    1.31  	echo ""
    1.32  	echo "Bulding $PACKAGE with the receipt..."
    1.33  	echo "================================================================================"
    1.34 -	if [ `cat $RECEIPT | grep ^genpkg_rules` ]; then
    1.35 +	if grep -q ^genpkg_rules $RECEIPT; then
    1.36  		# Log process.
    1.37  		echo "executing genpkg_rules" >> $LOG
    1.38  		genpkg_rules
    1.39 @@ -438,6 +438,32 @@
    1.40  	echo ""
    1.41  }
    1.42  
    1.43 +# Optional text packages list for gen-list.
    1.44 +gen_textlist()
    1.45 +{
    1.46 +	DATE=`date +%Y-%m-%d\ \%H:%M:%S`
    1.47 +	echo -n "Creating the text packages list... "
    1.48 +	cat >> packages.txt << _EOT_
    1.49 +# SliTaz GNU/Linux - Packages list
    1.50 +#
    1.51 +# Packages : _packages_
    1.52 +# Date     : $DATE
    1.53 +#
    1.54 +_EOT_
    1.55 +	for pkg in $WOK/*
    1.56 +	do
    1.57 +	. $pkg/receipt
    1.58 +	cat >> packages.txt << _EOT_
    1.59 +
    1.60 +$PACKAGE
    1.61 +    $VERSION
    1.62 +    $SHORT_DESC
    1.63 +_EOT_
    1.64 +	packages=$(($packages+1))
    1.65 +	done && status
    1.66 +	sed -i s/"_packages_"/"$packages"/ packages.txt
    1.67 +}
    1.68 +
    1.69  ###################
    1.70  # Tazwok commands #
    1.71  ###################
    1.72 @@ -475,7 +501,7 @@
    1.73  				. $pkg/receipt
    1.74  				if [ "$CATEGORY" == "$ASKED_CATEGORY" ]; then
    1.75  					echo -n "$PACKAGE"
    1.76 -					echo -e "\033[24G $VERSION"
    1.77 +					echo -e "\033[28G $VERSION"
    1.78  					packages=$(($packages+1))
    1.79  				fi
    1.80  			done
    1.81 @@ -490,7 +516,7 @@
    1.82  			do
    1.83  				. $pkg/receipt
    1.84  				echo -n "$PACKAGE"
    1.85 -				echo -en "\033[24G $VERSION"
    1.86 +				echo -en "\033[28G $VERSION"
    1.87  				echo -e "\033[42G $CATEGORY"
    1.88  				packages=$(($packages+1))
    1.89  			done
    1.90 @@ -604,11 +630,15 @@
    1.91  		echo ""
    1.92  		echo "Cleaning $PACKAGE..."
    1.93  		echo "================================================================================"
    1.94 +		# Check for clean_wok function.
    1.95 +		if grep -q ^clean_wok $RECEIPT; then
    1.96 +			clean_wok
    1.97 +		fi
    1.98 +		# Remove taz/ and source tree if exist.
    1.99  		if [ -d "taz" ]; then
   1.100  			echo -n "Removing taz files..."
   1.101  			rm -rf taz && status
   1.102  		fi
   1.103 -		# Remove source tree if exist.
   1.104  		if [ -d "$PACKAGE-$VERSION" ]; then
   1.105  			echo -n "Removing source files..."
   1.106  			rm -rf $PACKAGE-$VERSION && status
   1.107 @@ -626,6 +656,7 @@
   1.108  		if [ -f "process.log" ]; then
   1.109  			echo -n "Removing process log file..."
   1.110  			rm process.log && status
   1.111 +			echo "================================================================================"
   1.112  		fi
   1.113  		echo "$PACKAGE is clean. You can cook it again..."
   1.114  		echo ""
   1.115 @@ -674,12 +705,14 @@
   1.116  		echo ""
   1.117  		;;
   1.118  	gen-list)
   1.119 -		# cd in the directory to creat a packages.list and the md5sum file.
   1.120  		# Sed is used to remove all the .tazpkg extensions from the
   1.121  		# packages.list. The directory to move in by default is the repository
   1.122 -		# if $3 is not empty cd into $3.
   1.123 +		# if $2 is not empty cd into $2. A text packages list can also be gen
   1.124 +		# with the option --text.
   1.125  		#
   1.126 -		if [ -z "$2" ]; then
   1.127 +		if [ "$2" == "--text" ]; then
   1.128 +			textlist="yes"
   1.129 +		elif [ -z "$2" ]; then
   1.130  			PACKAGES_REPOSITORY=$PACKAGES_REPOSITORY
   1.131  		else
   1.132  			if [ -d "$2" ]; then
   1.133 @@ -691,10 +724,16 @@
   1.134  		fi
   1.135  		cd $PACKAGES_REPOSITORY
   1.136  		# Remove old packages.list and md5sum, it well be soon rebuild.
   1.137 -		rm -f packages.list packages.md5
   1.138 +		rm -f packages.list packages.md5 packages.txt
   1.139  		echo ""
   1.140 -		echo "Repository path : $PACKAGES_REPOSITORY"
   1.141 -		echo -n "Creating the packages list... "
   1.142 +		echo -e "\033[1mGenerating packages lists\033[0m"
   1.143 +		echo "================================================================================"
   1.144 +		echo -n "Repository path : $PACKAGES_REPOSITORY" && status
   1.145 +		# Gen packages.txt
   1.146 +		if [ "$textlist" == "yes" ]; then
   1.147 +			gen_textlist
   1.148 +		fi
   1.149 +		echo -n "Creating the raw packages list... "
   1.150  		ls -1 *.tazpkg > /tmp/packages.list
   1.151  		sed -i s/'.tazpkg'/''/ /tmp/packages.list
   1.152  		status