# HG changeset patch # User Aleksej Bobylev # Date 1543058882 -7200 # Node ID 77291d41f21a53a721afc77cad5e27a832abe71d # Parent 01e5c3e760d762f913ceabbe6b29e9ecfa590271 Working with "i486", "x86_64" and "any" architecture; post-check with badges; new icons, tag cloud, and other improvements diff -r 01e5c3e760d7 -r 77291d41f21a Makefile --- a/Makefile Sat Aug 25 17:30:05 2018 +0300 +++ b/Makefile Sat Nov 24 13:28:02 2018 +0200 @@ -34,7 +34,10 @@ modules/compressor \ modules/deps \ modules/mk_pkg_receipt \ + modules/pack \ modules/precheck \ + modules/postcheck \ + modules/langdesc \ $(DESTDIR)$(PREFIX)/libexec/cookutils install -m 0644 cook.conf $(DESTDIR)/etc/slitaz install -m 0644 cook.site $(DESTDIR)/etc/slitaz diff -r 01e5c3e760d7 -r 77291d41f21a cook --- a/cook Sat Aug 25 17:30:05 2018 +0300 +++ b/cook Sat Nov 24 13:28:02 2018 +0200 @@ -46,7 +46,6 @@ $(boldify "$(_ 'Options:')") cook --clean -c $(_ 'clean the package in the wok.') - --install -i $(_ 'cook and install the package.') --getsrc -gs $(_ 'get the package source tarball.') --block -b $(_ 'block a package so cook will skip it.') --unblock -ub $(_ 'unblock a blocked package.') @@ -296,7 +295,7 @@ # Display time. -disp_time() { +disp_time_old() { local sec div min sec="$1" div=$(( ($1 + 30) / 60)) @@ -311,13 +310,31 @@ } +# Display time. + +disp_time() { + local sec="$1" day hour min out='' + + day=$(( sec / 86400 )); sec=$(( sec % 86400 )) + hour=$(( sec / 3600 )); sec=$(( sec % 3600 )) + min=$(( sec / 60 )); sec=$(( sec % 60 )) + + [ $day -gt 0 ] && out="${day}d " + [ -n "$out" -o $hour -gt 0 ] && out="$out$(printf '%02dh ' $hour)" + [ -n "$out" -o $min -gt 0 ] && out="$out$(printf '%02dm ' $min)" + [ -n "$out" ] && out=" ~ $out$(printf '%02ds' $sec)" + + echo "${1}s$out" +} + + # Display cooked package summary. summary() { - local arch='' - case "$ARCH" in - arm*|x86_64) arch="-$ARCH" ;; - esac +# local arch='' +# case "$ARCH" in +# arm*|x86_64) arch="-$ARCH" ;; +# esac set_paths cd $WOK/$pkg @@ -325,7 +342,7 @@ [ -d $WOK/$pkg/source ] && srcdir=$(du -sh $WOK/$pkg/source | awk '{print $1}' 2>/dev/null) [ -n "$TARBALL" ] && srcsize=$(du -sh $SRC/$TARBALL | awk '{print $1}') - title 'Summary for: %s' "$PACKAGE $VERSION$EXTRAVERSION$arch" + title 'Summary for: %s' "$PACKAGE $VERSION$EXTRAVERSION" # L10n: keep the same width of translations to get a consistent view [ -n "$TARBALL" ] && _ 'Src file : %s' "$TARBALL" @@ -334,7 +351,7 @@ [ -n "$prod" ] && _ 'Produced : %s' "$prod" _ 'Cook time : %s' "$(disp_time "$time")" _ 'Cook date : %s' "$(date "$(_ '+%%F %%R')")" - _ 'Target arch : %s' "$ARCH" + _ 'Target arch : %s' "$(cut -d$'\t' -f2 $pkgdir/.arch | sort -u | tr '\n' ' ' | sed 's| $||; s| |, |g')" separator - _ ' # : Packed : Compressed : Files : Package name' @@ -343,9 +360,10 @@ for i in $(all_names); do version=$(awk -F$'\t' -vpkg="$i" '{ if ($1 == pkg) {print $2; exit} - }' "$PKGS/packages.info") + }' "$PKGS/packages-$ARCH.info") fs=$(du -sh $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION | awk '{print $1}') - pkgname="$i-$version$arch.tazpkg" + arch=$(awk -F$'\t' -vi="$i" '{if ($1 == i) print $2}' $pkgdir/.arch) + pkgname="$i-$version-$arch.tazpkg" size=$(ls -lh $PKGS/$pkgname | awk '{print $5}') files=$(wc -l < $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION/files.list) printf "%2d : %7s : %10s : %5s : %s\n" "$pkgi" "$fs" "$size" "$files" "$pkgname" @@ -358,7 +376,7 @@ # Display debugging error info. debug_info() { - title 'Debug information' + title 'Debug information %s.' "$1" # L10n: specify your format of date and time (to help: man date) # L10n: not bad one is '+%x %R' _ 'Cook date: %s' "$(date "$(_ '+%%F %%R')")" @@ -489,7 +507,7 @@ newline _n 'Build dependencies to remove:'; echo " $nb" [ -n "$root" ] && echo "root=\"$root\"" - { + _n 'Removing:' for dep in $deps; do echo -n " $dep" @@ -498,7 +516,7 @@ [ -s /aufs-umount.sh ] || echo 'y' | tazpkg remove $dep --root=$root >/dev/null done - } | busybox fold -sw80 + newline; newline # Keep the last diff for debug and info. mv -f $diff $CACHE/installed.diff @@ -510,6 +528,7 @@ patchit() { [ -f "$stuff/patches/series" ] || return + local done="$pkgdir/.patch.done" IFS=$'\n' while read i; do patchname=$(echo ${i%%#*} | cut -d' ' -f1) # allow comments (anything after the # or space) @@ -518,11 +537,12 @@ *) patchopts='-Np1';; esac [ -n "$patchname" ] || continue # allow empty lines - [ -f "$src/done.$patchname" ] && continue # already applied (useful with `cook --continue`) + touch $done + grep -q "^${patchname}$" $done && continue # already applied (useful with `cook --continue`) newline _ 'Applying patch %s' "$patchname" patch $patchopts -i $stuff/patches/$patchname | sed 's|^| |' - touch $src/done.$patchname + echo $patchname >> $done done < $stuff/patches/series newline unset IFS @@ -557,6 +577,7 @@ libtool) if [ -e 'libtool' ]; then sed -i 's| -shared | -Wl,-Os,--as-needed\0|g' libtool + echo "fix.libtool" >> $pkgdir/.patch.done else echo "fix libtool: warning: libtool absent, nothing to fix." fi @@ -753,15 +774,13 @@ # Activate "instant-pack" mode if [ "${COOKOPTS/instant-pack/}" != "$COOKOPTS" ]; then echo " $SPLIT " | fgrep -q " $PACKAGE " || SPLIT="$PACKAGE $SPLIT" + export PACKAGE # determine the list of the packages belongs to the current SET... echo -n $SPLIT \ | awk -vset="$SET" ' BEGIN { RS = " "; FS = ":"; } { if ($2 == set) print $1; }' \ - | while read SET_PKG; do - # ... and then pack them - packit $SET_PKG - done + | xargs -n1 @@PREFIX@@/libexec/cookutils/pack # ... and then pack them fi job_counter=$(($job_counter + 2)) @@ -817,7 +836,10 @@ @@PREFIX@@/libexec/cookutils/precheck $receipt || exit 1 # former receipt_quality() cd $pkgdir - [ -z "$continue" ] && rm -rf source 2>/dev/null + if [ -z "$continue" ]; then + rm -rf source 2>/dev/null + rm .patch.done 2>/dev/null + fi rm -rf install taz 2>/dev/null # Disable -pipe if less than 512 MB free RAM. @@ -863,7 +885,7 @@ # Search for local package or local provided-package name=$(awk -F$'\t' -vpkg="$i" '{ if (index(" " $1 " " $10 " ", " " pkg " ")) {print $1; exit} - }' "$PKGS/packages.info") + }' "$PKGS/packages-$ARCH.info") if [ -z "$name" ]; then # Search for package in mirror name="$(awk -F$'\t' -vi="$i" '$1==i{print $1; exit}' "$root$DB/packages.info")" @@ -1031,265 +1053,14 @@ # ERROR can be echoed any time in cookit() if grep -Ev "(conftest|configtest)" $LOGS/$pkg.log | \ grep -Eq "(^ERROR|undefined reference to)" ; then - debug_info | tee -a $LOGS/$pkg.log + debug_info "cookit_quality" | tee -a $LOGS/$pkg.log put_status $pkg Failed - rm -f $command - broken; exit 1 +# rm -f $command +# broken; exit 1 fi } -# Create the package. Wanted to use TazPkg to create a tazpkg package at first, -# but it doesn't handle EXTRAVERSION. - -packit() { - set_paths "$1" - PACKAGE="${1:-$PACKAGE}" - - # Handle cross compilation - case "$ARCH" in - arm*|x86_64) arch="-$ARCH" ;; - esac - - title 'Pack: %s' "$PACKAGE $VERSION$arch" - - # Get set name for specified package from $SPLIT variable - local set=$(echo -n $SPLIT \ - | awk -vpkg="$PACKAGE" ' - BEGIN { RS = " "; FS = ":"; } - { if ($1 == pkg && $2 != "") { print "-" $2; exit; } }') - # Change set, make filelist and folderlist for new set - export src="$src$set" - export install="$install$set" - export DESTDIR="$install" - - if grep -q ^genpkg_rules $receipt; then - _ 'Executing: %s' 'genpkg_rules' - set -e; cd $pkgdir; mkdir -p $fs - genpkg_rules || (newline; _ 'ERROR: genpkg_rules failed'; newline) >> \ - $LOGS/$pkg.log - else - _ 'No packages rules: meta package' - mkdir -p $fs - fi - - # Check CONFIG_FILES - if [ -n "$CONFIG_FILES" ]; then - unset IFS - for i in $CONFIG_FILES; do - if [ ! -e $fs$i ]; then - case $i in - */) mkdir -p $fs$i ;; - *) mkdir -p $fs$(dirname $i); touch $fs$i ;; - esac - fi - done - fi - - # First QA check to stop now if genpkg_rules failed. - lerror=$(_n 'ERROR') - if fgrep -q ^$lerror $LOGS/$pkg.log; then - broken; exit 1 - fi - - cd $taz - action 'Copying "%s"...' 'receipt' - export PACKAGE VERSION CATEGORY SHORT_DESC WEB_SITE DEPENDS PROVIDE SUGGESTED TAZPANEL_DAEMON TAGS CAT CONFIG_FILES - @@PREFIX@@/libexec/cookutils/mk_pkg_receipt "$(realpath ../receipt)" > $pack/receipt - chown 0.0 $pack/receipt; status - - unset desc - [ "$pkg" == "$PACKAGE" -a -f "../description.txt" ] && desc="../description.txt" - [ -f "../description.$PACKAGE.txt" ] && desc="../description.$PACKAGE.txt" - if [ -n "$desc" ]; then - action 'Copying "%s"...' "$(basename "$desc")" - cp -f $desc $pack/description.txt; chown 0.0 $pack/description.txt; status - fi - - copy_generic_files - - # Strip and stuff files. - export COOKOPTS ARCH HOST_SYSTEM LOCALE fs; @@PREFIX@@/libexec/cookutils/compressor fs - - # Create files.list with redirecting find output. - action '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 - - # Md5sum of files. - action '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 | sort -k2 > md5sum - status - - UNPACKED_SIZE=$(du -chs fs receipt files.list md5sum description.txt \ - 2>/dev/null | awk 'END{ print $1 }') - - # Build cpio archive. - action 'Compressing the FS...' - find fs -newer $receipt -exec touch -hr $receipt '{}' \; -# find fs | cpio -o -H newc --quiet | lzma-alone e fs.cpio.lzma -si - find fs | cpio -o -H newc --quiet | /bin/lzma -qzeT0 >fs.cpio.lzma - mv fs ../ - status - - PACKED_SIZE=$(du -chs fs.cpio.lzma receipt files.list md5sum description.txt \ - 2>/dev/null | awk 'END{ print $1 }') - - action 'Updating receipt sizes...' - sed -i '/^PACKED_SIZE=/d; /^UNPACKED_SIZE=/d' receipt - sed -i "s|^PACKAGE=|PACKED_SIZE=\"$PACKED_SIZE\"\nUNPACKED_SIZE=\"$UNPACKED_SIZE\"\nPACKAGE=|" receipt - status - - # Set extra version. - if [ -n "$EXTRAVERSION" ]; then - action 'Updating receipt EXTRAVERSION: %s' "$EXTRAVERSION" - sed -i '/^EXTRAVERSION=/d' receipt - sed -i "s|^VERSION=|EXTRAVERSION=\"$EXTRAVERSION\"\nVERSION=|" receipt - status - fi - - # Compress. - action 'Creating full cpio archive...' - find . -newer $receipt -exec touch -hr $receipt '{}' \; - find . | cpio -o -H newc --quiet > ../$PACKAGE-$VERSION$EXTRAVERSION$arch.tazpkg - status - - # Restoring original package tree. - mv ../fs . - - rm fs.cpio.lzma; cd .. - - # QA and give info. - tazpkg=$(ls *.tazpkg) - packit_quality - footer "$(_ 'Package "%s" created' "$tazpkg")" -} - - -# Verify package quality and consistency. - -packit_quality() { - local arch='' - case "$ARCH" in - arm*|x86_64) arch="-$ARCH" ;; - esac - - local rsum rsumold='' rsum_changed old_file - local pi="$PKGS/packages.info" fl="$cache/files.list" - local pkg_file="$PKGS/$PACKAGE-$VERSION$EXTRAVERSION$arch.tazpkg" - local rsum_file=$(mktemp) rsum_file_old=$(mktemp) tmpdir=$(mktemp -d) - - - if [ "${COOKOPTS/skip-log-errors/}" == "$COOKOPTS" ]; then - # Exit if any error found in log file. - if fgrep -q ^ERROR $LOGS/$pkg.log; then - rm -f $command - broken; exit 1 - fi - fi - - - [ -n "$CAT" ] && CATEGORY="${CAT%|*}" # allow meta-packages in v2 receipts - - if [ "${COOKOPTS/empty-pkg/}" == "$COOKOPTS" ]; then - action 'QA: checking for empty package...' - if [ ! -s "$pack/files.list" -a "$CATEGORY" != 'meta' ]; then - broken - rm -f $command - false; status - die 'ERROR: empty package' - fi - :; status - fi - - - # Calculate release checksum: usually it does not change on "just recook". - # Release checksum is md5sum of file containing md5sums of: - # a) all files, b) receipt, and c) description.txt. - # Md5sum of the package file will change every time because of embedded timestamps; - # release checksum based only on files content, and will change only when files change. - # (Pitfall: ownership and permissions...) - - # Calculate rsum for new package - cp $pack/md5sum $rsum_file - md5sum $pack/receipt | sed 's| [^ ]*/| |' >> $rsum_file - [ -e "$pack/description.txt" ] && - md5sum $pack/description.txt | sed 's| [^ ]*/| |' >> $rsum_file - rsum=$(md5sum $rsum_file | awk '{print $1}') - - # Calculate rsum for existing previous "old" package - if [ -f "$pkg_file" ]; then - # don't trust database entry, check the package file - cd $tmpdir - cpio -F "$pkg_file" -i md5sum receipt description.txt >/dev/null 2>&1 - cp ./md5sum $rsum_file_old - md5sum ./receipt | sed 's| [^ ]*/| |' >> $rsum_file_old - [ -e "./description.txt" ] && - md5sum ./description.txt | sed 's| [^ ]*/| |' >> $rsum_file_old - rsumold=$(md5sum $rsum_file_old | awk '{print $1}') - cd - >/dev/null - fi - - # Clean - rm $rsum_file $rsum_file_old - rm -r $tmpdir - - - touch $pi $broken - - - # Find and remove old package only if "release checksum" has changed - - if [ "$rsum" != "$rsumold" ]; then - old_file=$(awk -F$'\t' -vname="$PACKAGE" -varch="$arch" '{ - if ($1 == name) printf("%s-%s%s.tazpkg", $1, $2, arch); - }' $pi) # -<-arch>.tazpkg - if [ -f "$PKGS/$old_file" ]; then - action 'Removing old package "%s"' "$old_file" - rm -f "$PKGS/$old_file" - status - fi - # package changed, substitute old package by new one - mv -f $pkgdir/taz/$PACKAGE-$VERSION$EXTRAVERSION$arch.tazpkg $PKGS - _ 'The release checksum has changed.' - else - # package not changed, remove new package - rm -f $pkgdir/taz/$PACKAGE-$VERSION$EXTRAVERSION$arch.tazpkg - _ 'The release checksum has not changed.' - fi - - - sed -i "/^${pkg}$/d" $broken - - - # Update packages database every time after successful build - - # packages.info (unsorted, located near to packages) - unset_receipt; . $pack/receipt - SIZES=$(echo $PACKED_SIZE $UNPACKED_SIZE | sed 's|\.0||g') - DEPENDS=$(echo $DEPENDS) # remove newlines, tabs and multiple spaces from variable - sed -i "/^$PACKAGE\t/d" $pi # remove old entry - cat >> $pi <> $fl -} - - # Return all the names of packages bundled in this receipt all_names() { @@ -1319,13 +1090,15 @@ packall() { set_paths + [ -e $pkgdir/.arch ] && rm $pkgdir/.arch + if head -n1 "$pkgdir/receipt" | fgrep -q 'v2'; then for i in $(all_names); do unset TAGS DEPENDS CAT CONFIG_FILES PROVIDE SUGGESTED DATABASE_FILES TAZPANEL_DAEMON - packit $i + export PACKAGE; @@PREFIX@@/libexec/cookutils/pack $i done else - packit + export PACKAGE; @@PREFIX@@/libexec/cookutils/pack $PACKAGE fi } @@ -1337,50 +1110,31 @@ } -# Update chroot with freshly rebuilt package: keep env up-to-date. - -update_chroot() { - local PACKAGE="$pkg" - for i in $(all_names); do - if [ -d "$root$INSTALLED/$i" ]; then - . /etc/slitaz/cook.conf - . $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION/receipt - _ 'Updating %s chroot environment...' "$ARCH" - _ 'Updating chroot: %s' "$i ($VERSION$EXTRAVERSION$arch)" | log - cd $PKGS - tazpkg -i "$PKGS/$i-$VERSION$EXTRAVERSION$arch.tazpkg" --forced --root=$root - fi - done -} - - -# Install package on --inst or update the chroot. +# Install package: update the chroot with freshly rebuilt package: keep env up-to-date. install_package() { set_paths case "$ARCH" in - arm*) - arch="-$ARCH" - root="$CROSS_TREE/sysroot" - ;; - x86_64) - arch="-$ARCH" - ;; + arm*) root="$CROSS_TREE/sysroot";; esac - # Install package if requested but skip install if target host doesn't - # match build system or it will break the build chroot. - build=$(echo $BUILD_SYSTEM | cut -d- -f1) - if [ -n "$inst" -a "$build" == "$ARCH" ]; then - if [ -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION$arch.tazpkg" ]; then - cd $PKGS - tazpkg -i "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION$arch.tazpkg" --forced - else - broken - die 'Unable to install package, build has failed.' + + # Process all the package names built by this receipt (defined in $SPLIT) + for i in $(PACKAGE="$pkg" all_names); do + if [ -d "$root$INSTALLED/$i" ]; then + pkg_file=$(awk -F$'\t' -vpkg="$i" -varch="$ARCH" '{ + if ($1 == pkg) { + pkgarch = ($11 == "0") ? "any" : arch; + printf("%s-%s-%s.tazpkg", $1, $2, pkgarch); + exit + } + }' $PKGS/packages-$ARCH.info) + if [ -e "$PKGS/$pkg_file" ]; then + _ 'Updating %s chroot environment...' "$ARCH" + _ 'Updating chroot: %s' "${pkg_file%.tazpkg}" | log + tazpkg -i "$PKGS/$pkg_file" --forced --root=$root + fi fi - fi - - update_chroot + done } @@ -1452,14 +1206,26 @@ # Create a XML feed for freshly built packages. gen_rss() { - pubdate=$(date '+%a, %d %b %Y %X') + if [ -e "$WOK/$PACKAGE/.icon.png" ]; then + icon="$COOKER_URL$PACKAGE/browse/.icon.png" + else + icon="http://cook.slitaz.org/tazpkg.png" + fi + cat > $FEEDS/$pkg.xml < $PACKAGE $VERSION$EXTRAVERSION - ${COOKER_URL}?pkg=${PACKAGE//+/%2B} - $PACKAGE-$VERSION$EXTRAVERSION - $pubdate - $(echo -n "$SHORT_DESC" | xml_ent) + $COOKER_URL${PACKAGE//+/%2B} + $PACKAGE-$VERSION$EXTRAVERSION + $(date '+%a, %d %b %Y %X GMT') + + + + $(echo -n "$SHORT_DESC" | xml_ent) + + + ]]> EOT } @@ -1518,212 +1284,6 @@ } -# Function to use in genpkg_rules() to copy specified files from $install to $fs - -cook_copy_files() { - action 'Copying files...' - cd $install - local i j - IFS=$'\n' - for i in $@; do - for j in $(find . -name $i ! -type d); do - mkdir -p $fs$(dirname ${j#.}) - scopy $j $fs$(dirname ${j#.}) - done - done - cd - >/dev/null - status -} - - -# Function to use in genpkg_rules() to copy specified folders from $install to $fs - -cook_copy_folders() { - action 'Copying folders...' - cd $install - local i j - IFS=$'\n' - for i in $@; do - for j in $(find . -name $i -type d); do - mkdir -p $fs$(dirname ${j#.}) - cp -a $j $fs$(dirname ${j#.}) - done - done - cd - >/dev/null - status -} - - -# Remove from current $fs files that are already packed (for receipts v2). -# Note: the order in $SPLIT is very important. -# Note 2: working in the current set. - -remove_already_packed() { - local i j - # $pkg is the name of the main package; $PACKAGE is the name of the current one - # $pkg may (or may not) be included in the $SPLIT - neighbors=$( - echo $pkg $SPLIT" " \ - | awk -F$'\t' -vpkg="$PACKAGE" ' - BEGIN { RS = " "; FS = ":"; } - { set[$1] = $2; } - END { - current_set = set[pkg]; - for (i in set) - { if (i != pkg && set[i] == current_set) print i; } - } - ') - IFS=$'\n' - for neighbor in $neighbors; do - i="$taz/$neighbor-$VERSION$EXTRAVERSION/files.list" - [ -e "$i" ] || continue - while read j; do - [ -f $fs$j -o -h $fs$j ] || continue - rm $fs$j - rmdir --parents --ignore-fail-on-non-empty $fs$(dirname $j) - done < $i - done - unset IFS -} - - -# Function to use in genpkg_rules() to copy hicolor icons in specified sizes -# (default: 16 and 48) from $install to $fs - -cook_copy_icons() { - local sizes=$@ i j ifs="$IFS" - unset IFS - action 'Copying hicolor icons...' - [ -d "$fs/usr/share/icons/hicolor" ] && rm -rf "$fs/usr/share/icons/hicolor" - mkdir -p $fs/usr/share/icons/hicolor - for i in ${sizes:-16 48}; do - j="${i}x$i"; [ "$i" == 'scalable' ] && j="$i" - [ ! -e "$install/usr/share/icons/hicolor/$j" ] || - scopy $install/usr/share/icons/hicolor/$j \ - $fs/usr/share/icons/hicolor - done - status - IFS="$ifs" -} - - -# Common function to copy files, folders and patterns - -copy() { - action 'Copying folders and files...' - local i j k filelist=$(mktemp) folderlist=$(mktemp) - - IFS=$'\n' - cd $install - find ! -type d | sed 's|\.||' > $filelist - find -type d | sed 's|\.||' > $folderlist - - for i in $@; do - case $i in - @std) - # Copy "standard" files (all but "developer files", man pages, documentation, translations) - sed '/\.h$/d; /\.hxx$/d; /\.a$/d; /\.la$/d; /\.pc$/d; /\.pri$/d; /bin\/.*-config$/d; - /\.m4$/d; /\.gir$/d; /\.typelib$/d; /\.vapi$/d; /\.deps$/d; /\.cmake$/d; - /\/Makefile.*/d; /\.inc$/d; /\/include\//d; - /\/share\/man\//d; /\/share\/doc\//d; /\/share\/gtk-doc\//d; /\/share\/info\//d; - /\/share\/devhelp\//d; /\/share\/locale\//d; - /\/share\/bash-completion\//d; /\/etc\/bash_completion\.d\//d; /\/lib\/systemd\//d; - /\/fonts\.scale$/d; /\/fonts\.dir$/d; - /\/share\/appdata\//d; /\/share\/help\//d; /\/share\/metainfo\//d; /\/share\/mimelnk\//d; - /\/share\/icons\/hicolor\/[12356][1245][268]*x[12356][1245][268]*\//d; # 22, 24, 32, 64, 128, 256, 512 - /\.so\.dbg$/d; - ' $filelist - ;; - @dev) - # Copy "developer files" - sed -n '/\.h$/p; /\.hxx$/p; /\.a$/p; /\.pc$/p; /\.pri$/p; /bin\/.*-config$/p; - /\.m4$/p; /\.gir$/p; /\.typelib$/p; /\.vapi$/p; /\.deps$/p; /\.cmake$/p; - /\/Makefile.*/p; /\.inc$/p; /\/include\//p; - /\.so\.dbg$/p; - ' $filelist - ;; - @ruby) - # Copy mandatory Ruby files - gem_base="\/usr\/lib\/ruby\/gems\/.*\/${PACKAGE#*-}-$VERSION" - sed -n '/\/extensions\/.*\.so$/p; /'$gem_base'\/lib\//p; /\.gemspec$/p; - /\/usr\/bin\//p; /\/gems\/.*\/bin\//p; - ' $filelist | sed '/\/gems\/.*\/lib\/.*\.so$/d; /\/gems\/.*\/lib\/.*\.h$/d; - /\/gems\/.*\/gems\/.*\.gemspec$/d;' - ;; - @ruby-dev) - sed -n '/\/ext\/.*\.h$/p; /\/ext\/.*\.pc$/p; /\/gem.build_complete$/p; - /\/gems\/.*\/lib\/.*\.h$/p; - ' $filelist - ;; - @rm) - # Quick alias - remove_already_packed - ;; - @ico) - # Quick alias - cook_copy_icons >/dev/null - ;; - */) - # Copy specified folders. - i="${i%/}" - find -type d -path "*/${i#/}" | sed 's|^.||' - ;; - *) - # Copy specified files. - find ! -type d -path "*/${i#/}" | sed 's|^.||' - ;; - esac \ - | sort -u \ - | while read j; do - mkdir -p $fs$(dirname "$j") - if [ -d "$install$j" ]; then - cp -a "$install$j" $fs$(dirname "$j") - else - scopy "$install$j" $fs$(dirname "$j") - fi - done - # Copy empty directories - case $i in - @std) - while read j; do - case $j in - # skip empty man & doc folders - */man/*|*/doc/*) continue;; - esac - [ -z "$(ls -A "$install$j")" ] || continue - # directory $j is empty - k="$j" - # make 'ladder' from directories, from root dir to $j - # /a /a/b /a/b/c etc. - while :; do - [ -z "$k" ] && break - echo "$k" - k="${k%/*}" - done \ - | tac \ - | while read k; do - # make dir if it does not exist - if [ ! -d "$fs$k" ]; then - # It's like "copy the directory without its underlying content". - # keep original ownership/permissions, access: - keepIFS="$IFS"; unset IFS - install -d $(stat -c'-o%u -g%g -m%a' "$install$k") "$fs$k" - # keep last-modified date: - touch -r "$install$k" "$fs$k" - IFS="$keepIFS"; unset keepIFS - fi - done - done < $folderlist - ;; - esac - done - cd - >/dev/null - unset IFS - rm $filelist $folderlist - status -} - - # Update split.db once for receipt update_split_db() { @@ -2194,6 +1754,9 @@ exit 0 fi + # Remove package from broken list before cooking + sed -i "/^${pkg}$/d" $broken + # Skip blocked, 3 lines also for the Cooker. grep -q "^$pkg$" $blocked && [ "$2" != '--unblock' ] && die 'Package "%s" is blocked' "$pkg" @@ -2201,7 +1764,6 @@ try_aufs_chroot "$@" # Log and source receipt. - _ 'Cook started for: %s' "$pkg" | log echo "cook:$pkg" > $command [ -n "$lastcooktime" ] && echo "cook:$pkg $lastcooktime $(date +%s)" >> $cooktime @@ -2220,18 +1782,17 @@ # Handle --options case "$2" in - --install|-i) - inst='yes' ;; - --pack) + _ 'Packing %s' "$pkg" | log [ -d "$WOK/$pkg/install" ] || die 'Need to build "%s"' "$pkg" [ ! -d "$WOK/$pkg/taz" ] || rm -rf "$WOK/$pkg/taz" [ ! -f "$LOGS/$pkg-pack.log" ] || rm -f $LOGS/$pkg-pack.log - sed -i '$ s|$| (packing)|' $activity packall 2>&1 | tee -a $LOGS/$pkg-pack.log + @@PREFIX@@/libexec/cookutils/postcheck $pkg | tee -a $LOGS/$pkg.log clean_log "$pkg-pack" time=$(($(date +%s) - $time)) summary | sed 's|^Cook |Pack |' | tee -a $LOGS/$pkg-pack.log + gen_rss put_status $pkg Done rm -f $command exit 0 ;; @@ -2240,6 +1801,8 @@ trials='yes' ;; esac + _ 'Making %s' "$pkg" | log + # Rotate log for i in $(seq 9 -1 1); do j=$(($i - 1)) @@ -2265,21 +1828,27 @@ done # Cook and pack or exit on error and log everything. - ((((cookit $@ 2>&1; echo $? >&3) | loglimit 50 > $LOGS/$pkg.log) 3>&1) | (read rq; exit $rq)) + ( ( ( (cookit $@ 2>&1; echo $? >&3) | loglimit 50 > $LOGS/$pkg.log) 3>&1) | (read rq; exit $rq) ) rq=$? # the return code of `cookit $@` above command + if [ $rq -eq 1 ]; then + broken + fi + # Remove build dependencies both when `cookit` done or fail remove_deps | tee -a $LOGS/$pkg.log timestamp job27 # removing bdeps - cookit_quality +# cookit_quality timestamp job28 # checking quality # Log and stop if `cookit` fails if [ $rq -eq 1 ]; then - debug_info | tee -a $LOGS/$pkg.log + debug_info "ret1" | tee -a $LOGS/$pkg.log + @@PREFIX@@/libexec/cookutils/postcheck $pkg | tee -a $LOGS/$pkg.log put_status $pkg Failed rm -f $command - broken; exit 1 + broken + exit 1 fi # Proceed only if `cookit` return code is zero-OK @@ -2288,13 +1857,15 @@ packall 2>&1 | loglimit 5 >> $LOGS/$pkg.log timestamp job29 # packing + @@PREFIX@@/libexec/cookutils/postcheck $pkg | tee -a $LOGS/$pkg.log + clean_log # Exit if any error in packing. if [ "${COOKOPTS/skip-log-errors/}" == "$COOKOPTS" ] && grep -Ev "(/root/.cvspass|conftest|df: /|rm: can't remove)" $LOGS/$pkg.log | \ grep -Eq "(^ERROR|: No such file or directory|not remade because of errors|ake: \*\*\* .* Error)"; then - debug_info | tee -a $LOGS/$pkg.log + debug_info "packerr" | tee -a $LOGS/$pkg.log put_status $pkg Failed rm -f $command broken; exit 1 diff -r 01e5c3e760d7 -r 77291d41f21a cook.conf --- a/cook.conf Sat Aug 25 17:30:05 2018 +0300 +++ b/cook.conf Sat Nov 24 13:28:02 2018 +0200 @@ -120,7 +120,7 @@ CONFIGURE_ARGS="--build=$BUILD_SYSTEM --host=$HOST_SYSTEM" # Mirrors URLs. To download sources near your location. -GNU_MIRROR="http://mirror.switch.ch/ftp/mirror/gnu" +GNU_MIRROR="https://ftp.igh.cnrs.fr/pub/gnu" # see https://www.gnu.org/prep/ftp.html SF_MIRROR="https://downloads.sourceforge.net" XORG_MIRROR="https://www.x.org/archive/individual" GNOME_MIRROR="http://ftp.gnome.org/pub/GNOME/sources" diff -r 01e5c3e760d7 -r 77291d41f21a cooker --- a/cooker Sat Aug 25 17:30:05 2018 +0300 +++ b/cooker Sat Nov 24 13:28:02 2018 +0200 @@ -554,7 +554,7 @@ done strip_blocked cook_order | tee $LOGS/cookorder.log - echo "Packages to cook: $(wc -l < $cooklist)" | log + echo "Receipts or stuff changed: $(wc -l < $cooklist)" | log cook_list ;; tasks|-T) @@ -716,9 +716,12 @@ echo "Packages to cook : $pkgs" | log_commits separator | log_commits newline - strip_blocked - cook_order | tee $LOGS/cookorder.log - cook_commits + # Just update the wok on --update, don't cook any package + if [ -z "$update" ]; then + strip_blocked + cook_order | tee $LOGS/cookorder.log + cook_commits + fi clean_exit ;; esac diff -r 01e5c3e760d7 -r 77291d41f21a lighttpd/cooker-terminal.css --- a/lighttpd/cooker-terminal.css Sat Aug 25 17:30:05 2018 +0300 +++ b/lighttpd/cooker-terminal.css Sat Nov 24 13:28:02 2018 +0200 @@ -229,6 +229,8 @@ display: block; } +img {display: none;} + /* FOLLOWING CSS HAS SOME CHANGES FOR SLITAZ COOKER! */ diff -r 01e5c3e760d7 -r 77291d41f21a lighttpd/cooker.css --- a/lighttpd/cooker.css Sat Aug 25 17:30:05 2018 +0300 +++ b/lighttpd/cooker.css Sat Nov 24 13:28:02 2018 +0200 @@ -200,6 +200,9 @@ #hdr h2 { font: bold 1.3rem/1.6rem sans-serif; } +/* #hdr:hover img { + filter: drop-shadow(0 0 1px rgba(0,0,0,0.5)); +} */ #info { clear: both; } @@ -333,7 +336,8 @@ .button.download { background-color: gold; } .button.source { background-color: yellow; } .button.browse { background-color: tan; } -.button.doc { background-color: plum; } +.button.doc, +.button.lfs { background-color: plum; } .button.log { background-color: lightgray; } .icon::before { @@ -343,38 +347,123 @@ padding-right: 2px; opacity: 0.6; } -.icon.receipt::before { content: url("data:image/svg+xml,"); } -.icon.website::before { content: url("data:image/svg+xml,"); } -.icon.files::before { content: url("data:image/svg+xml,"); } -.icon.desc::before { content: url("data:image/svg+xml,"); } -.icon.download::before, .icon.source::before { content: url("data:image/svg+xml,"); } -.icon.browse::before { content: url("data:image/svg+xml,"); } -.icon.doc::before { content: url("data:image/svg+xml,"); } -.icon.log::before { content: url("data:image/svg+xml,"); } +.icon.receipt::before { content: url("data:image/svg+xml,"); } +.icon.website::before { content: url("data:image/svg+xml,"); } +.icon.files::before { content: url("data:image/svg+xml,"); } +.icon.desc::before { content: url("data:image/svg+xml,"); } +.icon.download::before, .icon.source::before { content: url("data:image/svg+xml,"); } +.icon.browse::before { content: url("data:image/svg+xml,"); } +.icon.lfs::before { content: url("data:image/svg+xml,"); } +.icon.doc::before { content: url("data:image/svg+xml,"); } +.icon.log::before { content: url("data:image/svg+xml,"); } .icon.more::before { content: url("data:image/svg+xml,"); } .icon.bell::before { content: url("data:image/svg+xml,"); } -.icon.maintainers::before { content: url("data:image/svg+xml,"); } +.icon.maintainers::before { content: url("data:image/svg+xml,"); } .icon.actual::before { content: url("data:image/svg+xml,"); } .icon.update::before { content: url("data:image/svg+xml,"); } .icon.next::before { content: url("data:image/svg+xml,"); } .icon.prev::before { content: url("data:image/svg+xml,"); } .icon.up::before { content: url("data:image/svg+xml,"); } +.icon.tag::before { content: url("data:image/svg+xml,"); } +.icon.bug::before { content: url("data:image/svg+xml,"); } -.bigicon-i { - background: url("data:image/svg+xml,") no-repeat 0.5rem 50%; +.icon.tarball::before { content: url("data:image/svg+xml,");} +.icon.pkg64::before { content: url("data:image/svg+xml,");} +.icon.pkg32::before { content: url("data:image/svg+xml,");} +.icon.pkgany::before { content: url("data:image/svg+xml,");} + +.bigicon-i::before { + content: url("data:image/svg+xml,"); } -.bigicon-w { - background: url("data:image/svg+xml,") no-repeat 0.5rem 50%; +.bigicon-w::before { + content: url("data:image/svg+xml,"); } -.bigicon-e { - background: url("data:image/svg+xml,") no-repeat 0.5rem 50%; +.bigicon-e::before { + content: url("data:image/svg+xml,"); } [class*="bigicon-"] { margin: 0.5rem 0; - padding: 1rem 0.8rem 1rem 3rem; + padding: 0.8rem; background-color: hsla(0,0%,100%,0.8); box-shadow: 0 0 3px rgba(0,0,0,0.4); } +[class*="bigicon-"]::before { + display: inline-block; + height: 32px; + width: 32px; + padding: 0 0.8rem 0 0; + vertical-align: middle; +} +.badge.bdbroken::before { + content: url("data:image/svg+xml,"); +} +.badge.broken::before { + content: url("data:image/svg+xml,"); +} +.badge.any::before { + content: url("data:image/svg+xml,"); +} +.badge.noany::before { + content: url("data:image/svg+xml,"); +} +.badge.libtool::before { + content: url("data:image/svg+xml,"); +} +.badge.nolibtool::before { + content: url("data:image/svg+xml,"); +} +.badge.own::before { + content: url("data:image/svg+xml,"); +} +.badge.ownover::before { + content: url("data:image/svg+xml,"); +} +.badge.perm::before { + content: url("data:image/svg+xml,"); +} +.badge.permover::before { + content: url("data:image/svg+xml,"); +} +.badge.symlink::before { + content: url("data:image/svg+xml,"); +} +.badge.ss::before { + content: url("data:image/svg+xml,"); +} +.badge.fadd::before { + content: url("data:image/svg+xml,"); +} +.badge.frem::before { + content: url("data:image/svg+xml,"); +} +.badge.fdup::before { + content: url("data:image/svg+xml,"); +} +.badge.old::before { + content: url("data:image/svg+xml,"); +} +.badge.win::before { + content: url("data:image/svg+xml,"); +} +.badge.orphan::before { + content: url("data:image/svg+xml,"); +} +.badge.patch::before { + content: url("data:image/svg+xml,"); +} +.badges td:nth-child(1) { + vertical-align: middle; + text-align: center; + white-space: nowrap; + width: 2rem!important; +} +var { + color: #600; + font-style: normal; + font-family: monospace; +} + + a:target { background-color: yellow; } @@ -383,6 +472,7 @@ /* Table */ table { width: 100%; box-sizing: border-box; border-collapse: collapse; /*box-shadow: 0 0 4px rgba(0,0,0,0.3);*/ } +section.markdown table { width: unset; } th { /*color: rgba(0,0,0,0.6);*/ background-color: rgba(0,0,0,0.1); padding: 3px; font-weight: normal; } td { padding: 2px; vertical-align: top; } table:not(.half):not(.pkgslist) td:first-child { white-space: nowrap; width: 5rem; } @@ -413,6 +503,16 @@ .texinfo pre { display: none; } .texinfo pre:target { display: block; } +.buttonbar { + background-color: rgba(0,0,0,0.05); + padding: 2px 4px; + margin: -8px; + border-radius: 4px; + text-align: center; + display: flex; + justify-content: space-between; +} +.texinfo b { color: brown; } section, div.list { margin: 0.6rem 0; @@ -469,6 +569,19 @@ text-align: center; } +.meter-small { + height: 2rem; + width: 10rem; + vertical-align: middle; +} +.meter-small::after { + content: attr(value)'%'; + display: inline-block; + width: inherit; + text-align: center; + position: relative; + top: -1.6rem; +} @@ -502,7 +615,33 @@ .r.c10 del { color: gray; } -:not(pre) > code {background-color:rgba(0,0,0,.1); padding: 1px; border-radius:3px; border: 1px solid rgba(0,0,0,.15);} +:not(pre) > code { + background-color:rgba(0,0,0,.1); + padding: 1px; + border-radius:3px; + border: 1px solid rgba(0,0,0,.15); +} +kbd { + display: inline-block; + padding: 0 4px; + font: monospaced; + vertical-align: middle; + background: #eee; + color: #111; + border: solid 1px rgba(0,0,0,.3); + border-radius: 3px; + box-shadow: 0 1px 0 #ddd, 0 0 0 1px #fff inset; +} + +/* Tag cloud */ +.tags { font: 16px/20px sans-serif; text-align: center; } +.tags sup { font-size: 10px; } +.tag0 { font-size: 13px; color: #603cba; } +.tag1 { font-size: 15px; color: #2b5797; } +.tag2 { font-size: 18px; color: #00a300; } +.tag3 { font-size: 21px; color: #e3a21a; } +.tag4 { font-size: 25px; color: #b91d47; } +.tag5 { font-size: 31px; color: #ee1111; } /* FOLLOWING CSS HAS SOME CHANGES FOR SLITAZ COOKER! */ diff -r 01e5c3e760d7 -r 77291d41f21a lighttpd/cooker.js --- a/lighttpd/cooker.js Sat Aug 25 17:30:05 2018 +0300 +++ b/lighttpd/cooker.js Sat Nov 24 13:28:02 2018 +0200 @@ -4,33 +4,38 @@ // +// Updating the progress bar + +function updating(pkg) { + var upct = new XMLHttpRequest(); + upct.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + response = this.responseText.trim(); + if (response == 'reload') { + // Package in question not cooked now (finished) -> + // Server sends 'reload' response -> + // Stop updating and reload the page + clearInterval(upID); + location.reload(); + } else { + // Update text and gauge value + var pct = document.getElementById('pct'); + if (pct !== null) pct.innerHTML = response + '%'; + var gauge = document.getElementById('gauge'); + if (gauge !== null) gauge.value = response; + } + } + }; + upct.open('GET', '?pct=' + pkg, true); + upct.responseType = 'text'; + upct.send(); +} + + // Start updating percents of package completion function startUpdating(pkg) { - upID = setInterval(function() { - var upct = new XMLHttpRequest(); - upct.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { - response = this.responseText.trim(); - if (response == 'reload') { - // Package in question not cooked now (finished) -> - // Server sends 'reload' response -> - // Stop updating and reload the page - clearInterval(upID); - location.reload(); - } else { - // Update text and gauge value - var pct = document.getElementById('pct'); - if (pct !== null) pct.innerHTML = response + '%'; - var gauge = document.getElementById('gauge'); - if (gauge !== null) gauge.value = response; - } - } - }; - upct.open('GET', '?pct=' + pkg, true); - upct.responseType = 'text'; - upct.send(); - }, 10000); + upID = setInterval(function(){updating(pkg)}, 10000); } @@ -47,8 +52,10 @@ // Decide whether we need to update percentages -if (typeof updatePkg !== 'undefined') +if (typeof updatePkg !== 'undefined') { + updating(updatePkg); startUpdating(updatePkg); +} // Calculate and show server date diff -r 01e5c3e760d7 -r 77291d41f21a lighttpd/index.cgi --- a/lighttpd/index.cgi Sat Aug 25 17:30:05 2018 +0300 +++ b/lighttpd/index.cgi Sat Nov 24 13:28:02 2018 +0200 @@ -95,7 +95,8 @@ if [ -n "$pkg" ]; then case "$pkg" in - ~) pretitle="Tag \"$cmd\" - ";; + ~) if [ -z "$cmd" ]; then pretitle="Tag cloud - "; else pretitle="Tag \"$cmd\" - "; fi;; + %) if [ -z "$cmd" ]; then pretitle="Badges - "; else pretitle="Badge \"$cmd\" - "; fi;; *) pretitle="$pkg - ";; esac else @@ -180,21 +181,21 @@ date_now=$(date +%s) sec_now=$(date +%S); sec_now=${sec_now#0} # remove one leading zero wait_sec=$(( 60 - $sec_now )) - cat < + cat <<-EOT + - - - - - - -EOT + + + + + + + EOT } @@ -258,7 +259,7 @@ # Problems: # 1. Function "latest packaged version" widely used here and it has no JSON API, but only SVG badge. # 2. So, all version comparisons can be only visual and not automated. -# 3. Of the thousands of badges present on the web page, many of them are broken (maybe server +# 3. If the thousands of badges present on the web page, many of them are broken (maybe server # drops requests), while our server displays status icons well. # 4. Default badges are wide and not customizable. # Solution: @@ -347,7 +348,7 @@ # argument is in $cmd variable echo -en "Content-Type: image/svg+xml\n\n" else echo "m0 3v8l1 1h6l1-1v-8l-1-1h-6zm3 0h2v5h-2zm0 6h2v2h-2z' fill='#d00'/>" @@ -365,19 +366,17 @@ theme) current=$(COOKIE theme) page_header - cat < -

