# HG changeset patch # User Aleksej Bobylev # Date 1516788878 -7200 # Node ID be4a05be1a6fc32cee31b47c6cc28cbe5893c9b1 # Parent 713fecc034549f6a76dff73bf6bf597ec210e67f cook, lighttpd/index.cgi, modules/compressor, modules/mk_pkg_receipt, modules/pkgdb: patch for the x86_64 native architecture support, fix empty depends, etc. diff -r 713fecc03454 -r be4a05be1a6f cook --- a/cook Sun Jan 14 17:12:15 2018 +0200 +++ b/cook Wed Jan 24 12:14:38 2018 +0200 @@ -303,14 +303,18 @@ # Display cooked package summary. summary() { + local arch='' + case "$ARCH" in + arm*|x86_64) arch="-$ARCH" ;; + esac + set_paths cd $WOK/$pkg [ -d $WOK/$pkg/install ] && prod=$(du -sh $WOK/$pkg/install | awk '{print $1}' 2>/dev/null) [ -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}') - _ 'Summary for: %s' "$PACKAGE $VERSION$EXTRAVERSION" - separator + title 'Summary for: %s' "$PACKAGE $VERSION$EXTRAVERSION$arch" # L10n: keep the same width of translations to get a consistent view [ -n "$TARBALL" ] && _ 'Src file : %s' "$TARBALL" @@ -319,7 +323,7 @@ [ -n "$prod" ] && _ 'Produced : %s' "$prod" _ 'Cook time : %s' "$(disp_time "$time")" _ 'Cook date : %s' "$(date "$(_ '+%%F %%R')")" - _ 'Host arch : %s' "$ARCH" + _ 'Target arch : %s' "$ARCH" separator - _ ' # : Packed : Compressed : Files : Package name' @@ -327,7 +331,7 @@ pkgi=1 for i in $(all_names); do fs=$(du -sh $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION | awk '{print $1}') - pkgname="$i-$VERSION$EXTRAVERSION.tazpkg" + pkgname="$i-$VERSION$EXTRAVERSION$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" @@ -559,6 +563,7 @@ set_paths # Handle cross-tools. + [ "$BUILD_SYSTEM" != "$HOST_SYSTEM" ] && case "$ARCH" in arm*|x86_64) # CROSS_COMPILE is used by at least Busybox and the kernel to set @@ -965,8 +970,8 @@ # 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 -zeT0 -vv >fs.cpio.lzma +# 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 @@ -1007,9 +1012,14 @@ # 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.tazpkg" + local pkg_file="$PKGS/$PACKAGE-$VERSION$EXTRAVERSION$arch.tazpkg" local rsum_file=$(mktemp) rsum_file_old=$(mktemp) tmpdir=$(mktemp -d) @@ -1083,11 +1093,11 @@ status fi # package changed, substitute old package by new one - mv -f $pkgdir/taz/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg $PKGS + 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.tazpkg + rm -f $pkgdir/taz/$PACKAGE-$VERSION$EXTRAVERSION$arch.tazpkg _ 'The release checksum has not changed.' fi @@ -1951,7 +1961,7 @@ esac # Some packages are not included in some arch or fail to cross compile. - : ${HOST_ARCH=i486} + : ${HOST_ARCH=$ARCH} debug "$(_ 'Host arch %s' "$HOST_ARCH")" # Handle arm{v6hf,v7,..} if ! $(echo "$HOST_ARCH" | egrep -q "${ARCH%v[0-9]*}|any"); then diff -r 713fecc03454 -r be4a05be1a6f lighttpd/index.cgi --- a/lighttpd/index.cgi Sun Jan 14 17:12:15 2018 +0200 +++ b/lighttpd/index.cgi Wed Jan 24 12:14:38 2018 +0200 @@ -924,8 +924,8 @@ 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 -Build system $BUILD_SYSTEM -Host system $HOST_SYSTEM +Host system $BUILD_SYSTEM +Target system $HOST_SYSTEM PackageVersionDescription $(toolchain_version slitaz-toolchain) $(toolchain_version binutils) diff -r 713fecc03454 -r be4a05be1a6f modules/compressor --- a/modules/compressor Sun Jan 14 17:12:15 2018 +0200 +++ b/modules/compressor Wed Jan 24 12:14:38 2018 +0200 @@ -68,7 +68,7 @@ "$(calc_time $1)" "$2" "$3" "$saving" "$cache_msg" if [ -s "$4" ]; then - _ 'Cleaner warnings and errors:' + _ 'Compressor warnings and errors:' awk '{printf " %s\n", $0;}' "$4" echo fi @@ -184,23 +184,27 @@ done # Recompress with advdef (it can't compress, only recompress) - cleaner_log="$(mktemp)" - IFS=$'\n' - for i in $(find $manpath -type f); do - if ! cached_path=$(query_cache mangz "$i"); then - cp -a "$i" "$i.orig$$" # save the original if something goes wrong - out="$(advdef -z4q "$i")" - if [ -n "$out" ]; then - echo "$i:"$'\n'"$out"$'\n' >> "$cleaner_log" - mv -f "$i.orig$$" "$i" # restore the original - else - store_cache "$cached_path" "$i" - rm -f "$i.orig$$" # clean + the_log="$(mktemp)" + if which advdef >/dev/null; then + IFS=$'\n' + for i in $(find $manpath -type f); do + if ! cached_path=$(query_cache mangz "$i"); then + cp -a "$i" "$i.orig$$" # save the original if something goes wrong + out="$(advdef -z4q "$i")" + if [ -n "$out" ]; then + echo "$i:"$'\n'"$out"$'\n' >> "$the_log" + mv -f "$i.orig$$" "$i" # restore the original + else + store_cache "$cached_path" "$i" + rm -f "$i.orig$$" # clean + fi fi - fi - done + done + else + echo 'Warning: advdef not found.' > "$the_log" + fi - comp_summary "$time0" "$size0" "$(sizes man)" "$cleaner_log" + comp_summary "$time0" "$size0" "$(sizes man)" "$the_log" } @@ -217,23 +221,27 @@ action 'Recompressing gzip files...' # Recompress with advdef - cleaner_log="$(mktemp)" - IFS=$'\n' - for i in $(find $install -type f -name '*.gz' ! -path '*/share/man/*'); do - if ! cached_path=$(query_cache gz "$i"); then - cp -a "$i" "$i.orig$$" # save the original if something goes wrong - out="$(advdef -z4q "$i")" - if [ -n "$out" ]; then - echo "$i:"$'\n'"$out"$'\n' >> "$cleaner_log" - mv -f "$i.orig$$" "$i" # restore the original - else - store_cache "$cached_path" "$i" - rm -f "$i.orig$$" # clean + the_log="$(mktemp)" + if which advdef >/dev/null; then + IFS=$'\n' + for i in $(find $install -type f -name '*.gz' ! -path '*/share/man/*'); do + if ! cached_path=$(query_cache gz "$i"); then + cp -a "$i" "$i.orig$$" # save the original if something goes wrong + out="$(advdef -z4q "$i")" + if [ -n "$out" ]; then + echo "$i:"$'\n'"$out"$'\n' >> "$the_log" + mv -f "$i.orig$$" "$i" # restore the original + else + store_cache "$cached_path" "$i" + rm -f "$i.orig$$" # clean + fi fi - fi - done + done + else + echo 'Warning: advdef not found.' > "$the_log" + fi - comp_summary "$time0" "$size0" "$(sizes gz)" "$cleaner_log" + comp_summary "$time0" "$size0" "$(sizes gz)" "$the_log" } @@ -250,23 +258,27 @@ action 'Recompressing zip files...' # Recompress with advzip - cleaner_log="$(mktemp)" - IFS=$'\n' - for i in $(find $install -type f -name '*.zip'); do - if ! cached_path=$(query_cache zip "$i"); then - cp -a "$i" "$i.orig$$" # save the original if something goes wrong - out="$(advzip -z3qk "$i")" # '-4' is more than two orders slower; use '-3' - if [ -n "$out" ]; then - echo "$i:"$'\n'"$out"$'\n' >> "$cleaner_log" - mv -f "$i.orig$$" "$i" # restore the original - else - store_cache "$cached_path" "$i" - rm -f "$i.orig$$" # clean + the_log="$(mktemp)" + if which advzip >/dev/null; then + IFS=$'\n' + for i in $(find $install -type f -name '*.zip'); do + if ! cached_path=$(query_cache zip "$i"); then + cp -a "$i" "$i.orig$$" # save the original if something goes wrong + out="$(advzip -z3qk "$i")" # '-4' is more than two orders slower; use '-3' + if [ -n "$out" ]; then + echo "$i:"$'\n'"$out"$'\n' >> "$the_log" + mv -f "$i.orig$$" "$i" # restore the original + else + store_cache "$cached_path" "$i" + rm -f "$i.orig$$" # clean + fi fi - fi - done + done + else + echo 'Warning: advzip not found.' > "$the_log" + fi - comp_summary "$time0" "$size0" "$(sizes zip)" "$cleaner_log" + comp_summary "$time0" "$size0" "$(sizes zip)" "$the_log" } @@ -287,6 +299,16 @@ action 'Compressing png images...' + the_log="$(mktemp)" + $use_pq && if ! which pngquant >/dev/null; then + echo 'Warning: pngquant not found.' > "$the_log" + use_pq=false + fi + $use_op && if ! which optipng >/dev/null; then + echo 'Warning: optipng not found.' >> "$the_log" + use_op=false + fi + oplevel=$(echo $COOKOPTS | grep 'op[0-8]' | sed 's|.*op\([0-8]\).*|\1|') [ -z "$oplevel" ] && oplevel='2' @@ -296,7 +318,6 @@ [ "$oplevel" == '8' ] && oplevel='7 -zm1-9' - cleaner_log="$(mktemp)" pq_opt='--skip-if-larger' # Sublime Text is mad about `if` in $(), so put it separately IFS=$'\n' for i in $(find $install -type f -name '*.png'); do @@ -306,14 +327,14 @@ if $use_pq; then out="$(pngquant -f $pq_opt --ext .png --speed 1 "$i" 2>&1)" if [ -n "$out" ]; then - echo "$i (pngquant):"$'\n'"$out"$'\n' >> "$cleaner_log" + echo "$i (pngquant):"$'\n'"$out"$'\n' >> "$the_log" iserror='yes' fi fi if $use_op && [ -z "$iserror" ]; then out="$(optipng -quiet -strip all -o$oplevel "$i" 2>&1)" if [ -n "$out" ]; then - echo "$i (optipng):"$'\n'"$out"$'\n' >> "$cleaner_log" + echo "$i (optipng):"$'\n'"$out"$'\n' >> "$the_log" iserror='yes' fi fi @@ -326,7 +347,7 @@ fi done - comp_summary "$time0" "$size0" "$(sizes png)" "$cleaner_log" + comp_summary "$time0" "$size0" "$(sizes png)" "$the_log" } @@ -342,17 +363,21 @@ action 'Compressing svg images...' - [ "${COOKOPTS/!svgextra/}" == "$COOKOPTS" ] && - opts="--apply-transform-to-paths yes --coordinates-precision 1 --paths-coordinates-precision 1" + if which svgcleaner >/dev/null; then + [ "${COOKOPTS/!svgextra/}" == "$COOKOPTS" ] && + opts="--apply-transform-to-paths yes --coordinates-precision 1 --paths-coordinates-precision 1" - cleaner_log="$(mktemp)" - for i in $(IFS=$'\n' find $install -type f -name '*.svg'); do - out="$(unset IFS; svgcleaner "$i" "$i" --copy-on-error --quiet \ - --multipass --remove-unresolved-classes no $opts 2>&1)" - [ -z "$out" ] || echo "$i:"$'\n'"$out"$'\n' >> "$cleaner_log" - done + the_log="$(mktemp)" + for i in $(IFS=$'\n' find $install -type f -name '*.svg'); do + out="$(unset IFS; svgcleaner "$i" "$i" --copy-on-error --quiet \ + --multipass --remove-unresolved-classes no $opts 2>&1)" + [ -z "$out" ] || echo "$i:"$'\n'"$out"$'\n' >> "$the_log" + done + else + echo 'Warning: svgcleaner not found.' > "$the_log" + fi - comp_summary "$time0" "$size0" "$(sizes svg)" "$cleaner_log" + comp_summary "$time0" "$size0" "$(sizes svg)" "$the_log" } @@ -368,21 +393,25 @@ action 'Compressing ui files...' - size0=$(sizes xml) - time0=$(get_time) - temp_ui="$(mktemp)" - cleaner_log="$(mktemp)" - IFS=$'\n' - for ui in $(find $install -type f \( -name '*.ui' -o -name '*.glade' \) ); do - out="$(xmlstarlet c14n --without-comments "$ui" | xmlstarlet sel -B -t -c '*' > "$temp_ui")" - if [ -n "$out" ]; then - echo "$ui:"$'\n'"$out"$'\n' >> "$cleaner_log" - else - cat "$temp_ui" > "$ui" - fi - done + if which xmlstarlet >/dev/null; then + size0=$(sizes xml) + time0=$(get_time) + temp_ui="$(mktemp)" + the_log="$(mktemp)" + IFS=$'\n' + for ui in $(find $install -type f \( -name '*.ui' -o -name '*.glade' \) ); do + out="$(xmlstarlet c14n --without-comments "$ui" | xmlstarlet sel -B -t -c '*' > "$temp_ui")" + if [ -n "$out" ]; then + echo "$ui:"$'\n'"$out"$'\n' >> "$the_log" + else + cat "$temp_ui" > "$ui" + fi + done + else + echo 'Warning: xmlstarlet not found.' > "$the_log" + fi - comp_summary "$time0" "$size0" "$(sizes xml)" "$cleaner_log" + comp_summary "$time0" "$size0" "$(sizes xml)" "$the_log" rm "$temp_ui" } @@ -454,7 +483,11 @@ # Check the rest of errors, warnings and tips _ 'QA: Checking %s...' "$(basename $desktop)" busybox diff "$desktop.orig" "$desktop" | sed 's!^!|!' - desktop-file-validate "$desktop" | busybox fold -s + if which xmlstarlet >/dev/null; then + desktop-file-validate "$desktop" | busybox fold -s + else + echo 'Warning: desktop-file-validate not found.' + fi echo fi @@ -480,12 +513,21 @@ action 'Normalizing mo files...' + the_log="$(mktemp)" + to_continue=true + for i in msgunfmt msguniq msgconv msgfmt; do + if ! which $i >/dev/null; then + echo "Warning: $i not found. Normalizing aborted" > "$the_log" + to_continue=false + fi + done + size0=$(sizes mo1) time0=$(get_time) # Process all existing *.mo files - cleaner_log="$(mktemp)" IFS=$'\n' + $to_continue && for mo in $(find "$install" -type f -name '*.mo'); do tmpfile="$(mktemp)" @@ -494,7 +536,7 @@ if [ -n "$out" ]; then # using literal $'\n' here instead of using `echo -e "...\n..."` because # $out may contain escapes ('\r', '\v') that we should print as-is - echo "$mo:"$'\n'"$out"$'\n' >> "$cleaner_log" + echo "$mo:"$'\n'"$out"$'\n' >> "$the_log" continue # proceed to next file fi @@ -588,15 +630,15 @@ out="$(msgfmt "$tmpfile.awk" -o "$tmpfile.mo" 2>&1)" if [ -n "$out" ]; then - echo "$mo (msgfmt):"$'\n'"$out"$'\n' >> "$cleaner_log" + echo "$mo (msgfmt):"$'\n'"$out"$'\n' >> "$the_log" continue # proceed to next file fi if [ -s "$tmpfile.mo" ]; then rm "$mo"; mv "$tmpfile.mo" "$mo" else - _ 'Error processing %s' "$mo" >> "$cleaner_log" - echo >> "$cleaner_log" + _ 'Error processing %s' "$mo" >> "$the_log" + echo >> "$the_log" [ -e "$tmpfile.mo" ] && rm "$tmpfile.mo" fi @@ -604,7 +646,7 @@ rm "$tmpfile" "$tmpfile.pf" "$tmpfile.awk" done - comp_summary "$time0" "$size0" "$(sizes mo1)" "$cleaner_log" + comp_summary "$time0" "$size0" "$(sizes mo1)" "$the_log" } @@ -661,11 +703,12 @@ # Nullify timestamps of files in ar archives # Skip empty 8-byte archives (hi, musl-libc package) + # Using ar from binutils (ar from Busybox isn't enough) as ${TOOLPREFIX}ar whereami=$(pwd) find $fs -name '*.a' -type f -size +8c | \ while read i; do tempdir=$(mktemp -d); cd $tempdir - ar -x $i; ar -crD $(basename $i) * + ${TOOLPREFIX}ar -x $i; ${TOOLPREFIX}ar -crD $(basename $i) * mv -f $tempdir/$(basename $i) $i rm -rf $tempdir done diff -r 713fecc03454 -r be4a05be1a6f modules/mk_pkg_receipt --- a/modules/mk_pkg_receipt Sun Jan 14 17:12:15 2018 +0200 +++ b/modules/mk_pkg_receipt Wed Jan 24 12:14:38 2018 +0200 @@ -12,6 +12,23 @@ 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.' @@ -78,7 +95,10 @@ # Optional variables [ -n "$TAGS" ] && echo "TAGS=\"$TAGS\"" | tr -ds '\t' ' ' -[ -n "${DEPENDS# }" ] && echo "DEPENDS=\"$DEPENDS\"" | tr -ds '\t' ' ' +case "x$DEPENDS" in + x|x@EMPTY@) ;; + *) echo "DEPENDS=\"$DEPENDS\"" | tr -ds '\t' ' ';; +esac [ -n "$PROVIDE" ] && echo "PROVIDE=\"$PROVIDE\"" | tr -ds '\t' ' ' [ -n "$CONFIG_FILES" ] && echo "CONFIG_FILES=\"$CONFIG_FILES\"" | tr -ds '\t' ' ' [ -n "$SUGGESTED" ] && echo "SUGGESTED=\"$SUGGESTED\"" | tr -ds '\t' ' ' diff -r 713fecc03454 -r be4a05be1a6f modules/pkgdb --- a/modules/pkgdb Sun Jan 14 17:12:15 2018 +0200 +++ b/modules/pkgdb Wed Jan 24 12:14:38 2018 +0200 @@ -51,6 +51,11 @@ flavors="$SLITAZ/flavors" live="$SLITAZ/live" +arch='' +case "$ARCH" in + arm*|x86_64) arch="-$ARCH" ;; +esac + echo 'cook:pkgdb' > $command _ 'Cook pkgdb: Creating all packages lists' | log newline; { _ 'Creating lists for "%s"' "$PKGS"; separator; } | dblog @@ -116,8 +121,7 @@ unset_receipt . ./$pack/receipt - if [ -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg" -o \ - -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION-$ARCH.tazpkg" ]; then + if [ -f "$PKGS/$PACKAGE-$VERSION$EXTRAVERSION$arch.tazpkg" ]; then # packages.desc lets us search easily in DB cat >> $PKGS/packages.desc <> $PKGS/files.list # list of unnecessary packages - sed -i "/ $PACKAGE-$VERSION$EXTRAVERSION.tazpkg/d" $PKGS/packages.toremove + sed -i "/ $PACKAGE-$VERSION$EXTRAVERSION$arch.tazpkg/d" $PKGS/packages.toremove else # if receipt variable HOST_ARCH absent/empty or contains ARCH if [ -z "$HOST_ARCH" -o "${HOST_ARCH/$ARCH/}" != "$HOST_ARCH" ]; then @@ -209,13 +213,15 @@ _n 'Creating file "%s"' 'files.list.lzma' | dblog touch files.list # pkgs.slitaz.org strongly depends on list sorted by packages names -lzma e files.list files.list.lzma +#lzma e files.list files.list.lzma +/bin/lzma -zeqcT0 files.list > files.list.lzma echo " ($(filesize $PKGS/files.list.lzma))" | dblog # Pre-sorting filenames causes 10% smaller resulting lzma file _n 'Creating file "%s"' 'files-list.lzma' | dblog cat files.list | sort -k2 -o files.list.sorted -lzma e files.list.sorted files-list.lzma +#lzma e files.list.sorted files-list.lzma +/bin/lzma -zeqcT0 files.list.sorted > files-list.lzma rm -f files.list files.list.sorted echo " ($(filesize $PKGS/files-list.lzma))" | dblog @@ -235,10 +241,11 @@ wget -q -O extra.list http://mirror1.slitaz.org/packages/get.list echo -n '.' | dblog; sleep 5 done -busybox tar -chaf bundle.tar.lzma \ +busybox tar -chf bundle.tar \ mirrors extra.list files-list.md5 packages.info descriptions.txt \ packages.desc packages.md5 packages.txt packages.list packages.equiv -rm ./mirrors +/bin/lzma -zeqcT0 bundle.tar > bundle.tar.lzma +rm ./bundle.tar ./mirrors echo " ($(filesize $PKGS/bundle.tar.lzma))" | dblog # Display some info.