# HG changeset patch # User Christophe Lincoln # Date 1304607919 -7200 # Node ID dcf50aa1bb76f7e31a322fa0a0f1029a8d38f7bb # Parent b6bbe55cd15e666ce82afb6c0898c90472f5a5b4 Cant use tazpkg to pack since it dont handle EXTRAVERSION and improving CGI diff -r b6bbe55cd15e -r dcf50aa1bb76 Makefile --- a/Makefile Thu May 05 05:04:15 2011 +0200 +++ b/Makefile Thu May 05 17:05:19 2011 +0200 @@ -17,8 +17,8 @@ cp -r data/* $(DESTDIR)$(PREFIX)/share/cook uninstall: - rm -f \ + rm -rf \ $(DESTDIR)$(PREFIX)/bin/cook \ $(DESTDIR)$(PREFIX)/bin/cooker \ - $(DESTDIR)/etc/slitaz/cook*.* \ + $(DESTDIR)/etc/slitaz/cook.* \ $(DESTDIR)/var/www/cooker diff -r b6bbe55cd15e -r dcf50aa1bb76 cat.list --- a/cat.list Thu May 05 05:04:15 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ - -Packages categories -================================================================================ -base-system -x-window -utilities -network -graphics -multimedia -office -development -system-tools -security -games -misc -meta -non-free -================================================================================ -14 categories - diff -r b6bbe55cd15e -r dcf50aa1bb76 cook --- a/cook Thu May 05 05:04:15 2011 +0200 +++ b/cook Thu May 05 17:05:19 2011 +0200 @@ -10,8 +10,9 @@ [ -f "/etc/slitaz/cook.conf" ] && . /etc/slitaz/cook.conf [ -f "cook.conf" ] && . ./cook.conf -# Share activity and broken packages with the Cooker. +# Share DB and status with the Cooker. activity="$CACHE/activity" +command="$CACHE/command" broken="$CACHE/broken" # @@ -195,7 +196,7 @@ cd $WOK/$pkg [ -d install ] && prod=$(du -sh install | awk '{print $1}' 2>/dev/null) fs=$(du -sh taz/* | awk '{print $1}') - size=$(du -sh $PKGS/$PACKAGE-${VERSION}${EXTRAVERSION}.* | awk '{print $1}') + size=$(du -sh $PKGS/$PACKAGE-${VERSION}*.tazpkg | awk '{print $1}') files=$(cat taz/$PACKAGE-*/files.list | wc -l) gettext "Summary for:"; echo " $PACKAGE $VERSION" separator @@ -297,7 +298,7 @@ echo -n " $dep" yes | tazpkg remove $dep >/dev/null done - echo "" + echo -e "\n" mv -f $CACHE/installed.diff $CACHE/installed.last.diff fi } @@ -377,14 +378,6 @@ # QA: No compile_rules so no error, valid. mkdir -p $install fi - if grep -q ^genpkg_rules $pkgdir/receipt; then - gettext -e "Executing: genpkg_rules\n" - cd $pkgdir - mkdir -p $fs && genpkg_rules || ( echo -e \ - "\nERROR: genpkg_rules failed\n" | \ - tee -a $LOGS/$pkg.log && exit 1 ) - gettext -e "Now will pack the package.\n" - fi separator && echo "" } @@ -404,11 +397,18 @@ fi } -# Create the package. +# Create the package. Wanted to use Tazpkg to create a tazpkg package at first, +# but it dont handle EXTRAVERSION. packit() { set_paths - echo "Packing: $PACKAGE ${VERSION}${EXTRAVERSION}" + echo "Packing: $PACKAGE $VERSION" separator + if grep -q ^genpkg_rules $pkgdir/receipt; then + gettext -e "Executing: genpkg_rules\n" + cd $pkgdir + mkdir -p $fs && genpkg_rules || ( echo -e \ + "\nERROR: genpkg_rules failed\n" | tee -a $LOGS/$pkg.log && exit 1 ) + fi cd $pkgdir/taz strip_package for file in receipt description.txt @@ -418,9 +418,61 @@ cp -f ../$file $pack && chown 0.0 $pack/$file && status done copy_generic_files - # Use Tazpkg to create a tazpkg package... - tazpkg pack $PACKAGE-${VERSION}${EXTRAVERSION} | grep "\[*\]" - separator && echo "" + + # Create files.list with redirecting find outpout. + gettext "Creating the list of files..." && cd $fs + find . -type f -print > ../files.list + find . -type l -print >> ../files.list + cd .. && sed -i s/'^.'/''/ files.list + status + gettext "Creating md5sum of files..." + while read file; do + [ -L "fs$file" ] && continue + [ -f "fs$file" ] || continue + case "$file" in + /lib/modules/*/modules.*|*.pyc) continue;; + esac + md5sum "fs$file" | sed 's/ fs/ /' + done < files.list > md5sum + status + UNPACKED_SIZE=$(du -chs fs receipt files.list md5sum \ + description.txt 2> /dev/null | awk \ + '{ sz=$1 } END { print sz }') + + # Build cpio archives. + gettext "Compressing the fs... " + find fs | cpio -o -H newc --quiet | lzma e fs.cpio.lzma -si + rm -rf fs + status + PACKED_SIZE=$(du -chs fs.cpio.lzma receipt files.list \ + md5sum description.txt 2> /dev/null | awk \ + '{ sz=$1 } END { print sz }') + gettext "Updating receipt sizes..." + sed -i s/^PACKED_SIZE.*$// receipt + sed -i s/^UNPACKED_SIZE.*$// receipt + sed -i "s/^PACKAGE=/PACKED_SIZE=\"$PACKED_SIZE\"\nUNPACKED_SIZE=\"$UNPACKED_SIZE\"\nPACKAGE=/" receipt + status + + # Set extra version. + if [ "$EXTRAVERSION" ]; then + gettext "Updating receipt EXTRAVERSION: "; echo -n "$EXTRAVERSION" + sed -i s/^EXTRAVERSION.*$// receipt + sed -i "s/^VERSION=/EXTRAVERSION=\"$EXTRAVERSION\"\nVERSION=/" receipt + status + fi + + # Compress. + gettext "Creating full cpio archive... " + find . -print | cpio -o -H newc --quiet > \ + ../$PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg + status + gettext "Restoring original package tree... " + unlzma -c fs.cpio.lzma | cpio -idm --quiet + status + rm fs.cpio.lzma && cd .. + separator && gettext "Package: " + du -sh $PACKAGE-${VERSION}${EXTRAVERSION}.tazpkg + echo "" } # Verify package quality and consitensy. @@ -578,6 +630,7 @@ pkg="$1" [ -z "$pkg" ] && usage check_pkg_in_wok && echo "" + echo "cook:$pkg" > $command unset inst unset_receipt cd $WOK/$pkg && . ./receipt @@ -601,10 +654,11 @@ cookit | tee $LOGS/$pkg.log remove_deps | tee -a $LOGS/$pkg.log cookit_quality + packit | tee -a $LOGS/$pkg.log clean_log packit_quality - + # Time and summary time=$(($(date +%s) - $time)) summary | tee -a $LOGS/$pkg.log diff -r b6bbe55cd15e -r dcf50aa1bb76 cooker --- a/cooker Thu May 05 05:04:15 2011 +0200 +++ b/cooker Thu May 05 17:05:19 2011 +0200 @@ -68,7 +68,7 @@ } # Clean up after cook sucess. -clean_status() { +emty_command() { rm -f $command && touch $command } @@ -174,7 +174,7 @@ if [ -s "$commits" ]; then for pkg in $(cat $commits) do - echo "Cook started for: $pkg" | log + echo "Cook started for: $pkg" | log echo "cook:$pkg" > $command cook $pkg || broken sed -i /^${pkg}$/d $commits @@ -187,7 +187,8 @@ for pkg in $(cat $cooklist) do if [ ! -d "$wok/$pkg/install" ]; then - echo "Cook started for: $pkg" | log + echo "Cook started for: $pkg" | log + cook $pkg || broken sed -i /^${pkg}$/d $cooklist fi @@ -243,13 +244,12 @@ --pkg=*) # Same as 'cook pkg' but with log for web interface. pkg=${1#--pkg=} - echo "cooker:$1" > $command - echo "Cook started for: $pkg" | log - cook $pkg || broken ;; + echo "Cook started for: $pkg" | log + cook $pkg || broken + emty_command ;; --cat=*) # Cook all packages of a category. cat=${1#--cat=} - echo "cooker:$1" > $command rm -f $cooklist && touch $cooklist && cd $wok for pkg in * do @@ -259,7 +259,7 @@ strip_blocked cook_order | tee $LOGS/cookorder.log cook_list - clean_status ;; + emty_command ;; --all) # Try to build all unbuilt packages except blocked's. echo "cooker:--all" > $command @@ -281,7 +281,7 @@ echo "Packages to cook: $(cat $cooklist | wc -l)" | log cook_order | tee $LOGS/cookorder.log cook_list - clean_status ;; + emty_command ;; *) # Default is to cook all commits. [ "$1" ] && usage @@ -312,7 +312,7 @@ else echo "No revision changes: $cur vs $new" | log separator | log_commits - clean_status && echo "" && exit 0 + emty_command && echo "" && exit 0 fi # Get modifications @@ -323,7 +323,7 @@ echo -e "Will cook $msg\n" rm -f $commits.tmp && touch $commits.tmp for rev in $(seq $cur $new); do - log=$(hg log --rev=$rev --template "{files}\n" | cut -d "/" -f 1) + pkg=$(hg log --rev=$rev --template "{files}\n" | cut -d "/" -f 1) for file in $log; do echo "Commited file: $file" log_commits echo $file >> $commits.tmp @@ -338,7 +338,7 @@ strip_blocked cook_order | tee $LOGS/cookorder.log cook_commits - clean_status ;; + emty_command ;; esac exit 0 diff -r b6bbe55cd15e -r dcf50aa1bb76 web/cooker.cgi --- a/web/cooker.cgi Thu May 05 05:04:15 2011 +0200 +++ b/web/cooker.cgi Thu May 05 17:05:19 2011 +0200 @@ -33,7 +33,10 @@ -e 's#ERROR:#ERROR:#g' \ -e s"#^Executing:\([^']*\).#\0#"g \ -e s"#^====\([^']*\).#\0#"g \ - -e s"#http://\([^']*\).*#\1#"g + -e s"#ftp://\([^']*\).*#\0#"g \ + -e s"#http://\([^']*\).*#\0#"g \ + -e s"#^\#\([^']*\)#\0#"g + #-e s"#\"\([^']*\)\"#\0#"g } # Latest build pkgs. @@ -71,39 +74,81 @@ # case "${QUERY_STRING}" in - log=*) - pkg=${QUERY_STRING#log=} - if [ -f "$LOGS/$pkg.log" ]; then - echo "

