wok rev 4185

tazbb: fix sort cook list
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Sep 23 08:28:30 2009 +0200 (2009-09-23)
parents 9fca80ea1eb6
children 179928518182
files tazbb/stuff/tazbb
line diff
     1.1 --- a/tazbb/stuff/tazbb	Wed Sep 23 05:48:11 2009 +0000
     1.2 +++ b/tazbb/stuff/tazbb	Wed Sep 23 08:28:30 2009 +0200
     1.3 @@ -281,30 +281,43 @@
     1.4  		WANTED=""
     1.5  		BUILD_DEPENDS=""
     1.6  		. $BUILD_WOK/$pkg/receipt
     1.7 +		MISSING=""
     1.8  		for i in $WANTED $BUILD_DEPENDS ; do
     1.9  			if [ ! -f $BUILD_WOK/$i/taz/*/receipt ]; then
    1.10 -				echo -n " $i"
    1.11 +				case " $MISSING " in
    1.12 +				*\ $i\ *);;
    1.13 +				*) echo -n " $i";;
    1.14 +				esac
    1.15 +				MISSING="$MISSING $i"
    1.16  			fi
    1.17  		done
    1.18  		echo ""
    1.19 -	done | awk '{
    1.20 -		if ($2 == "") print;
    1.21 -		else {
    1.22 -			depcnt[$1] = NF - 1;
    1.23 -			unres = unres " " $1;
    1.24 -			for (i = 2; i <= NF; i++) {
    1.25 -				revdepcnt[$i]++;
    1.26 -				revdep[$i] = revdep[$i] " " $1;
    1.27 -			}
    1.28 +	done | awk '
    1.29 +function show(name)
    1.30 +{
    1.31 +	print name;
    1.32 +	got[name]++;
    1.33 +	if (revdepcnt[name] > 0)
    1.34 +		for (i = split(revdep[name], pkg, " "); i > 0; i--)
    1.35 +			if (--depcnt[pkg[i]] == 0) show(pkg[i]);
    1.36 +}
    1.37 +
    1.38 +{
    1.39 +	if ($2 == "") show($1);
    1.40 +	else {
    1.41 +		depcnt[$1] = NF - 1;
    1.42 +		unres = unres " " $1;
    1.43 +		for (i = 2; i <= NF; i++) {
    1.44 +			if (got[$i] > 0) continue;
    1.45 +			revdepcnt[$i]++;
    1.46 +			revdep[$i] = revdep[$i] " " $1;
    1.47  		}
    1.48 -		if (revdepcnt[$1] > 0)
    1.49 -			for (i = split(revdep[$1], pkg, " "); i > 0; i--)
    1.50 -				if (--depcnt[pkg[i]] == 0) print pkg[i];
    1.51  	}
    1.52 -	END {
    1.53 -		for (i = split(unres, pkg, " "); i > 0; i--)
    1.54 -			if (depcnt[pkg[i]] > 0) print pkg[i];
    1.55 -	}
    1.56 +}
    1.57 +END {
    1.58 +	for (i = split(unres, pkg, " "); i > 0; i--)
    1.59 +		if (depcnt[pkg[i]] > 0) print pkg[i];
    1.60 +}
    1.61  '
    1.62  }
    1.63