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