Log for: $pkg

" + pkg=*) + pkg=${QUERY_STRING#pkg=} + log=$LOGS/$pkg.log + echo "

Package: $pkg

" + + # Package info + if [ -f "$wok/$pkg/receipt" ]; then + . $wok/$pkg/receipt + tazpkg=$PKGS/$pkg-${VERSION}.tazpkg + if [ -f "$tazpkg" ]; then + + cooked=$(stat -c '%y' $tazpkg | cut -d . -f 1 | sed s/:[0-9]*$//) + echo $cooked + fi + echo "receipt" + else + echo "

No package named: $pkg

" + fi + + # Check for a log file and display summary if exist. + if [ -f "$log" ]; then if fgrep -q "Summary " $LOGS/$pkg.log; then - echo '

'
-				grep -A 8 "^Summary " $LOGS/$pkg.log | sed /^$/d | \
-					syntax_highlighter
-				echo '
' - echo '
'
-				cat $LOGS/$pkg.log | syntax_highlighter
-				echo '
' - else if fgrep -q "cook:$pkg$" $command; then echo "
The Cooker is currently cooking: $pkg
" + else + echo "

Cook summary

" + echo '
'
+					grep -A 8 "^Summary " $LOGS/$pkg.log | sed /^$/d | \
+						syntax_highlighter
+					echo '
' fi - echo '
' && cat $LOGS/$pkg.log | syntax_highlighter
-				echo '
' fi + if fgrep -q "ERROR:" $LOGS/$pkg.log; then + fgrep "ERROR:" $LOGS/$pkg.log + fi + echo "

