tazwok annotate update-repository @ rev 305

Trying to fix a bug into check_for_incoming
author Antoine Bodin <gokhlayeh@slitaz.org>
date Fri Feb 18 01:32:08 2011 +0100 (2011-02-18)
parents 4798e247d453
children
rev   line source
gokhlayeh@266 1 #!/bin/sh
gokhlayeh@266 2
gokhlayeh@266 3 if ! [ "$1" ]; then
gokhlayeh@266 4 echo "Usage: update-repository LOCAL_REPOSITORY (i.e.: /home/slitaz/experimental)"
gokhlayeh@266 5 exit
gokhlayeh@266 6 fi
gokhlayeh@266 7
gokhlayeh@266 8 WOK=$1/wok
gokhlayeh@266 9 SOURCES_REPOSITORY=$1/src
gokhlayeh@266 10 LOG_DIR=$1/log
slaxemulator@276 11 PACKAGES_REPOSITORY=$1/packages
gokhlayeh@277 12 INCOMING_REPOSITORY=$1/packages-incoming
gokhlayeh@266 13
gokhlayeh@277 14 if [ -d "$WOK" ] && [ -d "$SOURCES_REPOSITORY" ] && [ -d "$LOG_DIR" ] && \
gokhlayeh@277 15 [ -d "$PACKAGES_REPOSITORY" ] && [ -d "$INCOMING_REPOSITORY" ]; then
gokhlayeh@266 16 rm -f $SOURCES_REPOSITORY/sources.list
gokhlayeh@266 17 else
gokhlayeh@266 18 echo "$1 doesn't looks like a LOCAL_REPOSITORY: it doesn't contains one or several of theses directories:
gokhlayeh@266 19 * $WOK
gokhlayeh@266 20 * $SOURCES_REPOSITORY
slaxemulator@276 21 * $PACKAGES_REPOSITORY
gokhlayeh@277 22 * $INCOMING_REPOSITORY
gokhlayeh@266 23 * $LOG_DIR"
gokhlayeh@266 24 exit
gokhlayeh@266 25 fi
gokhlayeh@266 26
gokhlayeh@266 27 echo "Updating logs files..."
gokhlayeh@266 28 cd $LOG_DIR
gokhlayeh@279 29 for i in *.html; do
gokhlayeh@279 30 sed 's~file:///usr/share/slitaz/web~web~' -i $i
gokhlayeh@279 31 done
gokhlayeh@279 32 [ -L web ] || ln -s /usr/share/slitaz/web web
gokhlayeh@266 33 echo "Update done: you can now use 'tazwok webserver on' to add you're repository to webinterface.
gokhlayeh@266 34 If you use the path by default, it will be available at: http://localhost/vhosts/bb
gokhlayeh@266 35 This command need lighttpd & php installed to be used."
gokhlayeh@266 36
gokhlayeh@266 37 echo "
gokhlayeh@266 38 Changing sources pathes according new changes into tazwok-experimental and generating $SOURCES_REPOSITORY/sources.list."
gokhlayeh@266 39 cd $WOK
gokhlayeh@266 40 for i in *; do
gokhlayeh@266 41 unset PACKAGE SOURCE VERSION WGET_URL TARBALL
gokhlayeh@266 42 source $i/receipt
gokhlayeh@266 43 [ "$WGET_URL" ] || continue
gokhlayeh@266 44 # Check that source is at the good location; if not move it or remove it if it's a duplicate.
gokhlayeh@266 45 if [ "$SOURCE" ]; then
gokhlayeh@266 46 if [ -f "$SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma" ]; then
gokhlayeh@266 47 if [ -f "$SOURCES_REPOSITORY/$SOURCE-$VERSION.tar.lzma" ]; then
gokhlayeh@266 48 rm $SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma
gokhlayeh@266 49 else
gokhlayeh@266 50 mv $SOURCES_REPOSITORY/$PACKAGE-$VERSION.tar.lzma $SOURCES_REPOSITORY/$SOURCE-$VERSION.tar.lzma
gokhlayeh@266 51 fi
gokhlayeh@266 52 fi
gokhlayeh@266 53 fi
gokhlayeh@277 54 if grep -q "^$PACKAGE | $VERSION" $PACKAGES_REPOSITORY/packages.desc; then
gokhlayeh@279 55 main_version="$VERSION"
slaxemulator@276 56 if [ -f $SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma ]; then
slaxemulator@276 57 echo -e "$PACKAGE:main\t${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" >> $SOURCES_REPOSITORY/sources.list
slaxemulator@276 58 elif [ -f "SOURCES_REPOSITORY/$TARBALL" ]; then
slaxemulator@276 59 echo -e "$PACKAGE:main\t$TARBALL" >> $SOURCES_REPOSITORY/sources.list
slaxemulator@276 60 fi
slaxemulator@276 61 else
gokhlayeh@277 62 # May not works if package use extraversion.
gokhlayeh@277 63 main_version=$(grep -m1 -A1 -sh ^$PACKAGE$ $PACKAGES_REPOSITORY/packages.txt | tail -1 | sed 's/ *//')
gokhlayeh@277 64 if [ -f $SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-$main_version.tar.lzma ]; then
gokhlayeh@277 65 echo -e "$PACKAGE:main\t${SOURCE:-$PACKAGE}-$main_version.tar.lzma" >> $SOURCES_REPOSITORY/sources.list
gokhlayeh@277 66 else
gokhlayeh@277 67 unset main_version
gokhlayeh@277 68 fi
gokhlayeh@277 69 fi
gokhlayeh@277 70 if [ ! "$main_version" ] || grep -q "^$PACKAGE | $VERSION" $INCOMING_REPOSITORY/packages.desc; then
slaxemulator@276 71 if [ -f $SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma ]; then
slaxemulator@276 72 echo -e "$PACKAGE:incoming\t${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" >> $SOURCES_REPOSITORY/sources.list
slaxemulator@276 73 elif [ -f "SOURCES_REPOSITORY/$TARBALL" ]; then
slaxemulator@276 74 echo -e "$PACKAGE:incoming\t$TARBALL" >> $SOURCES_REPOSITORY/sources.list
slaxemulator@276 75 fi
gokhlayeh@266 76 fi
gokhlayeh@266 77 done
gokhlayeh@266 78 echo "Done."
gokhlayeh@266 79 echo "
gokhlayeh@266 80 You can check/purge old sources tarball and sources tarball unrelated to wok receipts using 'tazwok clean-src'"