tazwok rev 480 4.3

tazwok, gen_package(): try to fix the new lib change feature
author Antoine Bodin <gokhlayeh@slitaz.org>
date Thu Apr 07 18:51:35 2011 +0200 (2011-04-07)
parents d5577ee760d9
children 2e688470b0e5
files tazwok
line diff
     1.1 --- a/tazwok	Wed Apr 06 21:32:24 2011 +0200
     1.2 +++ b/tazwok	Thu Apr 07 18:51:35 2011 +0200
     1.3 @@ -1164,36 +1164,55 @@
     1.4  		fi
     1.5  		LAST_FILE="$file"
     1.6  	done > files.list
     1.7 -	
     1.8 +
     1.9  	# Next, check if something has changed in lib files.
    1.10  	# Plan to recook each packages which depends on libs
    1.11  	# which doesn't exists anymore.
    1.12 -    libs=$(for file in $(find * -type f); do
    1.13 +	for rep in $INCOMING_REPOSITORY $PACKAGES_REPOSITORY; do
    1.14 +		prev_VERSION=$(get_pkg_version $rep)
    1.15 +		[ "$prev_VERSION" ] && pkg_file=$rep/$PACKAGE-$prev_VERSION.tazpkg && break
    1.16 +	done
    1.17 +	if [ "$pkg_file" ]; then
    1.18 +		report step "Looking if reverse depends needs to be refreshed"
    1.19 +		get_pkg_files $pkg_file
    1.20 +		cd $WOK/$PACKAGE/taz/$PACKAGE-$VERSION
    1.21 +
    1.22 +		pkg_to_check=$(diff files.list $pkg_files_dir/files.list | \
    1.23 +		grep '^-/.*\.so' | while read lib; do
    1.24 +			fgrep " ${lib##*/} " $libs_db | cut -f1
    1.25 +		done | sort -u)
    1.26 +
    1.27 +		if [ "$pkg_to_check" ]; then
    1.28 +			for rdep in $(scan $PACKAGE --look_for=rdep | use_wanted); do
    1.29 +				echo "$pkg_to_check" | grep -q ^$PACKAGE$ || continue
    1.30 +				[ "$rdep" = "${WANTED:-$PACKAGE}" ] && continue
    1.31 +				grep -q ^$rdep$ $blocked $cooklist && continue
    1.32 +				echo "Plan to recook $rdep"
    1.33 +				echo $rdep >> $cooklist
    1.34 +				regen_cooklist=yes
    1.35 +			done
    1.36 +		fi
    1.37 +
    1.38 +		rm -r $pkg_files_dir
    1.39 +		unset pkg_file pkg_file_dir pkg_to_check
    1.40 +		report end-step
    1.41 +	fi
    1.42 +	
    1.43 +	# Update lib_db
    1.44 +	libs=$(for file in $(find * -type f); do
    1.45  	[ "$(dd if=$file bs=1 skip=1 count=3 2> /dev/null)" = "ELF" ] || continue
    1.46  		LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $PWD/$file
    1.47  	done | { cut -f 1 -d ' ' | tr -d '\t' | sort -u | \
    1.48  	sed -e 's/^linux-gate.so.*$/SLIB/' -e 's~^/lib/ld-.*$~SLIB~' \
    1.49  		-e '/^statically$/d' | tr '\n' ' '; })
    1.50 -	[ "$libs" ] && libs=$(echo " $libs" | sed -r 's/( SLIB)+ / /g')
    1.51 -	old_libs=$(grep -m1 ^$PACKAGE$'\t' $lib_db | cut -f 2)
    1.52 -	if [ "$old_libs" ]; then
    1.53 -		report step "Looking if reverse depends needs to be refreshed"
    1.54 -		for i in $old_libs; do
    1.55 -			[ "${libs/ $i }" = "$libs" ] || continue
    1.56 -			fgrep " $i " $lib_db | cut -f 1
    1.57 -		done | sort -u | while read rdep; do
    1.58 -			[ "$rdep" = "${WANTED:-$PACKAGE}" ] && continue
    1.59 -			grep -q ^$rdep$ $blocked $cooklist && continue
    1.60 -			echo "Plan to recook $rdep"
    1.61 -			echo $rdep >> $cooklist
    1.62 -		done
    1.63 -		sed "/^$PACKAGE\t/d" -i $lib_db
    1.64 -		report end-step
    1.65 -	fi
    1.66 +
    1.67 +	sed "/$PACKAGE\t/d" -i $lib_db
    1.68  	if [ "$libs" ]; then
    1.69 +		libs=$(echo " $libs" | sed -r 's/( SLIB)+ / /g')
    1.70  		echo -e "$PACKAGE\t$libs" >> $lib_db
    1.71  		sort -o $lib_db $lib_db
    1.72  	fi
    1.73 +	unset libs
    1.74  
    1.75  	if [ ! "$EXTRAVERSION" ]; then
    1.76  		case "$PACKAGE" in
    1.77 @@ -1203,6 +1222,7 @@
    1.78  		esac
    1.79  	fi
    1.80  	rm -f $INCOMING_REPOSITORY/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg 2> /dev/null
    1.81 +
    1.82  	report step "Creating md5sum of files"
    1.83  	while read file; do
    1.84  		[ -L "fs$file" ] && continue