Cook log

" + echo '
'
+			cat $log | syntax_highlighter
+			echo '
' else - echo "
No log file found for: $pkg
" + echo "
No log: $pkg
" + fi ;; + log=*) + log=${QUERY_STRING#log=} + file=$LOGS/$log.log + echo "

Log for: $log

" + if [ -f "$LOGS/$log.log" ]; then + echo '
'
+			cat $file | syntax_highlighter
+			echo '
' + else + echo "
No log for: $log
" + fi ;; + receipt=*) + pkg=${QUERY_STRING#receipt=} + echo "

Receipt: $pkg

" + if [ -f "$wok/$pkg/receipt" ]; then + echo '
'
+			cat $wok/$pkg/receipt | syntax_highlighter
+			echo '
' + else + echo "
No receipt for: $log
" fi ;; *) cat << EOT
- Show log: - + Package: +

Summary

+Running command  : $([ -s "$command" ] && cat $command || echo "Not running")
 Cooked packages  : $(ls $PKGS/*.tazpkg | wc -l)
 Packages in wok  : $(ls $WOK | wc -l)
 Wok revision     : $(cd $WOK && hg head --template '{rev}\n')
@@ -118,7 +163,7 @@
 
 

Activity

-$(tac $CACHE/activity | sed s"#^\([^']* : \)#\0#"g)
+$(tac $CACHE/activity | sed s"#^\([^']* : \)#\0#"g)
 

Commits