# HG changeset patch # User Aleksej Bobylev # Date 1496860795 -10800 # Node ID a608dbb232df2a38cff643c62763c0c7acc2c800 # Parent 1e4e278b22854b7f7632674f34f4d71877071cc5 modules/pkgdb: works for receipts v2 too now. diff -r 1e4e278b2285 -r a608dbb232df lighttpd/index.cgi --- a/lighttpd/index.cgi Tue Jun 06 17:29:00 2017 +0300 +++ b/lighttpd/index.cgi Wed Jun 07 21:39:55 2017 +0300 @@ -484,8 +484,8 @@ -e 's#^.*No package .* found.*#\0#' \ -e 's#^.*Unable to find.*#\0#' \ -e 's#^.*[Ii]nvalid.*#\0#' \ - -e 's#\([Nn][Oo][Tt] found\)$#\1#' \ - -e 's#\(found\)$#\1#' \ + -e 's#\([Nn][Oo][Tt] found\.*\)$#\1#' \ + -e 's#\(found\.*\)$#\1#' \ \ -e 's#^.*WARNING:.*#\0#' \ -e 's#^.*warning:.*#\0#' \ diff -r 1e4e278b2285 -r a608dbb232df modules/pkgdb --- a/modules/pkgdb Tue Jun 06 17:29:00 2017 +0300 +++ b/modules/pkgdb Wed Jun 07 21:39:55 2017 +0300 @@ -27,6 +27,7 @@ # as well as flavors files for TazLiTo. We don't need logs since we do it # manually to ensure everything is fine before syncing the mirror. +# Find how much time was spent the last time (for web interface) lastcooktime=$(sed '/Time:/!d; s|.*: *\([0-9]*\)s.*|\1|' $LOGS/pkgdb.log 2>/dev/null | sed '$!d') [ -n "$lastcooktime" ] && echo "cook:pkgdb $lastcooktime $(date +%s)" >> $cooktime while read cmd duration start; do @@ -75,34 +76,41 @@ _n 'Creating file "%s"' 'descriptions.txt' | dblog rm $PKGS/descriptions.txt 2>/dev/null for i in $(ls $WOK | sort); do - if [ -e "$WOK/$i/description.txt" ]; then - echo "$i" >> descriptions.txt - cat "$WOK/$i/description.txt" | sed 's|^$| |' >> descriptions.txt + [ -d "$WOK/$i/taz" ] || continue + + for j in $(ls $WOK/$i/taz | sort); do + [ -e "$WOK/$i/taz/$j/description.txt" ] || continue + + pkgname=$(. $WOK/$i/taz/$j/receipt; echo $PACKAGE) + echo "$pkgname" >> descriptions.txt + cat "$WOK/$i/taz/$j/description.txt" | sed 's|^$| |' >> descriptions.txt echo >> descriptions.txt - fi + done done echo " ($(filesize $PKGS/descriptions.txt))" | dblog _ 'Creating lists from "%s"' "$WOK" | dblog cd $WOK -for pkg in *; do - unset_receipt - . $pkg/receipt - # PACKED_SIZE and UNPACKED_SIZE are only in built receipt - [ -s $pkg/taz/*/receipt ] && . $pkg/taz/*/receipt +for i in *; do + [ -d "$WOK/$i/taz" ] || continue - if [ -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" ] || \ - [ -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg" ]; then + for j in $(ls $WOK/$i/taz | sort); do + [ -f "$WOK/$i/taz/$j/receipt" ] || continue + unset_receipt + . $i/taz/$j/receipt - # packages.desc lets us search easily in DB - cat >> $PKGS/packages.desc <> $PKGS/packages.desc <> $PKGS/packages.txt <> $PKGS/packages.txt <> $PKGS/packages.info <> $PKGS/packages.info <> $PKGS/packages.equiv + # packages.equiv is used by tazpkg install to check depends. + for k in $PROVIDE; do + DEST='' + echo $k | fgrep -q : && DEST="${k#*:}:" + if grep -qs ^${k%:*}= $PKGS/packages.equiv; then + sed -i "s/^${k%:*}=/${k%:*}=$DEST$PACKAGE /" \ + $PKGS/packages.equiv + else + echo "${k%:*}=$DEST$PACKAGE" >> $PKGS/packages.equiv + fi + done + + # files.list provides a list of all packages files. + cat $i/taz/$j/files.list | sed s/^/"$i: \0"/ >> $PKGS/files.list + + # list of unnecessary packages + sed -i "/ $PACKAGE-$VERSION$EXTRAVERSION.tazpkg/d" $PKGS/packages.toremove + else + # if receipt variable HOST_ARCH absent/empty or contains ARCH + if [ -z "$HOST_ARCH" -o "${HOST_ARCH/$ARCH/}" != "$HOST_ARCH" ]; then + _ ' - absent: %s (%s)' "$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" "$ARCH" | dblog fi - done - - # files.list provides a list of all packages files. - [ -d $pkg/taz ] && cat $pkg/taz/*/files.list | sed s/^/"$pkg: \0"/ >> $PKGS/files.list - - # list of unnecessary packages - sed -i "/ $PACKAGE-$VERSION$EXTRAVERSION.tazpkg/d" $PKGS/packages.toremove - else - # if receipt variable HOST_ARCH absent/empty or contains ARCH - if [ -z "$HOST_ARCH" -o "${HOST_ARCH/$ARCH/}" != "$HOST_ARCH" ]; then - _ ' - absent: %s (%s)' "$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" "$ARCH" | dblog fi - fi + done done # Display list size.