wok-next rev 4163

tazbb: url encoding
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Sep 22 17:01:51 2009 +0200 (2009-09-22)
parents 8fa4196121d4
children 85c80e4d99a3
files tazbb/stuff/tazbb
line diff
     1.1 --- a/tazbb/stuff/tazbb	Tue Sep 22 15:52:14 2009 +0200
     1.2 +++ b/tazbb/stuff/tazbb	Tue Sep 22 17:01:51 2009 +0200
     1.3 @@ -118,6 +118,12 @@
     1.4  	echo ""
     1.5  }
     1.6  
     1.7 +# URL encoding
     1.8 +escape()
     1.9 +{
    1.10 +	echo $1 | sed -e 's/+/%2B/g' -e 's|/|%2F|g' -e 's/:/%3A/g'
    1.11 +}
    1.12 +
    1.13  update_wok()
    1.14  {
    1.15  	echo ""
    1.16 @@ -210,7 +216,7 @@
    1.17  		# Rebuild unbuilt packages list with link to log file. This list
    1.18  		# is also generated by cook_inslall to have real time stats.
    1.19  		if [ ! -d $BUILD_WOK/$PACKAGE/taz ]; then
    1.20 -			echo "<a href=\"log.php?package=$PACKAGE\">$PACKAGE</a>" \
    1.21 +			echo "<a href=\"log.php?package=$(escape $PACKAGE)\">$PACKAGE</a>" \
    1.22  				>> $DB_DIR/unbuilt
    1.23  		fi
    1.24  	done
    1.25 @@ -252,7 +258,7 @@
    1.26  		BUILD_DEPENDS=""
    1.27  		SOURCE=""
    1.28  		WANTED=""
    1.29 -		echo "(cooking <a href=\"log.php?package=$pkg\">$pkg</a>)" > $DB_DIR/running
    1.30 +		echo "(cooking <a href=\"log.php?package=$(escape $pkg)\">$pkg</a>)" > $DB_DIR/running
    1.31  		tazwok clean $pkg
    1.32  		script -c "echo 'install' | tazwok cook $pkg" $LOG_DIR/$pkg.log
    1.33  		# Install new package (important for new shared libs). Note
    1.34 @@ -267,7 +273,7 @@
    1.35  				--forced
    1.36  		else
    1.37  			# Link to build log.
    1.38 -			echo "<a href=\"log.php?package=$pkg\">$pkg</a>" >> \
    1.39 +			echo "<a href=\"log.php?package=$(escape $pkg)\">$pkg</a>" >> \
    1.40  				$DB_DIR/unbuilt
    1.41  		fi
    1.42  		# Remove package from the cooklist and empty lines for HTML <pre>.
    1.43 @@ -352,7 +358,7 @@
    1.44  	for pkg in `cat $DB_DIR/blocked`
    1.45  	do
    1.46  		if [ -f $LOG_DIR/$pkg.log ]; then
    1.47 -			echo "<a href=\"log.php?package=$pkg\">$pkg</a>" >> \
    1.48 +			echo "<a href=\"log.php?package=$(escape $pkg)\">$pkg</a>" >> \
    1.49  				$DB_DIR/blocked.urls
    1.50  		else
    1.51  			echo "$pkg" >> $DB_DIR/blocked.urls
    1.52 @@ -381,7 +387,7 @@
    1.53  				if [ ! -f fs.cpio.gz ]; then
    1.54  					echo "Missing filesystem    `basename $pkg`"
    1.55  					if [ -f $LOG_DIR/$PACKAGE.log ];then
    1.56 -						echo "Missing filesystem    `basename $pkg` <a href=\"log.php?package=$PACKAGE\">Log</a>" \
    1.57 +						echo "Missing filesystem    `basename $pkg` <a href=\"log.php?package=$(escape $PACKAGE)\">Log</a>" \
    1.58  							>> $DB_DIR/corrupted
    1.59  					else
    1.60  						echo "Missing filesystem    `basename $pkg`" \
    1.61 @@ -393,7 +399,7 @@
    1.62  					if [ -z "$files" ]; then
    1.63  						echo "Empty filesystem      `basename $pkg`"
    1.64  						if [ -f $LOG_DIR/$PACKAGE.log ]; then
    1.65 -							echo "Empty filesystem      `basename $pkg` <a href=\"log.php?package=$PACKAGE\">Log</a>" \
    1.66 +							echo "Empty filesystem      `basename $pkg` <a href=\"log.php?package=$(escape $PACKAGE)\">Log</a>" \
    1.67  								>> $DB_DIR/corrupted
    1.68  						else
    1.69  							echo "Empty filesystem      `basename $pkg`" \
    1.70 @@ -428,7 +434,7 @@
    1.71  		fi
    1.72  		pkg=$2
    1.73  		echo "Starting to cook and install: $pkg"
    1.74 -		echo "(cooking <a href=\"log.php?package=$pkg\">$pkg</a>)" > $DB_DIR/running
    1.75 +		echo "(cooking <a href=\"log.php?package=$(escape $pkg)\">$pkg</a>)" > $DB_DIR/running
    1.76  		tazwok clean $pkg
    1.77  		script -c "echo 'install' | tazwok cook $pkg" $LOG_DIR/$pkg.log
    1.78  		if [ -f $BUILD_WOK/$pkg/taz/*/receipt ]; then