tazwok diff tazwok @ rev 133

Add commd 'edit' to easily modify receipt
author Christophe Lincoln <pankso@slitaz.org>
date Mon Jun 22 00:07:16 2009 +0200 (2009-06-22)
parents 770760bb3d44
children f633dd74143b
line diff
     1.1 --- a/tazwok	Sat Apr 11 16:47:36 2009 +0000
     1.2 +++ b/tazwok	Mon Jun 22 00:07:16 2009 +0200
     1.3 @@ -87,6 +87,7 @@
     1.4  \033[1mCommands: \033[0m\n
     1.5    usage          Print this short usage.
     1.6    stats          Print Tazwok statistics from the config file and the wok.
     1.7 +  edit           Edit a package receipt in the current wok.
     1.8    build-depends  Generate a list of packages to build a wok.
     1.9    cmp|compare    Compare the wok and the cooked pkgs (--remove old pkgs).
    1.10    list           List all packages in the wok tree or by category.
    1.11 @@ -374,7 +375,7 @@
    1.12  			done
    1.13  		fi
    1.14  	fi
    1.15 -	# Pixmaps (PNG or/and XPM only). Some icons/images can be added through 
    1.16 +	# Pixmaps (PNG or/and XPM only). Some icons/images can be added through
    1.17  	# genpkg_rules and generic copy can be disabled with GENERIC_PIXMAPS="no"
    1.18  	# in pkg receipt.
    1.19  	if [ ! "$GENERIC_PIXMAPS" = "no" ]; then
    1.20 @@ -464,7 +465,7 @@
    1.21  		echo "executing genpkg_rules" >> $LOG
    1.22  		genpkg_rules
    1.23  		cd $WOK/$PACKAGE
    1.24 -		# Skip generic files for packages with a WANTED variable 
    1.25 +		# Skip generic files for packages with a WANTED variable
    1.26  		# (dev and splited pkgs).
    1.27  		if [ ! "$WANTED" = "" ]; then
    1.28  			continue
    1.29 @@ -500,7 +501,7 @@
    1.30  		if [ "$LAST_FILE" != "" ]; then
    1.31  			case "$file" in
    1.32  			$LAST_FILE/*)
    1.33 -				case "$(ls -ld "$LAST_FILE")" in 
    1.34 +				case "$(ls -ld "$LAST_FILE")" in
    1.35  				drwxr-xr-x\ *\ root\ *\ root\ *);;
    1.36  				*) echo ${LAST_FILE#fs};;
    1.37  				esac;;
    1.38 @@ -536,8 +537,8 @@
    1.39  		description.txt 2> /dev/null | awk '{ sz=$1 } END { print sz }')
    1.40  	status
    1.41  	echo -n "Updating receipt sizes..."
    1.42 -	sed -i s/^PACKED_SIZE.*$// receipt	
    1.43 -	sed -i s/^UNPACKED_SIZE.*$// receipt	
    1.44 +	sed -i s/^PACKED_SIZE.*$// receipt
    1.45 +	sed -i s/^UNPACKED_SIZE.*$// receipt
    1.46  	sed -i "s/^PACKAGE=/PACKED_SIZE=\"$PACKED_SIZE\"\nUNPACKED_SIZE=\"$UNPACKED_SIZE\"\nPACKAGE=/" receipt
    1.47  	sed -i "s/^VERSION=$/VERSION=\"$VERSION\"/" receipt
    1.48  	status
    1.49 @@ -593,7 +594,7 @@
    1.50  _EOT_
    1.51  	if [ -n "$PACKED_SIZE" ]; then
    1.52  		cat >> packages.txt << _EOT_
    1.53 -    $PACKED_SIZE ($UNPACKED_SIZE installed)	
    1.54 +    $PACKED_SIZE ($UNPACKED_SIZE installed)
    1.55  _EOT_
    1.56  	fi
    1.57  	# Packages.desc is used by Tazpkgbox <tree>.
    1.58 @@ -607,7 +608,7 @@
    1.59  			sed -i "s/^${i%:*}=/${i%:*}=$DEST$PACKAGE /" packages.equiv
    1.60  		else
    1.61  			echo "${i%:*}=$DEST$PACKAGE" >> packages.equiv
    1.62 -		fi 
    1.63 +		fi
    1.64  	done
    1.65  	packages=$(($packages+1))
    1.66  	done && status
    1.67 @@ -639,8 +640,8 @@
    1.68  		2> /dev/null) | grep date: | head -1 | cut -c 6-)"
    1.69  	[ -n "$date" ] || { echo "010100001970"; return; }
    1.70  	case "$(echo $date | awk '{ print $2 }')" in
    1.71 -	Jan) mon="01";; Feb) mon="02";; Mar) mon="03";; Apr) mon="04";; 
    1.72 -	May) mon="05";; Jun) mon="06";; Jul) mon="07";; Aug) mon="08";; 
    1.73 +	Jan) mon="01";; Feb) mon="02";; Mar) mon="03";; Apr) mon="04";;
    1.74 +	May) mon="05";; Jun) mon="06";; Jul) mon="07";; Aug) mon="08";;
    1.75  	Sep) mon="09";; Oct) mon="10";; Nov) mon="11";; Dec) mon="12";;
    1.76  	esac
    1.77  	# Reformat, don't mind about TZ: we look for days or months delta
    1.78 @@ -676,8 +677,11 @@
    1.79  Packages in the wok  : `ls -1 $WOK | wc -l`
    1.80  Cooked packages      : `ls -1 $PACKAGES_REPOSITORY/*.tazpkg 2>/dev/null | wc -l`
    1.81  ================================================================================"
    1.82 -		echo ""
    1.83 -		;;
    1.84 +		echo "" ;;
    1.85 +	edit)
    1.86 +		check_for_package_on_cmdline
    1.87 +		check_for_receipt
    1.88 +		$EDITOR $WOK/$PACKAGE/receipt ;;
    1.89  	build-depends)
    1.90  		# List dependancies to rebuild wok
    1.91  		cd $WOK
    1.92 @@ -724,7 +728,7 @@
    1.93  				scan_dep
    1.94  			done
    1.95  		}
    1.96 -		
    1.97 +
    1.98  		# Check for ELF file
    1.99  		is_elf()
   1.100  		{
   1.101 @@ -813,7 +817,7 @@
   1.102  					BASEVERSION=$(. $WANTED/receipt ; echo $VERSION)
   1.103  					if [ "$VERSION" = "$WANTED" ]; then
   1.104  						# BASEVERSION is computed in receipt
   1.105 -						grep -q '_pkg=' $pkg/receipt && 
   1.106 +						grep -q '_pkg=' $pkg/receipt &&
   1.107  						BASEVERSION=$VERSION
   1.108  					fi
   1.109  					if [ "$VERSION" != "$BASEVERSION" ]; then
   1.110 @@ -870,7 +874,7 @@
   1.111  		done
   1.112  		;;
   1.113  	cmp|compare)
   1.114 -		# Compare the wok and packages repository to help with maintaining 
   1.115 +		# Compare the wok and packages repository to help with maintaining
   1.116  		# a mirror.
   1.117  		echo ""
   1.118  		echo -e "\033[1mWok and packages comparison\033[0m
   1.119 @@ -923,7 +927,7 @@
   1.120  				rm $PACKAGES_REPOSITORY/$pkg
   1.121  			else
   1.122  				echo "Old package:     $pkg"
   1.123 -			fi	
   1.124 +			fi
   1.125  		done
   1.126  		cd /tmp
   1.127  		echo "================================================================================"
   1.128 @@ -1000,7 +1004,7 @@
   1.129  		fi
   1.130  		echo "================================================================================"
   1.131  		echo ""
   1.132 -		
   1.133 +
   1.134  		;;
   1.135  	check-log)
   1.136  		# We just cat the file log to view process info.
   1.137 @@ -1291,7 +1295,7 @@
   1.138  			sed -i s/'MAINTAINER=\"\"'/"MAINTAINER=\"$anser\""/ receipt
   1.139  			# Web site.
   1.140  			echo -n "Web site      : " ; read anser
   1.141 -			sed -i s#'WEB_SITE=\"\"'#"WEB_SITE=\"$anser\""# receipt	
   1.142 +			sed -i s#'WEB_SITE=\"\"'#"WEB_SITE=\"$anser\""# receipt
   1.143  			echo ""
   1.144  			# Wget URL.
   1.145  			echo "Wget URL to download source tarball."
   1.146 @@ -1368,7 +1372,7 @@
   1.147  			fi
   1.148  		done
   1.149  		echo "================================================================================"
   1.150 -		echo "Packages maintained by $1: $packages"
   1.151 +		echo "Packages maintained by $2: $packages"
   1.152  		echo "" ;;
   1.153  	usage|*)
   1.154  		# Print usage also for all unknown commands.