cookutils diff modules/pkgdb @ rev 929
Tiny edits
author | Paul Issott <paul@slitaz.org> |
---|---|
date | Thu Jun 15 19:02:13 2017 +0100 (2017-06-15) |
parents | ea11d3c96873 |
children | 5f0da70605b6 |
line diff
1.1 --- a/modules/pkgdb Thu May 11 00:36:43 2017 +0300 1.2 +++ b/modules/pkgdb Thu Jun 15 19:02:13 2017 +0100 1.3 @@ -27,6 +27,7 @@ 1.4 # as well as flavors files for TazLiTo. We don't need logs since we do it 1.5 # manually to ensure everything is fine before syncing the mirror. 1.6 1.7 +# Find how much time was spent the last time (for web interface) 1.8 lastcooktime=$(sed '/Time:/!d; s|.*: *\([0-9]*\)s.*|\1|' $LOGS/pkgdb.log 2>/dev/null | sed '$!d') 1.9 [ -n "$lastcooktime" ] && echo "cook:pkgdb $lastcooktime $(date +%s)" >> $cooktime 1.10 while read cmd duration start; do 1.11 @@ -75,34 +76,41 @@ 1.12 _n 'Creating file "%s"' 'descriptions.txt' | dblog 1.13 rm $PKGS/descriptions.txt 2>/dev/null 1.14 for i in $(ls $WOK | sort); do 1.15 - if [ -e "$WOK/$i/description.txt" ]; then 1.16 - echo "$i" >> descriptions.txt 1.17 - cat "$WOK/$i/description.txt" | sed 's|^$| |' >> descriptions.txt 1.18 + [ -d "$WOK/$i/taz" ] || continue 1.19 + 1.20 + for j in $(ls $WOK/$i/taz | sort); do 1.21 + [ -e "$WOK/$i/taz/$j/description.txt" ] || continue 1.22 + 1.23 + pkgname=$(. $WOK/$i/taz/$j/receipt; echo $PACKAGE) 1.24 + echo "$pkgname" >> descriptions.txt 1.25 + cat "$WOK/$i/taz/$j/description.txt" | sed 's|^$| |' >> descriptions.txt 1.26 echo >> descriptions.txt 1.27 - fi 1.28 + done 1.29 done 1.30 echo " ($(filesize $PKGS/descriptions.txt))" | dblog 1.31 1.32 1.33 _ 'Creating lists from "%s"' "$WOK" | dblog 1.34 cd $WOK 1.35 -for pkg in *; do 1.36 - unset_receipt 1.37 - . $pkg/receipt 1.38 - # PACKED_SIZE and UNPACKED_SIZE are only in built receipt 1.39 - [ -s $pkg/taz/*/receipt ] && . $pkg/taz/*/receipt 1.40 +for i in *; do 1.41 + [ -d "$WOK/$i/taz" ] || continue 1.42 1.43 - if [ -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" ] || \ 1.44 - [ -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg" ]; then 1.45 + for j in $(ls $WOK/$i/taz | sort); do 1.46 + [ -f "$WOK/$i/taz/$j/receipt" ] || continue 1.47 + unset_receipt 1.48 + . $i/taz/$j/receipt 1.49 1.50 - # packages.desc lets us search easily in DB 1.51 - cat >> $PKGS/packages.desc <<EOT 1.52 + if [ -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" -o \ 1.53 + -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg" ]; then 1.54 + 1.55 + # packages.desc lets us search easily in DB 1.56 + cat >> $PKGS/packages.desc <<EOT 1.57 $PACKAGE | $VERSION$EXTRAVERSION | $SHORT_DESC | $CATEGORY | $WEB_SITE 1.58 EOT 1.59 1.60 - # packages.txt used by tazpkg and tazpkg-web also to provide 1.61 - # a human readable package list with version and description. 1.62 - cat >> $PKGS/packages.txt <<EOT 1.63 + # packages.txt used by tazpkg and tazpkg-web also to provide 1.64 + # a human readable package list with version and description. 1.65 + cat >> $PKGS/packages.txt <<EOT 1.66 $PACKAGE 1.67 $VERSION$EXTRAVERSION 1.68 $SHORT_DESC 1.69 @@ -110,38 +118,39 @@ 1.70 1.71 EOT 1.72 1.73 - # packages.info combines TazPkg separate files 1.74 - # and will substitute them all 1.75 - SIZES=$(echo $PACKED_SIZE $UNPACKED_SIZE | sed 's|\.0||g') 1.76 - DEPENDS=$(echo $DEPENDS) # remove newlines from some receipts 1.77 - MD5="$(fgrep " $PACKAGE-$VERSION$EXTRAVERSION.tazpkg" $PKGS/packages.md5 | awk '{print $1}')" 1.78 - cat >> $PKGS/packages.info <<EOT 1.79 + # packages.info combines TazPkg separate files 1.80 + # and will substitute them all 1.81 + SIZES=$(echo $PACKED_SIZE $UNPACKED_SIZE | sed 's|\.0||g') 1.82 + DEPENDS=$(echo $DEPENDS) # remove newlines from some receipts 1.83 + MD5="$(fgrep " $PACKAGE-$VERSION$EXTRAVERSION.tazpkg" $PKGS/packages.md5 | awk '{print $1}')" 1.84 + cat >> $PKGS/packages.info <<EOT 1.85 $PACKAGE $VERSION$EXTRAVERSION $CATEGORY $SHORT_DESC $WEB_SITE $TAGS $SIZES $DEPENDS $MD5 $PROVIDE 1.86 EOT 1.87 1.88 - # packages.equiv is used by tazpkg install to check depends. 1.89 - for i in $PROVIDE; do 1.90 - DEST='' 1.91 - echo $i | fgrep -q : && DEST="${i#*:}:" 1.92 - if grep -qs ^${i%:*}= $PKGS/packages.equiv; then 1.93 - sed -i "s/^${i%:*}=/${i%:*}=$DEST$PACKAGE /" \ 1.94 - $PKGS/packages.equiv 1.95 - else 1.96 - echo "${i%:*}=$DEST$PACKAGE" >> $PKGS/packages.equiv 1.97 + # packages.equiv is used by tazpkg install to check depends. 1.98 + for k in $PROVIDE; do 1.99 + DEST='' 1.100 + echo $k | fgrep -q : && DEST="${k#*:}:" 1.101 + if grep -qs ^${k%:*}= $PKGS/packages.equiv; then 1.102 + sed -i "s/^${k%:*}=/${k%:*}=$DEST$PACKAGE /" \ 1.103 + $PKGS/packages.equiv 1.104 + else 1.105 + echo "${k%:*}=$DEST$PACKAGE" >> $PKGS/packages.equiv 1.106 + fi 1.107 + done 1.108 + 1.109 + # files.list provides a list of all packages files. 1.110 + cat $i/taz/$j/files.list | sed s/^/"$i: \0"/ >> $PKGS/files.list 1.111 + 1.112 + # list of unnecessary packages 1.113 + sed -i "/ $PACKAGE-$VERSION$EXTRAVERSION.tazpkg/d" $PKGS/packages.toremove 1.114 + else 1.115 + # if receipt variable HOST_ARCH absent/empty or contains ARCH 1.116 + if [ -z "$HOST_ARCH" -o "${HOST_ARCH/$ARCH/}" != "$HOST_ARCH" ]; then 1.117 + _ ' - absent: %s (%s)' "$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" "$ARCH" | dblog 1.118 fi 1.119 - done 1.120 - 1.121 - # files.list provides a list of all packages files. 1.122 - [ -d $pkg/taz ] && cat $pkg/taz/*/files.list | sed s/^/"$pkg: \0"/ >> $PKGS/files.list 1.123 - 1.124 - # list of unnecessary packages 1.125 - sed -i "/ $PACKAGE-$VERSION$EXTRAVERSION.tazpkg/d" $PKGS/packages.toremove 1.126 - else 1.127 - # if receipt variable HOST_ARCH absent/empty or contains ARCH 1.128 - if [ -z "$HOST_ARCH" -o "${HOST_ARCH/$ARCH/}" != "$HOST_ARCH" ]; then 1.129 - _ ' - absent: %s (%s)' "$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" "$ARCH" | dblog 1.130 fi 1.131 - fi 1.132 + done 1.133 done 1.134 1.135 # Display list size.