# HG changeset patch # User Aleksej Bobylev # Date 1548763955 -7200 # Node ID 3c6c68093522099c69cd518392d649c29199c77f # Parent a5e73bdcc218dcc47e19e49c34cc9fb86459e57c Small improvements and fixes: 1. cook: summary(): skip unpackaged packages (when use CATEGORY="nopack"); 2. modules/compressor: a) move strip_package from "fs" to "install" stage - from this moment files in $install and $fs are identical (of course, if you use genpkg_rules() only for copying) - we may clean taz/*/fs/ in the future; b) remove "empty" *.mo; c) skip silly error messages when $install or $fs absent; 3. modules/pack: a) move symlinks *.so to the @dev; b) small improvements; 4. doc/cookopts.txt: small update; diff -r a5e73bdcc218 -r 3c6c68093522 cook --- a/cook Fri Jan 18 11:07:18 2019 +0200 +++ b/cook Tue Jan 29 14:12:35 2019 +0200 @@ -365,6 +365,7 @@ fs=$(du -sh $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION | awk '{print $1}') arch=$(awk -F$'\t' -vi="$i" '{if ($1 == i) print $2}' $pkgdir/.arch) pkgname="$i-$version-$arch.tazpkg" + [ -f "$PKGS/$pkgname" ] || continue 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" diff -r a5e73bdcc218 -r 3c6c68093522 doc/cookopts.txt --- a/doc/cookopts.txt Fri Jan 18 11:07:18 2019 +0200 +++ b/doc/cookopts.txt Tue Jan 29 14:12:35 2019 +0200 @@ -39,8 +39,8 @@ The presence of this option overrides the default action (all existing *.mo files will remain). Please note, you can add all the translations to the package, for example, - using the command: `cook_copy_files *.mo` (then by default only the - supported locales will be left). + using the command: `copy *.mo` (then by default only the supported locales + will be left). !extradesktops Default action is to remove extra information from the desktop files: diff -r a5e73bdcc218 -r 3c6c68093522 modules/compressor --- a/modules/compressor Fri Jan 18 11:07:18 2019 +0200 +++ b/modules/compressor Tue Jan 29 14:12:35 2019 +0200 @@ -82,7 +82,7 @@ find_elf() { local i ifs="$IFS" IFS=$'\n' - find $fs -type f \ + find $install -type f \ | while read i; do # output of `readelf -h is human-readable information, # we are interested in the next line: @@ -119,7 +119,7 @@ { find_elf EXEC find_elf DYN - find $fs -type f \( -name '*.a' -o -name '*.pyc' -o -name '*.pyo' \ + find $install -type f \( -name '*.a' -o -name '*.pyc' -o -name '*.pyo' \ -o -name '.packlist' -o -name '*.pm' -o -name '*.pl' -o -name '*.pod' \) } \ | tr '\n' '\0' \ @@ -699,9 +699,22 @@ } ' "$tmpfile" > "$tmpfile.awk" + # 64 bytes is the length of prologue added by awk script (here ~ is $'\n'): + # msgid ""~msgstr ""~"Content-Type: text/plain; charset=UTF-8\n"~~ + # If size is 64 bit then file have no content, we'll remove it with + # all empty uplevel directories. + # For example, look at libbytesize package. + if [ "$(stat -c%s "$tmpfile.awk")" -eq 64 ]; then + _ 'Info: %s become empty' "$mo" >> "$the_log" + rm "$mo" "$tmpfile" "$tmpfile.pf" "$tmpfile.awk" + rmdir --parents --ignore-fail-on-non-empty "$(dirname "$mo")" + continue # proceed to next file + fi + out="$(msgfmt "$tmpfile.awk" -o "$tmpfile.mo" 2>&1)" if [ -n "$out" ]; then echo "$mo (msgfmt):"$'\n'"$out"$'\n' >> "$the_log" + rm "$tmpfile" "$tmpfile.pf" "$tmpfile.awk" continue # proceed to next file fi @@ -789,25 +802,25 @@ # Strip static libraries # See also: https://wiki.debian.org/ReproducibleBuilds/TimestampsInStaticLibraries - find $fs -name '*.a' -exec $STRIP -pdD '{}' 2>/dev/null \; + find $install -name '*.a' -exec $STRIP -pdD '{}' 2>/dev/null \; # Remove Python *.pyc and *.pyo - find $fs -type f \( -name '*.pyc' -o -name '*.pyo' \) -delete 2>/dev/null + find $install -type f \( -name '*.pyc' -o -name '*.pyo' \) -delete 2>/dev/null # Remove both with the empty subfolders: # 1. Perl perllocal.pod and .packlist (unconditionally) - local perlfiles="$(find $fs -type f \( -name 'perllocal.pod' -o -name '.packlist' \))" + local perlfiles="$(find $install -type f \( -name 'perllocal.pod' -o -name '.packlist' \))" # 2. Perl *.pod (if not disabled) [ "${COOKOPTS/!rmpod/}" == "$COOKOPTS" ] && - perlfiles="$perlfiles"$'\n'"$(find $fs -type f -name '*.pod')" + perlfiles="$perlfiles"$'\n'"$(find $install -type f -name '*.pod')" echo "$perlfiles" | sort -u | xargs rm -f 2>/dev/null echo "$perlfiles" | sort -u | awk 'BEGIN{FS=OFS="/"}{$NF="";print}' \ | xargs rmdir -p --ignore-fail-on-non-empty 2>/dev/null # Strip documentation inside Perl files (*.pm and *.pl) (if not disabled) [ "${COOKOPTS/!perlz/}" == "$COOKOPTS" ] && - find $fs -type f \( -name '*.pm' -o -name '*.pl' \) -exec sed -i '/^=/,/^=cut/d' '{}' \; + find $install -type f \( -name '*.pm' -o -name '*.pl' \) -exec sed -i '/^=/,/^=cut/d' '{}' \; newsize=$(sizes strip) @@ -857,9 +870,11 @@ case $1 in install) # Compressors working in the $install + [ -d "$install" ] || return case "$ARCH" in arm*) ;; *) + strip_package recompress_gz recompress_zip compress_manpages @@ -877,7 +892,7 @@ ;; fs) # Compressors working in the $fs - strip_package + [ -d "$fs" ] || return strip_mo_i18n ;; esac diff -r a5e73bdcc218 -r 3c6c68093522 modules/pack --- a/modules/pack Fri Jan 18 11:07:18 2019 +0200 +++ b/modules/pack Tue Jan 29 14:12:35 2019 +0200 @@ -65,8 +65,9 @@ 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 + # $basepkg is the name of the main package; + # $thispkg is the name of the current one. + # $basepkg may (or may not) be included in the $SPLIT neighbors=$( echo $basepkg $SPLIT" " \ | awk -F$'\t' -vpkg="$thispkg" ' @@ -115,12 +116,23 @@ copy() { action 'Copying folders and files...' - local i j k filelist=$(mktemp) folderlist=$(mktemp) + if [ ! -d "$install" ]; then + false; status + die 'ERROR: copy from the empty $install' + fi + + local i j k + local tmp=$(mktemp -d) filelist=$tmp/f folderlist=$tmp/d solist=$tmp/s + local copylist=$tmp/c IFS=$'\n' cd $install - find ! -type d | sed 's|\.||' > $filelist - find -type d | sed 's|\.||' > $folderlist + # filelist: all files and symlinks excluding *.so symlinks + find \( -type f -o \( -type l ! -name '*.so' \) \) | sed 's|\.||' >$filelist + # solist: *.so symlinks only + find -type l -name '*.so' | sed 's|\.||' >$solist + # folderlist: folders + find -type d | sed 's|\.||' >$folderlist for i in $@; do case $i in @@ -149,6 +161,7 @@ /\/Makefile.*/p; /\.inc$/p; /\/include\//p; /\.so\.dbg$/p; ' $filelist + cat $solist # append copy list by *.so symlinks ;; @ruby) # Copy mandatory Ruby files @@ -195,8 +208,8 @@ @std) while read j; do case $j in - # skip empty man & doc folders - */man/*|*/doc/*) continue;; + # skip empty man, doc and locale folders + */man/*|*/doc/*|*/share/locale/*) continue;; esac [ -z "$(ls -A "$install$j")" ] || continue # directory $j is empty @@ -227,7 +240,7 @@ done cd - >/dev/null unset IFS - rm $filelist $folderlist + rm -r $tmp # clean status }