tazwok rev 277

Append both main: & incoming: when both packages exists; using packages.desc instead of package name to check for main package (allow to find thoses with extraversion).
author Antoine Bodin <gokhlayeh@slitaz.org>
date Mon Feb 14 17:19:23 2011 +0100 (2011-02-14)
parents 91fd51513c01
children a7ae2a2c76b5
files update-repository
line diff
     1.1 --- a/update-repository	Mon Feb 14 05:53:20 2011 +0000
     1.2 +++ b/update-repository	Mon Feb 14 17:19:23 2011 +0100
     1.3 @@ -9,24 +9,27 @@
     1.4  SOURCES_REPOSITORY=$1/src
     1.5  LOG_DIR=$1/log
     1.6  PACKAGES_REPOSITORY=$1/packages
     1.7 +INCOMING_REPOSITORY=$1/packages-incoming
     1.8  
     1.9 -if [ -d "$WOK" ] && [ -d "$SOURCES_REPOSITORY" ] && [ -d "$LOG_DIR" ] && [ -d "$PACKAGES_REPOSITORY" ]; then
    1.10 +if [ -d "$WOK" ] && [ -d "$SOURCES_REPOSITORY" ] && [ -d "$LOG_DIR" ] && \
    1.11 +	[ -d "$PACKAGES_REPOSITORY" ] && [ -d "$INCOMING_REPOSITORY" ]; then
    1.12  	rm -f $SOURCES_REPOSITORY/sources.list
    1.13  else
    1.14  	echo "$1 doesn't looks like a LOCAL_REPOSITORY: it doesn't contains one or several of theses directories:
    1.15  	* $WOK
    1.16  	* $SOURCES_REPOSITORY
    1.17  	* $PACKAGES_REPOSITORY
    1.18 +	* $INCOMING_REPOSITORY
    1.19  	* $LOG_DIR"
    1.20  	exit
    1.21  fi
    1.22  
    1.23  echo "Updating logs files..."
    1.24  cd $LOG_DIR
    1.25 -for i in *.html; do
    1.26 -	sed 's~file:///usr/share/slitaz/web~web~' -i $i
    1.27 -done
    1.28 -[ -L web ] || ln -s /usr/share/slitaz/web web
    1.29 +#for i in *.html; do
    1.30 +#	sed 's~file:///usr/share/slitaz/web~web~' -i $i
    1.31 +#done
    1.32 +#[ -L web ] || ln -s /usr/share/slitaz/web web
    1.33  echo "Update done: you can now use 'tazwok webserver on' to add you're repository to webinterface.
    1.34  If you use the path by default, it will be available at: http://localhost/vhosts/bb
    1.35  This command need lighttpd & php installed to be used."
    1.36 @@ -48,13 +51,23 @@
    1.37  			fi
    1.38  		fi
    1.39  	fi
    1.40 -	if [ -f $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg ]; then
    1.41 +	if grep -q "^$PACKAGE | $VERSION" $PACKAGES_REPOSITORY/packages.desc; then
    1.42 +		main_version="$VERSION"	
    1.43  		if [ -f $SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma ]; then
    1.44  			echo -e "$PACKAGE:main\t${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" >> $SOURCES_REPOSITORY/sources.list
    1.45   		elif [ -f "SOURCES_REPOSITORY/$TARBALL" ]; then
    1.46  			echo -e "$PACKAGE:main\t$TARBALL" >> $SOURCES_REPOSITORY/sources.list
    1.47  		fi
    1.48  	else
    1.49 +		# May not works if package use extraversion.
    1.50 +		main_version=$(grep -m1 -A1 -sh ^$PACKAGE$ $PACKAGES_REPOSITORY/packages.txt | tail -1 | sed 's/ *//')
    1.51 +		if [ -f $SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-$main_version.tar.lzma ]; then
    1.52 +			echo -e "$PACKAGE:main\t${SOURCE:-$PACKAGE}-$main_version.tar.lzma" >> $SOURCES_REPOSITORY/sources.list
    1.53 +		else
    1.54 +			unset main_version
    1.55 +		fi
    1.56 +	fi
    1.57 +	if [ ! "$main_version" ] || grep -q "^$PACKAGE | $VERSION" $INCOMING_REPOSITORY/packages.desc; then
    1.58  		if [ -f $SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma ]; then
    1.59  			echo -e "$PACKAGE:incoming\t${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" >> $SOURCES_REPOSITORY/sources.list
    1.60   		elif [ -f "SOURCES_REPOSITORY/$TARBALL" ]; then