Change theme

-

Current theme: “${current:-default}”. Select other:

-
    - $( - for i in default emerald sky goldenrod midnight like2016 terminal; do - [ "$i" == "${current:-default}" ] || echo "
  • $i
  • " - done - ) -
- -EOT + cat <<-EOT +
+

Change theme

+

Current theme: “${current:-default}”. Select other:

+
    $( + for i in default emerald sky goldenrod midnight like2016 terminal; do + [ "$i" == "${current:-default}" ] || echo "
  • $i
  • " + done + )
+
+ EOT page_footer exit 0 ;; @@ -426,26 +425,27 @@ limit=$(GET limit); limit="${limit:-12}"; [ "$limit" -gt 100 ] && limit='100' pubdate=$(date -Rur$(ls -t $FEEDS/*.xml | head -n1) | sed 's|UTC|GMT|') cooker_url="http://$HTTP_HOST$base/" - cat < - - - $title - The SliTaz packages cooker feed - $cooker_url - $pubdate - $pubdate - -EOT + + + + $title + The SliTaz packages cooker feed + $cooker_url + $pubdate + $pubdate + + EOT for rss in $(ls -t $FEEDS/*.xml | head -n$limit); do - sed "s|http[^=]*=|$cooker_url|; s||\1 GMT|" $rss done - cat < - -EOT + cat <<-EOT + + + EOT exit 0 fi @@ -455,22 +455,22 @@ # Query '/os.xml': get OpenSearch Description if [ "$pkg" == 'os.xml' ]; then - cat < - - $title - SliTaz packages search - http://$HTTP_HOST/images/logo.png - - - - - http://$HTTP_HOST$base/ - UTF-8 - -EOT + + + $title + SliTaz packages search + http://$HTTP_HOST/images/logo.png + + + + + http://$HTTP_HOST$base/ + UTF-8 + + EOT exit 0 fi @@ -512,7 +512,9 @@ info2html() { sed \ - -e 's|&|\&|g; s|<|\<|g; s|>|\>|g' \ + -e 's|&|\&|g; s|<|\<|g; s|>|\>|g;' \ + -e "s|\`\([^']*\)'|\1|g" \ + -e 's|"\([A-Za-z0-9]\)|“\1|g; s|"|”|g' \ -e 's|^\* \(.*\)::|* \1 |' \ -e 's|\*note \(.*\)::|\1|' \ -e '/^File: / s|(dir)|Top|g' \ @@ -520,7 +522,8 @@ -e '/^File: / s|Prev: \([^,]*\)||' \ -e '/^File: / s|Up: \([^,]*\)|Up: \1|' \ -e '/^File: / s|^.* Node: \([^,]*\), *\(.*\)$|
\2|' \
-		-e '/^
]*>\)\(]*>Next: [^,]*\), *\(]*>Prev: [^,]*\), *\(]*>Up: .*\)|\1 \3 \4 \2|' \
+		-e '/^
]*>\)\(]*>Next: [^,]*\), *\(]*>Prev: [^,]*\), *\(]*>Up: .*\)|\1
\3 \4 \2
|' \ + -e '/^
]*>\)*\(]*>Prev: [^,]*\), *\(]*>Up: .*\)|\1
\2 \3
|' \ -e '/^Tag Table:$/,/^End Tag Table$/d' \ -e '/INFO-DIR/,/^END-INFO-DIR/d' \ -e "s|https*://[^>),'\"\`’ ]*|&|g" \ @@ -631,12 +634,18 @@ s|\[39m||; #s|\[1m||g; s|\[1m||g; s|(B||g; - s|\[m||g; - " \ + s|\[m||g;" \ + \ -e "s!^|\(+.*\)!|\1!; s!^|\(-.*\)!|\1!; - s!^|\(@@.*@@\)\$!|\1!;" + s!^|\(@@.*@@\)\$!|\1!;" \ \ + -e "s|^Successfully installed [^ ][^ ]*$|\0|; + s|^Successfully installed .*$|\0|; + s|^\(Requirement already satisfied: .*\) in|\1 in|; + s|^Collecting .* (from .*$|\0|; + s|^ Could not find.*|\0|; + s|^No matching distribution found for.*|\0|;" ;; @@ -697,7 +706,9 @@ if [ -f "$log" ]; then if grep -q "cook:$pkg$" $command; then - show_note i "The Cooker is currently building $pkg" + show_note i "The Cooker is currently building $pkg" \ + | sed 's|>|& |' + echo "" elif fgrep -q "Summary for:" $log; then sed '/^Summary for:/,$!d' $log | awk ' BEGIN { print "
" } @@ -728,7 +739,8 @@ END { print "
" } ' elif fgrep -q "Debug information" $log; then - echo -e '
\n

Debug information

' + # second line of log is "Cook: " + echo -e "
\n

Debug information for $(sed '2!d; s|.*: ||' $log)

" sed -e '/^Debug information/,$!d; /^===/d; /^$/d' $log | sed -n '1!p' | \ if [ -n "$2" ]; then syntax_highlighter log | sed 's|\([^0-9 ]\)\([0-9][0-9]*\):|\1\2:|' @@ -754,9 +766,9 @@ echo -n "
" if [ -e $wok/$pkg/.icon.png ]; then - echo -n "" + echo -n "\"$pkg" else - echo -n "" + echo -n "\"package" fi echo -n "" echo -n "

${requested_pkg:-$pkg}" @@ -792,7 +804,7 @@ echo "description" [ -n "$TARBALL" -a -s "$SRC/$TARBALL" -o -d "$wok/$pkg/taz" ] && - echo "download" + echo "downloads" echo "browse" @@ -806,7 +818,7 @@ echo "info" if [ -n "$LFS" ]; then - printf "" "$LFS" + printf "" "$LFS" [ "${LFS/blfs/}" != "$LFS" ] && printf "B" printf "LFS\n" fi @@ -917,10 +929,145 @@ sed "/^$i\t/!d" $CACHE/split.db done < $broken | cut -d$'\t' -f2 | tr ' ' '\n' | wc -l) - cat > $webstat < $webstat <<-EOT + rtotal="$rtotal"; rcooked="$rcooked"; runbuilt="$runbuilt"; rblocked="$rblocked"; rbroken="$rbroken" + ptotal="$ptotal"; pcooked="$pcooked"; punbuilt="$punbuilt"; pblocked="$pblocked"; pbroken="$pbroken" + EOT +} + + +# Show badges for specified package + +show_badges() { + local t p s # title problem solution + + case $layout in + table) + echo "

Badges

" + ;; + list) + echo "

Badges list

Click on badge to get list of packages

ProblemSolution
" + ;; + esac + + for badge in $@; do + case $badge in + bdbroken) + t="Broken bdeps" + p="This package cannot be built because its creation depends on broken packages" + s="Fix broken build dependencies" + ;; + broken) + t="Broken package" + p="Package is broken" + s="Fix package build: analyze logs, upgrade the version, search for patches" + ;; + any) + t="“Any” arch" + p="This package contains only architecture-less files, it does not make sense to make it several times in each build environment" + s="Add the line HOST_ARCH=\"any\" to receipt" + ;; + noany) + t="No “any” arch" + p="This package contains architecture dependent files" + s="Remove the line HOST_ARCH=\"any\" from receipt" + ;; + libtool) + t="Libtool isn't fixed" + p="This package use libtool that likes to add unnecessary dependencies to programs and libraries" + s="Add the fix libtool command to the receipt between the configure and make commands invocation" + ;; + nolibtool) + t="Libtool is absent" + p="This package does not use libtool, nothing to fix" + s="Remove the command fix libtool from receipt" + ;; + own) + t="Ownership problems" + p="Some files of this package have ownership problems" + s="Correct the ownership or add problem files to the “overrides” list if you believe it is OK" + ;; + ownover) + t="Ownership overridden" + p="This package contains files with ownership problems that have been overridden" + s="FYI only, you may want to revise the list" + ;; + perm) + t="Permissions problems" + p="Some files of this package have unusual permissions" + s="Correct the permissions or add problem files to the “overrides” list if you believe it is OK" + ;; + permover) + t="Permissions overridden" + p="This package contains files with unusual permissions that have been recorded" + s="FYI only, you may want to revise the list" + ;; + symlink) + t="Broken symlink" + p="This package contains one or more broken symlinks" + s="Fix the symlinks destination; you may use fix symlinks when symlinks have absolute path" + ;; + ss) + t="Site script" + p="This autotools-based building system use site script; most of paths (like prefix, sysconfdir and mandir) are defined there with correct default values" + s="You may remove your paths from configure invocation" + ;; + fadd) + t="Files have been added" + p="Some files absent in \$install was directly added to \$fs" + s="Rework your compile_rules() to add all the required files to \$install there" + ;; + frem) + t="Files have been removed" + p="Some files existing in \$installnot belong to any package" + s="Revise genpkg_rules() or add files to “overrides” list" + ;; + fdup) + t="Files are duplicated" + p="Some files existing in \$install was added to more than one package" + s="Check your copy rules in genpkg_rules()" + ;; + old) + t="Oldie" + p="According to Repology, this package may be outdated" + s="Update the package" + ;; + win) + t="Winner" + p="This package has no problems" + s="Well done, keep it up!" + ;; + orphan) + t="Orphaned package" + p="It seems that no other package depends on this one" + s="See if anyone needs it" + ;; + patch) + t="Patch" + p="Patch has been applied" + s="FYI only, you may want to revise the list of patches" + ;; + esac + case $layout in + table) + echo "" + ;; + list) + p=$(echo $p | sed 's|]*>\([^<]*\)|\1|g') + s=$(echo $s | sed 's|]*>\([^<]*\)|\1|g|') + echo "" + ;; + *) + echo -n "" + ;; + esac + done + + case $layout in + table|list) + echo "
Problem
$p$s
$p
" + ;; + esac } @@ -959,16 +1106,40 @@ pct=0; [ "$rtotal" -gt 0 ] && pct=$(( ($rcooked * 100) / $rtotal )) - cat <${pct}%${pct}%

+ cat <<-EOT +
${pct}%${pct}%
- - - - - -
Total Cooked Unbuilt Blocked Broken
Receipts$rtotal$rcooked$runbuilt$rblocked$rbroken
Packages$ptotal$pcooked$punbuilt$pblocked$pbroken
-EOT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Total Cooked Unbuilt Blocked Broken
Receipts$rtotal$rcooked$runbuilt$rblocked$rbroken
Packages$ptotal$pcooked$punbuilt$pblocked$pbroken
+ EOT if [ -z "$nojs" ]; then echo ""; fi ;; activity) @@ -977,8 +1148,18 @@ s|\[ Failed|Failed|; s|\[ -Failed|Failed|; s| \]||; - s|%2B|\+|g' | \ - section $activity 12 "Activity|More activity" + s|%2B|\+|g' \ + | while read line; do + case "$line" in + *data-badges=*) + badges="$(echo "$line" | sed "s|.*data-badges='\([^']*\)'.*|\1|")" + echo "$line" | sed "s|| $(show_badges "$badges")|" + ;; + *) + echo "$line" + ;; + esac + done | section $activity 12 "Activity|More activity" \ ;; cooknotes) [ -s "$cooknotes" ] && tac $cooknotes | head -n12 | \ @@ -1070,11 +1251,26 @@ esac echo '
' echo "

DB: $list $nb

" + tac $CACHE/$list | sed 's|cooker.cgi?pkg=||; s|%2B|+|g; s|\[ Done|Done|; s|\[ Failed|Failed|; s|\[ -Failed|Failed|; - s| \]||' | mktable $list + s| \]||; + s|%2B|\+|g' \ + | while read line; do + case "$line" in + *data-badges=*) + badges="$(echo "$line" | sed "s|.*data-badges='\([^']*\)'.*|\1|")" + echo "$line" | sed "s|| $(show_badges "$badges")|" + ;; + *) + echo "$line" + ;; + esac + done \ + | mktable $list + echo '
' done @@ -1118,64 +1314,84 @@ fi ;; toolchain) - cat < -
-

SliTaz GNU/Linux toolchain

+ cat <<-EOT +
+
+

SliTaz GNU/Linux toolchain

- - - - - - - -$(toolchain_version slitaz-toolchain) -$(toolchain_version binutils) -$(toolchain_version linux-api-headers) -$(toolchain_version gcc) -$(toolchain_version glibc) -
Build date $(sed -n '/^Cook date/s|[^:]*: \(.*\)|\1|p' $LOGS/slitaz-toolchain.log)
Build duration $(sed -n '/^Cook time/s|[^:]*: \(.*\)|\1|p' $LOGS/slitaz-toolchain.log)
Architecture $ARCH
Host system $BUILD_SYSTEM
Target system $HOST_SYSTEM
PackageVersionDescription
+ + + + + + + + + + + + + + + + + + + + + + + + + + + $(toolchain_version slitaz-toolchain) + $(toolchain_version binutils) + $(toolchain_version linux-api-headers) + $(toolchain_version gcc) + $(toolchain_version glibc) +
Build date$(sed -n '/^Cook date/s|[^:]*: \(.*\)|\1|p' $LOGS/slitaz-toolchain.log)
Build duration$(sed -n '/^Cook time/s|[^:]*: \(.*\)|\1|p' $LOGS/slitaz-toolchain.log)
Architecture$ARCH
Host system$BUILD_SYSTEM
Target system$HOST_SYSTEM
PackageVersionDescription
-

Toolchain documentation: http://doc.slitaz.org/en:cookbook:toolchain -

+

Toolchain documentation: http://doc.slitaz.org/en:cookbook:toolchain +

-
-
-EOT +
+ + EOT ;; maintainer*) maintainer=$(GET maintainer); maintainer=${maintainer/maintainer/} regexp=$(GET regexp); regexp=${regexp/regexp/} [ -n "$regexp" ] && maintainer='' - cat < -

For maintainers

-

Check packages version either for specified maintainer or using regular expression:

-
- +
+ EOT ;; esac page_footer @@ -1258,29 +1474,29 @@ # Main page with summary. Count only packages included in ARCH, # use 'cooker arch-db' to manually create arch.$ARCH files. - cat < + cat <<-EOT +
-
- -EOT +
+ + EOT unset nojs part summary part webstat - cat < - Service logs: - cookorder · - commits · - pkgdb -

-EOT + cat <<-EOT +

+ Service logs: + cookorder · + commits · + pkgdb +

+ EOT if [ -e "$CACHE/cooker-request" -a ! -s $command ]; then if [ "$activity" -nt "$CACHE/cooker-request" ]; then @@ -1290,10 +1506,11 @@ fi fi - cat <For maintainers -
-EOT + cat <<-EOT + For maintainers + Tags +
+ EOT part activity part cooknotes @@ -1312,30 +1529,91 @@ # show tag -if [ "$pkg" == '~' -a -n "$cmd" ]; then - tag="$cmd" +if [ "$pkg" == '~' ]; then page_header - cat < -
-

Tag “$tag”

+ echo '
' - - - - - -EOT - sort $PKGS/packages.info \ - | awk -F$'\t' -vtag=" $tag " -vbase="$base" '{ - if (index(" " $6 " ", tag)) { - url = base "/" $1 "/"; - gsub("+", "%2B", url); - printf("\n", url, $1, $4, $3); - } - }' - echo '
NameDescriptionCategory
 ", base, $1); - printf("%s%s%s
' + if [ -n "$cmd" ]; then + tag="$cmd" + cat <<-EOT +

Tag “$tag”

+ + + + + EOT + sort $PKGS/packages-$ARCH.info \ + | awk -F$'\t' -vtag=" $tag " -vbase="$base/" '{ + if (index(" " $6 " ", tag)) { + url = base $1 "/"; + gsub("+", "%2B", url); + printf("\n", url, $1, $4, $3); + } + }' + echo '
NameDescriptionCategory
\"%s\" ", base, $1, $1); + printf("%s%s%s
' + else + # Fast and nice tag cloud + echo '

Tag cloud

' + # Some magic in tag sizes :-) It's because of non-linear distribution + # of tags. Currently 1x198 (each of 198 tags marks one package); + # 2x79 (each of 79 other tags marks two packages); 3x28 (and so on); + # 4x23; 5x14; 6x5; 7x9; 8x11; 9x4; 10x3; 11x5; 12x6; 13x3; 14x1; 15x1; + # 16x2; 18x1; 20x3; 22x3; 23, 24, 27, 33, 39, 42, 45, 57, 59, 65, 90x1. + awk -F$'\t' -vbase="$base/~/" ' + { + split($6, tags, " "); + for (i in tags) { tag[tags[i]]++; if (tag[tags[i]] > max) max = tag[tags[i]]; } + } + END { + for (i in tag) { + j = tag[i]; + size = (j == 1) ? 0 : (j == 2) ? 1 : (j < 5) ? 2 : (j < 9) ? 3 : (j < 18) ? 4 : 5; + printf("%s%s\n", base i, size, i, tag[i]); + } + } + ' $PKGS/packages-$ARCH.info | sort -f # sort alphabetically case insensitive + fi + echo '

' + page_footer + exit 0 +fi + + +# show badges + +if [ "$pkg" == '%' ]; then + page_header + echo '
' + + if [ -n "$cmd" ]; then + badge="$cmd" + cat <<-EOT +
+

Badge “$badge”

+ + + + + EOT + ls $WOK \ + | while read pkg; do + [ -e $WOK/$pkg/.badges ] || continue + grep -q "^${badge}$" $WOK/$pkg/.badges && + awk -F$'\t' -vpkg="$pkg" -vbase="$base/" '{ + if ($1 == pkg) { + url = base $1 "/"; + gsub("+", "%2B", url); + printf("\n", url, $1, $4, $3); + } + }' $PKGS/packages-$ARCH.info + done + echo '
NameDescriptionCategory
\"%s\" ", base, $1, $1); + printf("%s%s%s
' + else + layout='list' show_badges bdbroken broken any noany libtool nolibtool own ownover perm permover symlink ss fadd frem fdup old orphan patch win + fi + echo '
' page_footer exit 0 fi @@ -1396,17 +1674,23 @@ summary "$log" + # Show Cooker badges + if [ -s $wok/$pkg/.badges ]; then + layout='table' show_badges $(cat $wok/$pkg/.badges) + fi + + # Repology badge - [ "$REPOLOGY" == '-' ] || cat < -

Repology

- - latest packaged version(s) - Packaging status - -
-EOT + [ "$REPOLOGY" == '-' ] || cat <<-EOT +
+

Repology

+ + latest packaged version(s) + Packaging status + +
+ EOT # Show tag list @@ -1463,23 +1747,23 @@ done } | sort -u > $inf/c - cat < -

Related packages

- - - - - - - - - -EOT + cat <<-EOT +
+

Related packages

+
Build dependenciesRuntime dependenciesRequired by
+ + + + + + + + + EOT awk -vinf="$inf" -vbase="$base" ' function linki(i) { - if (i) return sprintf(" %s", base, i, base, i, i); + if (i) return sprintf("\"%s\" %s", base, i, i, base, i, i); } BEGIN{ do { @@ -1490,11 +1774,11 @@ printf("", linki(a), linki(b), linki(c)); } while ( a b c ) }' - cat < -
Build dependenciesRuntime dependenciesRequired by
%s %s %s 
- -EOT + cat <<-EOT + + + + EOT # Clean rm -r $inf @@ -1539,6 +1823,7 @@ case $file in *.desktop|*.theme) class="ini" ;; *.patch|*.diff|*.u) class="diff" ;; + */patches/series) class="bash";; *.sh) class="bash" ;; *.conf*|*.ini) class="bash" @@ -1572,7 +1857,7 @@ # Display image case $file in *.png|*.svg|*.jpg|*.jpeg|*.ico) - echo "" + echo "" ;; esac @@ -1672,17 +1957,17 @@ esac echo -e '\t' [ -n "$splitsets" ] && echo "" ;; @@ -1697,7 +1982,7 @@ for p in $pkgsofset; do namever="$(awk -F$'\t' -vp="$p" '{ if ($1==p) {printf("%s-%s\n", $1, $2); exit} - }' $PKGS/packages.info)" + }' $PKGS/packages-$ARCH.info)" if [ -d "$wok/$p/taz/$p-$ver" ]; then indir=$p elif [ -d "$wok/$main/taz/$p-$ver" ]; then @@ -1739,10 +2024,12 @@ repeats=$(mktemp) sort $packaged | uniq -d > $repeats if [ -s "$repeats" ]; then - echo - echo "" - echo "
" - echo "

Repeatedly packaged files$set_description:

" + cat <<-EOT + + +
+

Repeatedly packaged files$set_description:

+ EOT cd $install IFS=$'\n' @@ -1753,8 +2040,10 @@ | syntax_highlighter files \ | sed 's|>\./|>/|' done < $repeats - echo '
' - echo '' + cat <<-EOT +
+ + EOT unset IFS fi rm $repeats @@ -1790,15 +2079,19 @@ done > $emptydirs unset IFS if [ -s "$emptydirs" ]; then - echo - echo "" - echo "
" - echo "

Unpackaged empty folders$set_description:

" + cat <<-EOT + + +
+

Unpackaged empty folders$set_description:

+ EOT echo -n '
'
 							echo -en 'permissions·lnk·user    ·group   ·     size·date & time ·name\n'
 							cat $emptydirs
-							echo '
' - echo '
' + cat <<-EOT +
+ + EOT fi rm $emptydirs # ------------------------------------------------------ @@ -1892,7 +2185,9 @@ /\.h$/ || /\.a$/ || /\.pc$/ || /\/bin\/.*-config$/ || /\/Makefile.*$/ { tag("dev", 3); next } /\/share\/help\// || /\/share\/appdata\// || - /\/share\/metainfo\// { tag("gnm", 6); next } + /\/share\/metainfo\// || /\/share\/application-registry\// || + /\/share\/mime-info\// || /\/share\/gnome\/help\// || /\/share\/omf\// { + tag("gnm", 6); next } { tag("???", 1) } ' "$orphans" > $table @@ -2042,7 +2337,7 @@ # disable next `sed` for the 'like2016' theme theme=$(COOKIE theme); theme=${theme:-default}; [ "$theme" != 'like2016' ] && theme='' cat $logfile | syntax_highlighter log | \ - sed -e "/(pkg\/local$theme):/ s|: \([^<]*\)| \1|" | \ + sed -e "/(pkg\/local$theme):/ s|: \([^<]*\)| \1|" | \ awk ' BEGIN { print "
"; }
 		      { printf("%s\n", NR, $0, NR); }
@@ -2138,14 +2433,14 @@
 								wok/*) page="${arg#wok/}"; page="$base/$pkg/browse/${page#*/}";;
 								*)     page="$base/$pkg/browse/install/usr/share/$cmd/$arg";;
 							esac
