cookutils rev 1135
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;
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;
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Jan 29 14:12:35 2019 +0200 (2019-01-29) |
parents | a5e73bdcc218 |
children | 4f2ea8b43594 |
files | cook doc/cookopts.txt modules/compressor modules/pack |
line diff
1.1 --- a/cook Fri Jan 18 11:07:18 2019 +0200 1.2 +++ b/cook Tue Jan 29 14:12:35 2019 +0200 1.3 @@ -365,6 +365,7 @@ 1.4 fs=$(du -sh $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION | awk '{print $1}') 1.5 arch=$(awk -F$'\t' -vi="$i" '{if ($1 == i) print $2}' $pkgdir/.arch) 1.6 pkgname="$i-$version-$arch.tazpkg" 1.7 + [ -f "$PKGS/$pkgname" ] || continue 1.8 size=$(ls -lh $PKGS/$pkgname | awk '{print $5}') 1.9 files=$(wc -l < $WOK/$pkg/taz/$i-$VERSION$EXTRAVERSION/files.list) 1.10 printf "%2d : %7s : %10s : %5s : %s\n" "$pkgi" "$fs" "$size" "$files" "$pkgname"
2.1 --- a/doc/cookopts.txt Fri Jan 18 11:07:18 2019 +0200 2.2 +++ b/doc/cookopts.txt Tue Jan 29 14:12:35 2019 +0200 2.3 @@ -39,8 +39,8 @@ 2.4 The presence of this option overrides the default action (all existing *.mo 2.5 files will remain). 2.6 Please note, you can add all the translations to the package, for example, 2.7 - using the command: `cook_copy_files *.mo` (then by default only the 2.8 - supported locales will be left). 2.9 + using the command: `copy *.mo` (then by default only the supported locales 2.10 + will be left). 2.11 2.12 !extradesktops 2.13 Default action is to remove extra information from the desktop files:
3.1 --- a/modules/compressor Fri Jan 18 11:07:18 2019 +0200 3.2 +++ b/modules/compressor Tue Jan 29 14:12:35 2019 +0200 3.3 @@ -82,7 +82,7 @@ 3.4 find_elf() { 3.5 local i ifs="$IFS" 3.6 IFS=$'\n' 3.7 - find $fs -type f \ 3.8 + find $install -type f \ 3.9 | while read i; do 3.10 # output of `readelf -h <file> is human-readable information, 3.11 # we are interested in the next line: 3.12 @@ -119,7 +119,7 @@ 3.13 { 3.14 find_elf EXEC 3.15 find_elf DYN 3.16 - find $fs -type f \( -name '*.a' -o -name '*.pyc' -o -name '*.pyo' \ 3.17 + find $install -type f \( -name '*.a' -o -name '*.pyc' -o -name '*.pyo' \ 3.18 -o -name '.packlist' -o -name '*.pm' -o -name '*.pl' -o -name '*.pod' \) 3.19 } \ 3.20 | tr '\n' '\0' \ 3.21 @@ -699,9 +699,22 @@ 3.22 } 3.23 ' "$tmpfile" > "$tmpfile.awk" 3.24 3.25 + # 64 bytes is the length of prologue added by awk script (here ~ is $'\n'): 3.26 + # msgid ""~msgstr ""~"Content-Type: text/plain; charset=UTF-8\n"~~ 3.27 + # If size is 64 bit then file have no content, we'll remove it with 3.28 + # all empty uplevel directories. 3.29 + # For example, look at libbytesize package. 3.30 + if [ "$(stat -c%s "$tmpfile.awk")" -eq 64 ]; then 3.31 + _ 'Info: %s become empty' "$mo" >> "$the_log" 3.32 + rm "$mo" "$tmpfile" "$tmpfile.pf" "$tmpfile.awk" 3.33 + rmdir --parents --ignore-fail-on-non-empty "$(dirname "$mo")" 3.34 + continue # proceed to next file 3.35 + fi 3.36 + 3.37 out="$(msgfmt "$tmpfile.awk" -o "$tmpfile.mo" 2>&1)" 3.38 if [ -n "$out" ]; then 3.39 echo "$mo (msgfmt):"$'\n'"$out"$'\n' >> "$the_log" 3.40 + rm "$tmpfile" "$tmpfile.pf" "$tmpfile.awk" 3.41 continue # proceed to next file 3.42 fi 3.43 3.44 @@ -789,25 +802,25 @@ 3.45 3.46 # Strip static libraries 3.47 # See also: https://wiki.debian.org/ReproducibleBuilds/TimestampsInStaticLibraries 3.48 - find $fs -name '*.a' -exec $STRIP -pdD '{}' 2>/dev/null \; 3.49 + find $install -name '*.a' -exec $STRIP -pdD '{}' 2>/dev/null \; 3.50 3.51 3.52 # Remove Python *.pyc and *.pyo 3.53 - find $fs -type f \( -name '*.pyc' -o -name '*.pyo' \) -delete 2>/dev/null 3.54 + find $install -type f \( -name '*.pyc' -o -name '*.pyo' \) -delete 2>/dev/null 3.55 3.56 # Remove both with the empty subfolders: 3.57 # 1. Perl perllocal.pod and .packlist (unconditionally) 3.58 - local perlfiles="$(find $fs -type f \( -name 'perllocal.pod' -o -name '.packlist' \))" 3.59 + local perlfiles="$(find $install -type f \( -name 'perllocal.pod' -o -name '.packlist' \))" 3.60 # 2. Perl *.pod (if not disabled) 3.61 [ "${COOKOPTS/!rmpod/}" == "$COOKOPTS" ] && 3.62 - perlfiles="$perlfiles"$'\n'"$(find $fs -type f -name '*.pod')" 3.63 + perlfiles="$perlfiles"$'\n'"$(find $install -type f -name '*.pod')" 3.64 echo "$perlfiles" | sort -u | xargs rm -f 2>/dev/null 3.65 echo "$perlfiles" | sort -u | awk 'BEGIN{FS=OFS="/"}{$NF="";print}' \ 3.66 | xargs rmdir -p --ignore-fail-on-non-empty 2>/dev/null 3.67 3.68 # Strip documentation inside Perl files (*.pm and *.pl) (if not disabled) 3.69 [ "${COOKOPTS/!perlz/}" == "$COOKOPTS" ] && 3.70 - find $fs -type f \( -name '*.pm' -o -name '*.pl' \) -exec sed -i '/^=/,/^=cut/d' '{}' \; 3.71 + find $install -type f \( -name '*.pm' -o -name '*.pl' \) -exec sed -i '/^=/,/^=cut/d' '{}' \; 3.72 3.73 newsize=$(sizes strip) 3.74 3.75 @@ -857,9 +870,11 @@ 3.76 case $1 in 3.77 install) 3.78 # Compressors working in the $install 3.79 + [ -d "$install" ] || return 3.80 case "$ARCH" in 3.81 arm*) ;; 3.82 *) 3.83 + strip_package 3.84 recompress_gz 3.85 recompress_zip 3.86 compress_manpages 3.87 @@ -877,7 +892,7 @@ 3.88 ;; 3.89 fs) 3.90 # Compressors working in the $fs 3.91 - strip_package 3.92 + [ -d "$fs" ] || return 3.93 strip_mo_i18n 3.94 ;; 3.95 esac
4.1 --- a/modules/pack Fri Jan 18 11:07:18 2019 +0200 4.2 +++ b/modules/pack Tue Jan 29 14:12:35 2019 +0200 4.3 @@ -65,8 +65,9 @@ 4.4 4.5 remove_already_packed() { 4.6 local i j 4.7 - # $pkg is the name of the main package; $PACKAGE is the name of the current one 4.8 - # $pkg may (or may not) be included in the $SPLIT 4.9 + # $basepkg is the name of the main package; 4.10 + # $thispkg is the name of the current one. 4.11 + # $basepkg may (or may not) be included in the $SPLIT 4.12 neighbors=$( 4.13 echo $basepkg $SPLIT" " \ 4.14 | awk -F$'\t' -vpkg="$thispkg" ' 4.15 @@ -115,12 +116,23 @@ 4.16 4.17 copy() { 4.18 action 'Copying folders and files...' 4.19 - local i j k filelist=$(mktemp) folderlist=$(mktemp) 4.20 + if [ ! -d "$install" ]; then 4.21 + false; status 4.22 + die 'ERROR: copy from the empty $install' 4.23 + fi 4.24 + 4.25 + local i j k 4.26 + local tmp=$(mktemp -d) filelist=$tmp/f folderlist=$tmp/d solist=$tmp/s 4.27 + local copylist=$tmp/c 4.28 4.29 IFS=$'\n' 4.30 cd $install 4.31 - find ! -type d | sed 's|\.||' > $filelist 4.32 - find -type d | sed 's|\.||' > $folderlist 4.33 + # filelist: all files and symlinks excluding *.so symlinks 4.34 + find \( -type f -o \( -type l ! -name '*.so' \) \) | sed 's|\.||' >$filelist 4.35 + # solist: *.so symlinks only 4.36 + find -type l -name '*.so' | sed 's|\.||' >$solist 4.37 + # folderlist: folders 4.38 + find -type d | sed 's|\.||' >$folderlist 4.39 4.40 for i in $@; do 4.41 case $i in 4.42 @@ -149,6 +161,7 @@ 4.43 /\/Makefile.*/p; /\.inc$/p; /\/include\//p; 4.44 /\.so\.dbg$/p; 4.45 ' $filelist 4.46 + cat $solist # append copy list by *.so symlinks 4.47 ;; 4.48 @ruby) 4.49 # Copy mandatory Ruby files 4.50 @@ -195,8 +208,8 @@ 4.51 @std) 4.52 while read j; do 4.53 case $j in 4.54 - # skip empty man & doc folders 4.55 - */man/*|*/doc/*) continue;; 4.56 + # skip empty man, doc and locale folders 4.57 + */man/*|*/doc/*|*/share/locale/*) continue;; 4.58 esac 4.59 [ -z "$(ls -A "$install$j")" ] || continue 4.60 # directory $j is empty 4.61 @@ -227,7 +240,7 @@ 4.62 done 4.63 cd - >/dev/null 4.64 unset IFS 4.65 - rm $filelist $folderlist 4.66 + rm -r $tmp # clean 4.67 status 4.68 } 4.69