-							cat <
-	$(show_note w "Missing PDF plugin.
Get the file $(basename "$page").") - -EOT + cat <<-EOT + + $(show_note w "Missing PDF plugin.
Get the file $(basename "$page").") +
+ EOT ;; *.md|*.markdown) - echo '
' + echo '
' $md2html "$tmp" | sed 's|class="|class="language-|g' echo '
' ;; @@ -2204,7 +2499,7 @@ if [ -n "$TARBALL" -a -s "$SRC/$TARBALL" ]; then files_header - echo "$TARBALL" + echo "$TARBALL" ls -lh "$SRC/$TARBALL" | awk '{printf("%sB", $5)}' echo "Sources for building the package “$pkg”" show=1 @@ -2214,19 +2509,25 @@ [ "$show" -eq 1 ] || files_header common_version=$VERSION - for i in $(all_names); do + for i in $(all_names | tr ' ' '\n' | sort); do [ -e "$wok/$pkg/taz/$i-$common_version$EXTRAVERSION/receipt" ] || continue . $wok/$pkg/taz/$i-$common_version$EXTRAVERSION/receipt - for filename in "$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" "$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg"; do - [ -f "$PKGS/$filename" ] && - cat < -$filename -$(ls -lh ./packages/$filename | awk '{printf("%sB", $5)}') -$SHORT_DESC - -EOT + for filename in "$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" "$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg" "$PACKAGE-$VERSION$EXTRAVERSION-any.tazpkg"; do + [ -f "$PKGS/$filename" ] || continue + + case $filename in + *-x86_64.tazpkg) class='pkg64';; + *-any.tazpkg) class='pkgany';; + *) class='pkg32';; + esac + cat <<-EOT + + $filename + $(ls -lh ./packages/$filename | awk '{printf("%sB", $5)}') + $SHORT_DESC + + EOT done done show=1 diff -r 01e5c3e760d7 -r 77291d41f21a modules/deps --- a/modules/deps Sat Aug 25 17:30:05 2018 +0300 +++ b/modules/deps Sat Nov 24 13:28:02 2018 +0200 @@ -179,6 +179,7 @@ s("freetype-dev", "freetype-infinality-dev"); s("nspr", "webian-shell"); s("nss", "webian-shell"); + s("libxml2", "libxml2-min"); # if called with "--incl": show all deps including glibc-base, # gcc-lib-base, glibc-dev and gcc; otherwise hide them diff -r 01e5c3e760d7 -r 77291d41f21a modules/langdesc --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/langdesc Sat Nov 24 13:28:02 2018 +0200 @@ -0,0 +1,110 @@ +#!/bin/sh +# +# langdesc - module of the SliTaz Cook +# Copyright (C) SliTaz GNU/Linux - GNU GPL v3 +# + +# Information source: iso-codes package + +langdesc() { + local i + case $1 in + af) i='Afrikaans';; + am) i='Amharic';; + ar) i='Arabic';; + ast) i='Asturian';; + az) i='Azerbaijani';; + be) i='Belarusian';; + be@latin) i='Belarusian (Latin script)';; + bg) i='Bulgarian';; + bn) i='Bengali';; + bn_IN) i='Bengali (India)';; + br) i='Breton';; + bs) i='Bosnian';; + ca) i='Catalan';; + da) i='Danish';; + de) i='German';; + el) i='Greek';; + en) i='English';; + en_GB) i='English (British)';; + en_ZA) i='English (South African)';; + eo) i='Esperanto';; + es) i='Spanish';; + et) i='Estonian';; + eu) i='Basque';; + fa) i='Persian';; + fi) i='Finnish';; + fr) i='French';; + ga) i='Irish';; + gd) i='Scottish Gaelic';; + gl) i='Galician';; + gu) i='Gujarati';; + he) i='Hebrew';; + hi) i='Hindi';; + hr) i='Croatian';; + hu) i='Hungarian';; + hy) i='Armenian';; + ia) i='Interlingua';; + id) i='Indonesian';; + is) i='Icelandic';; + it) i='Italian';; + ja) i='Japanese';; + ka) i='Georgian';; + kk) i='Kazakh';; + kn) i='Kannada';; + ko) i='Korean';; + ku) i='Kurdish';; + ky) i='Kirghiz';; + lg) i='Luganda';; + lo) i='Lao';; + lt) i='Lithuanian';; + lv) i='Latvian';; + mk) i='Macedonian';; + ml) i='Malayalam';; + mn) i='Mongolian';; + mr) i='Marathi';; + ms) i='Malay';; + mt) i='Maltese';; + nb) i='Norwegian Bokmål';; + nds) i='Low German';; + ne) i='Nepali';; + nl) i='Dutch';; + nn) i='Norwegian Nynorsk';; + pa) i='Punjabi';; + pl) i='Polish';; + ps) i='Pashto';; + pt) i='Portuguese';; + pt_BR) i='Brazilian Portuguese';; + ro) i='Romanian';; + ru) i='Russian';; + rw) i='Kinyarwanda';; + sk) i='Slovak';; + sl) i='Slovenian';; + so) i='Somali';; + sq) i='Albanian';; + sr) i='Serbian';; + sv) i='Swedish';; + sw) i='Swahili';; + ta) i='Tamil';; + te) i='Telugu';; + tg) i='Tajik';; + th) i='Thai';; + tr) i='Turkish';; + uk) i='Ukrainian';; + ur) i='Urdu';; + vi) i='Vietnamese';; + wa) i='Walloon';; + zh) i='Chinese';; + zh_CN) i='Chinese (simplified)';; + zh_HK) i='Chinese (Hong Kong)';; + zh_TW) i='Chinese (traditional)';; + esac + + case $2 in + '') echo "$i";; + -) echo "$i" | sed 's|(|- |; s|)||';; + esac +} + +# langdesc en_GB -> 'English (British)' +# langdesc en_GB - -> 'English - British' diff -r 01e5c3e760d7 -r 77291d41f21a modules/pack --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/pack Sat Nov 24 13:28:02 2018 +0200 @@ -0,0 +1,865 @@ +#!/bin/sh +# +# pack - module of the SliTaz Cook +# Copyright (C) SliTaz GNU/Linux - GNU GPL v3 +# + +. /usr/lib/slitaz/libcook.sh + + +###################################################### +# BEGIN: Functions may be used in the genpkg_rules() # +###################################################### + + +# A bit smarter function than the classic `cp` command + +scopy() { + if [ "$(stat -c %h -- "$1")" -eq 1 ]; then + cp -a "$1" "$2" # copy generic files + else + cp -al "$1" "$2" # copy hardlinks + fi +} + + +# Copy specified files from $install to $fs + +cook_copy_files() { + action 'Copying files...' + cd $install + local i j + IFS=$'\n' + for i in $@; do + for j in $(find . -name $i ! -type d); do + mkdir -p $fs$(dirname ${j#.}) + scopy $j $fs$(dirname ${j#.}) + done + done + cd - >/dev/null + status +} + + +# Copy specified folders from $install to $fs + +cook_copy_folders() { + action 'Copying folders...' + cd $install + local i j + IFS=$'\n' + for i in $@; do + for j in $(find . -name $i -type d); do + mkdir -p $fs$(dirname ${j#.}) + cp -a $j $fs$(dirname ${j#.}) + done + done + cd - >/dev/null + status +} + + +# Remove from current $fs files that are already packed (for receipts v2). +# Note: the order in $SPLIT is very important. +# Note 2: working in the current set. + +remove_already_packed() { + local i j + # $pkg is the name of the main package; $PACKAGE is the name of the current one + # $pkg may (or may not) be included in the $SPLIT + neighbors=$( + echo $basepkg $SPLIT" " \ + | awk -F$'\t' -vpkg="$thispkg" ' + BEGIN { RS = " "; FS = ":"; } + { set[$1] = $2; } + END { + current_set = set[pkg]; + for (i in set) + { if (i != pkg && set[i] == current_set) print i; } + } + ') + IFS=$'\n' + for neighbor in $neighbors; do + i="$taz/$neighbor-$VERSION$EXTRAVERSION/files.list" + [ -e "$i" ] || continue + while read j; do + [ -f $fs$j -o -h $fs$j ] || continue + rm $fs$j + rmdir --parents --ignore-fail-on-non-empty $fs$(dirname $j) + done < $i + done + unset IFS +} + + +# Copy hicolor icons in specified sizes (default: 16 and 48) from $install to $fs + +cook_copy_icons() { + local sizes=$@ i j ifs="$IFS" + unset IFS + action 'Copying hicolor icons...' + [ -d "$fs/usr/share/icons/hicolor" ] && rm -rf "$fs/usr/share/icons/hicolor" + mkdir -p $fs/usr/share/icons/hicolor + for i in ${sizes:-16 48}; do + j="${i}x$i"; [ "$i" == 'scalable' ] && j="$i" + [ ! -e "$install/usr/share/icons/hicolor/$j" ] || + scopy $install/usr/share/icons/hicolor/$j \ + $fs/usr/share/icons/hicolor + done + status + IFS="$ifs" +} + + +# Common function to copy files, folders and patterns + +copy() { + action 'Copying folders and files...' + local i j k filelist=$(mktemp) folderlist=$(mktemp) + + IFS=$'\n' + cd $install + find ! -type d | sed 's|\.||' > $filelist + find -type d | sed 's|\.||' > $folderlist + + for i in $@; do + case $i in + @std) + # Copy "standard" files (all but "developer files", man pages, documentation, translations) + sed '/\.h$/d; /\.hxx$/d; /\.a$/d; /\.la$/d; /\.pc$/d; /\.pri$/d; /bin\/.*-config$/d; + /\.m4$/d; /\.gir$/d; /\.typelib$/d; /\.vapi$/d; /\.deps$/d; /\.cmake$/d; + /\/Makefile.*/d; /\.inc$/d; /\/include\//d; + /\/share\/man\//d; /\/share\/doc\//d; /\/share\/gtk-doc\//d; /\/share\/info\//d; + /\/share\/devhelp\//d; /\/share\/locale\//d; + /\/share\/bash-completion\//d; /\/etc\/bash_completion\.d\//d; /\/lib\/systemd\//d; + /\/fonts\.scale$/d; /\/fonts\.dir$/d; + /\/share\/appdata\//d; /\/share\/help\//d; /\/share\/metainfo\//d; /\/share\/mimelnk\//d; + /\/share\/application-registry\//d; /\/share\/mime-info\//d; + /\/share\/gnome\/help\//d; /\/share\/omf\//d; + /\/share\/icons\/hicolor\/[12356][1245][268]*x[12356][1245][268]*\//d; # 22, 24, 32, 64, 128, 256, 512 + /\.so\.dbg$/d; + ' $filelist + ;; + @dev) + # Copy "developer files" + sed -n ' + /\/share\/doc\//d; + /\.h$/p; /\.hxx$/p; /\.a$/p; /\.pc$/p; /\.pri$/p; /bin\/.*-config$/p; + /\.m4$/p; /\.gir$/p; /\.typelib$/p; /\.vapi$/p; /\.deps$/p; /\.cmake$/p; + /\/Makefile.*/p; /\.inc$/p; /\/include\//p; + /\.so\.dbg$/p; + ' $filelist + ;; + @ruby) + # Copy mandatory Ruby files + gem_base="\/usr\/lib\/ruby\/gems\/.*\/${PACKAGE#*-}-$VERSION" + sed -n '/\/extensions\/.*\.so$/p; /'$gem_base'\/lib\//p; /\.gemspec$/p; + /\/usr\/bin\//p; /\/gems\/.*\/bin\//p; + ' $filelist | sed '/\/gems\/.*\/lib\/.*\.so$/d; /\/gems\/.*\/lib\/.*\.h$/d; + /\/gems\/.*\/gems\/.*\.gemspec$/d;' + ;; + @ruby-dev) + sed -n '/\/ext\/.*\.h$/p; /\/ext\/.*\.pc$/p; /\/gem.build_complete$/p; + /\/gems\/.*\/lib\/.*\.h$/p; + ' $filelist + ;; + @rm) + # Quick alias + remove_already_packed + ;; + @ico) + # Quick alias + cook_copy_icons >/dev/null + ;; + */) + # Copy specified folders. + i="${i%/}" + find -type d -path "*/${i#/}" | sed 's|^.||' + ;; + *) + # Copy specified files. + find ! -type d -path "*/${i#/}" | sed 's|^.||' + ;; + esac \ + | sort -u \ + | while read j; do + mkdir -p $fs$(dirname "$j") + if [ -d "$install$j" ]; then + cp -a "$install$j" $fs$(dirname "$j") + else + scopy "$install$j" $fs$(dirname "$j") + fi + done + # Copy empty directories + case $i in + @std) + while read j; do + case $j in + # skip empty man & doc folders + */man/*|*/doc/*) continue;; + esac + [ -z "$(ls -A "$install$j")" ] || continue + # directory $j is empty + k="$j" + # make 'ladder' from directories, from root dir to $j + # /a /a/b /a/b/c etc. + while :; do + [ -z "$k" ] && break + echo "$k" + k="${k%/*}" + done \ + | tac \ + | while read k; do + # make dir if it does not exist + if [ ! -d "$fs$k" ]; then + # It's like "copy the directory without its underlying content". + # keep original ownership/permissions, access: + keepIFS="$IFS"; unset IFS + install -d $(stat -c'-o%u -g%g -m%a' "$install$k") "$fs$k" + # keep last-modified date: + touch -r "$install$k" "$fs$k" + IFS="$keepIFS"; unset keepIFS + fi + done + done < $folderlist + ;; + esac + done + cd - >/dev/null + unset IFS + rm $filelist $folderlist + status +} + +#################################################### +# END: Functions may be used in the genpkg_rules() # +#################################################### + + + + +# Receipt used for cooking the package is redundant to be included into package. +# This script will strip the original receipt to bare minimum: variables, +# {pre,post}_{install,remove} functions. + +mk_pkg_receipt() { + orig_receipt="$1" + + # 1. Main package. + # By default it has no dependencies. + # You can write or omit DEPENDS="" for indicating package have no + # dependencies. + # 2. Split package (excluding *-dev). + # By default every split package depends on the main package. + # Unfortunately, in the shell script (receipt is the shell script too), + # every undeclared variable has empty value, so there's no difference if + # you wrote DEPENDS="" or omit it - result will be the same empty value. + # If you want to define the split package has no dependencies - you need + # to to put single space between the quotes: DEPENDS=" ". + # 3. Development split package. + # Installing *-dev package should install all the files produced during + # compilation and then were separated to the different packages, so + # by default (if you wrote DEPENDS="" or omit it) *-dev package depends + # on the main package and all the split packages (excluding the itself). + [ "$DEPENDS" == ' ' ] && DEPENDS='@EMPTY@' + + # Receipt's signature is important, although some receipts may miss it + signature=$(head -n1 "$orig_receipt") + [ "${signature:0:1}" == '#' ] || signature='# SliTaz package receipt.' + + save="$(mktemp)" + # `$(echo ...)`: normalize whitespace (space, tab, newline and their + # combinations and repeats) + cat > $save < gtk_; acl-dev -> acl_dev) + rname=$(echo -n $PACKAGE | tr -c 'a-zA-Z0-9' '_') + for i in pre post; do + for j in install remove; do + sed "/^${i}_${j}()/,/^}/!d" "$orig_receipt" + sed "/^${i}_${j}_$rname()/,/^}/!d" "$orig_receipt" \ + | sed "s|^${i}_${j}_$rname()|${i}_${j}()|" + done + done +} + + +# Copy all generic files (locale, pixmaps, .desktop) from $install to $fs. +# We use standard paths, so some packages need to copy these files with the +# receipt and genpkg_rules. +# This function executes inside the packaging process, before compressor call. + +copy_generic_files() { + # $LOCALE is set in cook.conf + if [ -n "$LOCALE" -a -z "$WANTED" ]; then + if [ -d "$install/usr/share/locale" ]; then + mkdir -p "$fs/usr/share/locale" + for i in $LOCALE; do + if [ -d "$install/usr/share/locale/$i" ]; then + cp -r $install/usr/share/locale/$i $fs/usr/share/locale + fi + done + fi + fi + + # Generic pixmaps copy can be disabled with COOKOPTS="!pixmaps" (or GENERIC_PIXMAPS="no") + if [ "${COOKOPTS/!pixmaps/}" == "$COOKOPTS" -a "$GENERIC_PIXMAPS" != 'no' ]; then + if [ -d "$install/usr/share/pixmaps" ]; then + mkdir -p "$fs/usr/share/pixmaps" + for i in png xpm; do + [ -f "$install/usr/share/pixmaps/$PACKAGE.$i" -a ! -f "$fs/usr/share/pixmaps/$PACKAGE.$i" ] && + cp -r $install/usr/share/pixmaps/$PACKAGE.$i $fs/usr/share/pixmaps + done + fi + fi + + # Desktop entry (.desktop). + # Generic desktop entry copy can be disabled with COOKOPTS="!menus" (or GENERIC_MENUS="no") + if [ "${COOKOPTS/!menus/}" == "$COOKOPTS" -a "$GENERIC_MENUS" != 'no' ]; then + if [ -d "$install/usr/share/applications" -a -z "$WANTED" ]; then + mkdir -p "$fs/usr/share" + cp -r $install/usr/share/applications $fs/usr/share + fi + fi +} + + +# Determine package architecture +# Input: $1 = $fs; output string: i486 | x86_64 | any + +determine_pkg_arch() { + action 'Determining package architecture...' >&2 + + if [ "${COOKOPTS/force-arch/}" != "$COOKOPTS" ]; then + arch="$ARCH" + else + archs="$( + IFS=$'\n' + { + # examine all the executables and static libs (*.a) + busybox find "$1" -type f \( -perm +111 -o -name '*.a' \) \ + | while read i; do + readelf -Wh "$i" 2>/dev/null \ + | sed '/Machine:/!d; s|.* ||' + done + + # examine compressed kernel modules (we use exclusively *.ko.xz) + tmpko=$(mktemp) + find "$1" -type f -name '*.ko.xz' \ + | while read i; do + unxz -kc $i >$tmpko + readelf -Wh "$tmpko" 2>/dev/null \ + | sed '/Machine:/!d; s|.* ||' + done + rm $tmpko + + # examine Guile *.go files (Machine: None, so check Class) + find "$1" -type f -name '*.go' \ + | while read i; do + readelf -Wh "$i" 2>/dev/null \ + | sed '/Class:/!d; s|.* ||' + done \ + | sed 's|ELF32|80386|; s|ELF64|X86-64|' + } | sort -u + )" + + case $archs in + 80386) arch='i486'; echo ' i486' >&2;; + X86-64) arch='x86_64'; echo ' x86_64' >&2;; + '') arch='any'; echo ' any' >&2;; + *) arch="$ARCH"; echo ' ' $archs >&2 + echo "Warning: weird architecture found, forced to use $ARCH for now." >&2 + ;; + esac + fi + + touch $pkgdir/.arch + sed -i "/^$PACKAGE /d" $pkgdir/.arch # remove previous entry + echo "$PACKAGE $arch" >> $pkgdir/.arch # put new one + + echo $arch +} + + +# Find the variables inside receipt + +find_vars() { + # You can define variables in the root of the receipt describing + # the dependencies (tags, config files, etc.) for each sub-package. + # Example: + # PACKAGE="cool" + # SPLIT="$PACKAGE-extra libcool $PACKAGE-dev" + # + # DEPENDS_cool or DEPENDS_std # latter is the universal name for main package deps + # DEPENDS_cool_extra or DEPENDS_extra # you can skip "$PACKAGE" at the start + # DEPENDS_libcool # name not starts with "$PACKAGE" so no "short" name + # DEPENDS_cool_dev or DEPENDS_dev + + local out + local var=$1 + local pkg=$(echo -n $2 | tr -c 'a-zA-Z0-9' '_') + local end=$(echo -n ${2#$basepkg-} | tr -c 'a-zA-Z0-9' '_') + if [ "$pkg" == "$basepkg" ]; then + eval out="\$${var}_$pkg" + [ -n "$out" ] || eval out="\$${var}_std" + else + eval out="\$${var}_$pkg" + [ -n "$out" ] || eval out="\$${var}_$end" + fi + echo "$out" +} + + +# Create the package + +packit() { + basepkg="$PACKAGE" + thispkg="$1" + + pkgdir="$WOK/$basepkg" + receipt="$pkgdir/receipt" + . $receipt + + title 'Pack: %s' "$thispkg $VERSION" + + + # + # Set variables + # + + # Determine set name for specified package from $SPLIT variable + local set=$(echo -n $SPLIT \ + | awk -vpkg="$thispkg" ' + BEGIN { RS = " "; FS = ":"; } + { if ($1 == pkg && $2 != "") { print "-" $2; exit; } }') + + # Set paths + export stuff="$pkgdir/stuff" + export src="$pkgdir/source/$basepkg-$VERSION$set" + export install="$pkgdir/install$set" + export DESTDIR="$install" + export taz="$pkgdir/taz" + export pack="$taz/$thispkg-$VERSION$EXTRAVERSION" + export fs="$pack/fs" + + export PACKAGE=$thispkg + + + # + # Execute genpkg_rules() + # + + if grep -q ^genpkg_rules $receipt; then + _ 'Executing: %s' 'genpkg_rules' + set -e; cd $pkgdir; mkdir -p $fs + genpkg_rules || (newline; _ 'ERROR: genpkg_rules failed'; newline) >> \ + $LOGS/$pkg.log + else + cd $pkgdir + mkdir -p $fs + if [ "$CATEGORY" == 'meta' -a "$thispkg" == "$basepkg" ]; then + _ 'No packages rules: meta package' + else + # Auto-packing + for i in DEPENDS SUGGESTED PROVIDE CONFIG_FILES TAGS CAT COPY; do + eval $i="\$(find_vars $i $thispkg)" + done + + [ -n "$COPY" ] || + case "$thispkg" in + $basepkg) COPY='@std @rm';; + *-dev) COPY='@dev @rm';; + lib$basepkg) COPY='*.so*';; + esac + [ -n "$COPY" ] || die "ERROR: COPY_$thispkg rules undefined" + copy $COPY + fi + fi + + + # + # Check CONFIG_FILES + # + + if [ -n "$CONFIG_FILES" ]; then + unset IFS + for i in $CONFIG_FILES; do + if [ ! -e $fs$i ]; then + case $i in + */) mkdir -p $fs$i ;; + *) mkdir -p $fs$(dirname $i); touch $fs$i ;; + esac + fi + done + fi + + # First QA check to stop now if genpkg_rules failed. + if fgrep -q '^ERROR' $LOGS/$basepkg.log; then + broken; exit 1 + fi + + + # + # Copy receipt and description + # + + cd $taz + action 'Copying "%s"...' 'receipt' + mk_pkg_receipt "$(realpath ../receipt)" > $pack/receipt + chown 0:0 $pack/receipt + status + + unset desc + # description common to all the sub-packages + [ -f "../description.txt" ] && desc="../description.txt" + # description for specified sub-package + [ -f "../description.$thispkg.txt" ] && desc="../description.$thispkg.txt" + if [ -n "$desc" ]; then + action 'Copying "%s"...' "$(basename "$desc")" + cp -f $desc $pack/description.txt + chown 0:0 $pack/description.txt + status + fi + + + # + # Copy generic files + # + + # Proceed only for "main" package (for v2), and for any packages (v1) + [ "$thispkg" == "$mainpkg" ] && copy_generic_files + + + # + # Strip / compress files + # + + arch="$(determine_pkg_arch $fs)" + + export COOKOPTS ARCH HOST_SYSTEM LOCALE fs; @@PREFIX@@/libexec/cookutils/compressor fs + + + # + # Make lists + # + + # Create files.list + action 'Creating the list of files...' + cd $fs + find . \( -type f -o -type l \) | sed 's|^.||' > ../files.list + cd .. + status + + # Md5sum of files. + action '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 | sort -k2 > md5sum + status + + + # + # Calculate release checksum + # + + # Usually it does not change on "just recook". + # Md5sum of the *.tazpkg will change every time because of embedded timestamps; + # on the other hand release checksum don't relies on the timestamps, but + # only on files content and their permissions. + + # Calculate rsum for new package + RSUM=$( + { + # a) md5sums of all files + cat $pack/md5sum + # b) md5sum of receipt + md5sum $pack/receipt | sed 's| [^ ]*/| |' + # c) md5sum of description.txt + [ -e "$pack/description.txt" ] && + md5sum $pack/description.txt | sed 's| [^ ]*/| |' + # d) md5sum of list of permissions and ownership of all the files and + # folders of the package + # stat line example: -rwsr-xr-x 0:0 ./bin/busybox + { + cd $fs + find . -print0 | sort -z | xargs -0rn 1 stat -c '%A %g:%u %N' | md5sum + } + } | md5sum $rsum_file | awk '{print $1}') + + + # + # Compressing + # + + UNPACKED_SIZE=$(du -cks fs receipt files.list md5sum description.txt \ + 2>/dev/null | awk 'END{ print $1 "K"}') + + # Build fs cpio archive + action 'Compressing the FS...' + find fs -newer $receipt -exec touch -hr $receipt '{}' \; +# find fs | cpio -o -H newc --quiet | lzma-alone e fs.cpio.lzma -si + find fs | cpio -o -H newc --quiet | /bin/lzma -qzeT0 >fs.cpio.lzma + mv fs ../ + status + + PACKED_SIZE=$(du -cks fs.cpio.lzma receipt files.list md5sum description.txt \ + 2>/dev/null | awk 'END{ print $1 "K"}') + + + # + # Add variables to the receipt + # + + # Store sizes + sed -i '/^PACKED_SIZE=/d; /^UNPACKED_SIZE=/d' receipt + sed -i "s|^PACKAGE=|PACKED_SIZE=\"$PACKED_SIZE\"\nUNPACKED_SIZE=\"$UNPACKED_SIZE\"\nPACKAGE=|" receipt + + # Store RSUM + sed -i "s|^PACKAGE=|RSUM=\"$RSUM\"\nPACKAGE=|" receipt + + # Set extra version + if [ -n "$EXTRAVERSION" ]; then + sed -i '/^EXTRAVERSION=/d' receipt + sed -i "s|^VERSION=|EXTRAVERSION=\"$EXTRAVERSION\"\nVERSION=|" receipt + fi + + + # + # Build *.tazpkg + # + + action 'Creating full cpio archive...' + find . -newer $receipt -exec touch -hr $receipt '{}' \; + find . | cpio -o -H newc --quiet > ../$PACKAGE-$VERSION$EXTRAVERSION-$arch.tazpkg + status + + # Restoring original package tree. + mv ../fs . + + rm fs.cpio.lzma; cd .. + + tazpkg=$(ls *.tazpkg) + + + # + # Verify package quality and consistency + # + + # Preferrable way is to combine the commands chain in the compile_rules() + # using '&&': when any of the chunk broke, process will stop and function + # will return non-zero return code. + # On the other hand some old receipts don't use '&&' but depends on the + # error messages on the log. + # Sometimes it produce false positives on the configuration stage. + # In this case we can use the "skip-log-errors". + if [ "${COOKOPTS/skip-log-errors/}" == "$COOKOPTS" ]; then + # Exit if any error found in log file. + if fgrep -q ^ERROR $LOGS/$basepkg.log; then + rm -f $command + broken; exit 1 + fi + fi + + + # Allow meta-packages in v2 receipts + [ -n "$CAT" ] && CATEGORY="${CAT%|*}" + + if [ "${COOKOPTS/empty-pkg/}" == "$COOKOPTS" ]; then + action 'QA: checking for empty package...' + if [ ! -s "$pack/files.list" -a "$CATEGORY" != 'meta' ]; then + broken + rm -f $command + false; status + die 'ERROR: empty package' + fi + :; status + fi + + + # + # Get RSUM from the old package + # + + pkg_file="$PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$arch.tazpkg" + if [ -f "$pkg_file" ]; then + # don't trust database entry, check the package file + tmpdir=$(mktemp -d) + cd $tmpdir + cpio -F "$pkg_file" -i receipt >/dev/null 2>&1 + RSUM_OLD=$(. receipt; echo $RSUM) + cd - >/dev/null + rm -r $tmpdir + else + unset RSUM_OLD + fi + + + # + # Removing unhandled old packages + # + + if [ $ARCH == 'i486' -a -e $PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg ]; then + action 'Removing old i486 package without arch specifier' + rm -f $PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg + status + fi + + # For example, if *-dev package contains *.a static libs, it will be either + # i486 or x86_64 arch; otherwise it will be "any" arch. This transition + # may be done forth and back depending on you disable static libs or not. + case $arch in + any) + if [ -e $PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg ]; then + action "Removing old $ARCH package because it arch-less now" + rm -f $PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg + status + fi + ;; + *) + if [ -e $PKGS/$PACKAGE-$VERSION$EXTRAVERSION-any.tazpkg ]; then + action "Removing old arch-less package because it $ARCH now" + rm -f $PKGS/$PACKAGE-$VERSION$EXTRAVERSION-any.tazpkg + status + fi + ;; + esac + + # Find and remove old package only if "release checksum" has changed + + pi="$PKGS/packages-$ARCH.info" + touch $pi + + if [ "$RSUM" != "$RSUM_OLD" ]; then + old_file=$(awk -F$'\t' -vname="$PACKAGE" -varch="$arch" '{ + if ($1 == name) printf("%s-%s-%s.tazpkg", $1, $2, arch); + }' $pi) # --.tazpkg + if [ -f "$PKGS/$old_file" ]; then + action 'Removing old package "%s"' "$old_file" + rm -f "$PKGS/$old_file" + status + fi + # package changed, substitute old package by new one + mv -f $pkgdir/taz/$PACKAGE-$VERSION$EXTRAVERSION-$arch.tazpkg $PKGS + _ 'The release checksum has changed.' + else + # package not changed, remove new package + rm -f $pkgdir/taz/$PACKAGE-$VERSION$EXTRAVERSION-$arch.tazpkg + _ 'The release checksum has not changed.' + fi + + + # + # Package isn't broken anymore + # + + touch $broken + sed -i "/^${thispkg}$/d" $broken + + + # + # Update packages database every time after successful build + # + + # packages-arch.info (unsorted, located near to packages) + unset_receipt; . $pack/receipt + SIZES=$(echo $PACKED_SIZE $UNPACKED_SIZE | sed 's|\.0||g') + DEPENDS=$(echo $DEPENDS) # remove newlines, tabs and multiple spaces from variable + case $arch in + i?86) arch_code='3';; # 3 for 32-bit + x86_64) arch_code='6';; # 6 for 64-bit + any) arch_code='0';; # 0 for any arch + esac + + sed -i "/^$PACKAGE\t/d" $pi # remove old entry + cat >> $pi <> $fl + + footer "$(_ 'Package "%s" created' "$tazpkg")" +} + + +packit "$1" diff -r 01e5c3e760d7 -r 77291d41f21a modules/postcheck --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/modules/postcheck Sat Nov 24 13:28:02 2018 +0200 @@ -0,0 +1,263 @@ +#!/bin/sh +# +# postcheck - module of the SliTaz Cook +# Copyright (C) SliTaz GNU/Linux - GNU GPL v3 +# +# Check for different cases at the end and add badges + +. /usr/lib/slitaz/libcook.sh +. /etc/slitaz/cook.conf +. $WOK/$1/receipt + +data="$(mktemp -d)" # temporary data for post-checking + +repologydb="$CACHE/repology.db" + +badges="$WOK/$1/.badges" +echo -n > $badges # clean badges + +overrides="$WOK/$1/stuff/overrides" +overrides_exp="$data/overrides_exp" +fail="$data/fail" # file used as flag, if will be empty if no fails were found + +sets=$(echo -n $SPLIT | awk 'BEGIN { RS = " "; FS = ":"; } + { if ($2 && ! set[$2]) { printf("%s ", $2); set[$2] = "1"; } }') + +# Format of stuff/overrides: +# { ...} +# One or more rules may indicate: +# - ownership in form '80:80' (numeric UID:GID) or 'www:www' (string UID:GID) +# - permissions in form '0600' (four octal digits) +# File is space free string specified one (or more - using placeholders) files + + +# Expand overrides to the simple form: + +if [ -e "$overrides" ]; then + IFS=$'\n' + while read line; do + rules=${line% *}; file=${line##* } + + for set in '' $sets; do + install="$WOK/$1/install" + [ -z "$set" ] || install="$install-$set" + [ -d "$install" ] || continue + for file in $(ls -d $install$file); do + for rule in $rules; do + echo "$rule ${file#$install}" >> $overrides_exp + done + done + done + done < $overrides + unset IFS +fi + + +# Get latest packaged version from Repology + +repology_get() { + local found versions day=$(date +%j) # %j is the number of the day in the year + found=$(awk -F$'\t' -vpkg="$1" -vday="$day" '{ + if ($1 == pkg && $2 == day) { print $3; exit; } + }' $repologydb) + if [ -n "$found" ]; then + echo "$found" + else + # set HOST_WGET in cook.conf + versions=$($HOST_WGET -q -T 20 -O- https://repology.org/badge/latest-versions/$1.svg \ + | sed '/\(.*\)<.*|\1|; s|, | |g') # space separated list + if [ -n "$versions" ]; then + sed -i "/^$1 /d" $repologydb + echo -e "$1\t$day\t$versions" >> $repologydb + echo $versions + fi + fi +} + + +# Add the specified badge, set the fail flag and return false status + +function add() { + ! grep -q "^${1}$" $badges && echo "$1" >> $badges + case $1 in + ss|old|win|patch) return 0;; + *) echo 'yes' > $fail; false;; + esac +} + + +function docheck() { + action 'Checking build...' + if grep -q "^$PACKAGE$" $broken; then + if grep -q '^ERROR: unknown dep' $LOGS/$1.log; then + add 'bdbroken' + else + add 'broken' + fi + status; return # no more tests since package is broken + fi + status + + + if [ -e $WOK/$1/.arch ]; then + action "Checking 'any' arch..." + if [ "$(cut -d$'\t' -f2 $WOK/$1/.arch | sort -u)" == 'any' ]; then + if [ "$HOST_ARCH" != 'any' ]; then + add 'any' + fi + else + if [ "$HOST_ARCH" == 'any' ]; then + add 'noany' + fi + fi + status + fi + + + if [ -e $WOK/$1/.patch.done ]; then + # consider 'fix libtool' as no patch here + if [ -n "$(grep -v 'fix.libtool' $WOK/$1/.patch.done)" ]; then + add 'patch' + fi + fi + + + for set in '' $sets; do + src=$WOK/$1/source/$PACKAGE-$VERSION + [ -z "$set" ] || src="$src-$set" + [ -d "$src" ] || continue + + action "Checking libtool in ${src#$WOK/$1/}..." + if [ -e "$src/libtool" ]; then + if ! grep -q '^fix.libtool$' $WOK/$1/.patch.done 2>/dev/null; then + add 'libtool' + fi + else + if grep -q '^fix.libtool$' $WOK/$1/.patch.done 2>/dev/null; then + add 'nolibtool' + fi + fi + status + + action "Checking site script in ${src#$WOK/$1/}..." + if fgrep -q 'configure: loading site script /etc/slitaz/cook.site' $LOGS/$PACKAGE.log; then + for i in bindir datadir datarootdir docdir dvidir htmldir includedir infodir libdir \ + libexecdir localedir localstatedir mandir oldincludedir pdfdir psdir sbindir \ + sharedstatedir sysconfdir; do + if fgrep -q -e "--$i=" $WOK/$1/receipt; then + add 'ss' + break + fi + done + fi + status + done + + + for set in '' $sets; do + install="$WOK/$1/install" + [ -z "$set" ] || install="$install-$set" + [ -d "$install" ] || continue + + action "Checking ownership in ${install#$WOK/$1/}..." + + IFS=$'\n' + bad_own="$(find $install -type f \( ! -user 0 -a ! -group 0 \))" + if [ -n "$bad_own" ]; then + if [ -e $overrides_exp ]; then + # There may be mix of overridden and not-overridden ownership + # in the package. Return status 'Done' only if all the ownership + # was overridden. + result='' + for i in $bad_own; do + if fgrep -q "$(stat -c %u:%g "$i") ${i#$install}" $overrides_exp || + fgrep -q "$(stat -c %U:%G "$i") ${i#$install}" $overrides_exp; then + add 'ownover' + else + add 'own' + result='bad' + fi + done + [ "$result" == '' ] # OK, all was overridden + else + add 'own' + fi + fi + status + unset IFS + + + action "Checking permissions in ${install#$WOK/$1/}..." + + bad_files="$(find $install -type f \( ! -perm 644 -a ! -perm 755 \))" + bad_dirs="$(find $install -type d ! -perm 755)" + list='' + if [ -n "$bad_files$bad_dirs" ]; then + if [ -e $overrides_exp ]; then + # There may be mix of overridden and not-overridden permissions + # in the package. Return status 'Done' only if all the permissions + # was overridden. + result='' + for i in $bad_files; do + if fgrep -q "$(printf "%04d\t%s" "$(stat -c%a "$i")" "${i#$install}")" $overrides_exp; then + add 'permover' + else + add 'perm' + list="$list$(printf "\n %04d %s" "$(stat -c %a "$i")" "${i#$install}")" + result='bad' + fi + done + for i in $bad_dirs; do + if fgrep -q "$(printf "%04d" $(stat -c %a "$i")) ${i#$install}/" $overrides_exp; then + add 'permover' + else + add 'perm' + list="$list$(printf "\n %04d %s" "$(stat -c %a "$i")" "${i#$install}/")" + result='bad' + fi + done + [ "$result" == '' ] # OK, all was overridden + else + add 'perm' + fi + fi + status + [ -n "$list" ] && echo -e " Problems found:$list" + + action "Checking broken symlinks in ${install#$WOK/$1/}..." + bad_sl=$(find $install -type l ! -exec test -e '{}' \; -print) + if [ -n "$bad_sl" ]; then + add 'symlink' + fi + status + done + + if [ "$REPOLOGY" != '-' ]; then + action 'Querying Repology...' + repo_ver=$(repology_get ${REPOLOGY:-$PACKAGE}) + if [ "$repo_ver" != '-' -a ! -s $fail ]; then + if echo " $repo_ver " | fgrep -q " $VERSION "; then + add 'win' + else + add 'old' + fi + fi + status + fi +} + + +title 'Post-check' +docheck $1 + + +# Put badges into activity log: ... + +action 'Updating activity log...' +badges_log=$(tr '\n' ' ' <$badges | sed 's| $||') +sed -i "s|>$1$| data-badges='$badges_log'&|" $activity +status + +footer + +rm -r $data # clean