cookutils rev 876

modules/compressor: allow spaces in filenames; fix_desktop_files() only in /usr/share/applications.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Feb 16 02:18:58 2017 +0200 (2017-02-16)
parents 230109645bba
children cbc219088d08
files modules/compressor modules/pkgdb
line diff
     1.1 --- a/modules/compressor	Mon Feb 13 10:01:50 2017 +0100
     1.2 +++ b/modules/compressor	Thu Feb 16 02:18:58 2017 +0200
     1.3 @@ -135,6 +135,7 @@
     1.4  	done
     1.5  
     1.6  	# Recompress with advdef (it can't compress, only recompress)
     1.7 +	IFS=$'\n'
     1.8  	for i in $(find $manpath -type f); do
     1.9  		if ! cached_path=$(query_cache mangz "$i"); then
    1.10  			advdef -z4q "$i"
    1.11 @@ -159,6 +160,7 @@
    1.12  	action 'Recompressing gzip files...'
    1.13  
    1.14  	# Recompress with advdef
    1.15 +	IFS=$'\n'
    1.16  	for i in $(find $install -type f -name '*.gz' ! -path '*/share/man/*'); do
    1.17  		if ! cached_path=$(query_cache gz "$i"); then
    1.18  			advdef -z4q "$i"
    1.19 @@ -196,6 +198,7 @@
    1.20  
    1.21  	[ "$oplevel" == '8' ] && oplevel='7 -zm1-9'
    1.22  
    1.23 +	IFS=$'\n'
    1.24  	for i in $(find $install -type f -name '*.png'); do
    1.25  		if ! cached_path=$(query_cache $cache_section "$i"); then
    1.26  			$use_pq && pngquant -f --skip-if-larger --ext .png --speed 1 "$i"
    1.27 @@ -221,6 +224,7 @@
    1.28  	action 'Compressing svg images...'
    1.29  
    1.30  	cleaner_log="$(mktemp)"
    1.31 +	IFS=$'\n'
    1.32  	for i in $(find $install -type f -name '*.svg'); do
    1.33  		echo -n "$i: " >> "$cleaner_log"
    1.34  		svgcleaner "$i" "$i" --remove-unresolved-classes false --quiet true >> "$cleaner_log"
    1.35 @@ -253,6 +257,7 @@
    1.36  	size0=$(sizes xml)
    1.37  	time0=$(date +%s)
    1.38  	temp_ui="$(mktemp)"
    1.39 +	IFS=$'\n'
    1.40  	for ui in $(find $install -type f \( -name '*.ui' -o -name '*.glade' \) ); do
    1.41  		xmlstarlet c14n --without-comments "$ui" | xmlstarlet sel -B -t -c '*' > "$temp_ui"
    1.42  		cat "$temp_ui" > "$ui"
    1.43 @@ -292,7 +297,9 @@
    1.44  
    1.45  fix_desktop_files() {
    1.46  	[ "${COOKOPTS/!fixdesktops/}" != "$COOKOPTS" ] && return
    1.47 -	[ -z "$(find $install -type f -name '*.desktop')" ] && return
    1.48 +	deskpath="$install/usr/share/applications"
    1.49 +	[ -d "$deskpath" ] || return
    1.50 +	[ -z "$(find $deskpath -type f -name '*.desktop')" ] && return
    1.51  
    1.52  	size0=$(sizes des)
    1.53  	time0=$(date +%s)
    1.54 @@ -306,7 +313,8 @@
    1.55  	# list of supported locales here.
    1.56  	[ -z "$LOCALE" ] && LOCALE=$(get_supported_locales)
    1.57  
    1.58 -	for desktop in $(find $install -type f -name '*.desktop'); do
    1.59 +	IFS=$'\n'
    1.60 +	for desktop in $(find $deskpath -type f -name '*.desktop'); do
    1.61  		cp "$desktop" "$desktop.orig"
    1.62  
    1.63  		# Sort out .desktop file (is prerequisite to correct working of `fix-desktop-file`)
    1.64 @@ -357,6 +365,7 @@
    1.65  	time0=$(date +%s)
    1.66  
    1.67  	# Process all existing *.mo files
    1.68 +	IFS=$'\n'
    1.69  	for mo in $(find "$install" -type f -name '*.mo'); do
    1.70  		tmpfile="$(mktemp)"
    1.71  
     2.1 --- a/modules/pkgdb	Mon Feb 13 10:01:50 2017 +0100
     2.2 +++ b/modules/pkgdb	Thu Feb 16 02:18:58 2017 +0200
     2.3 @@ -252,9 +252,10 @@
     2.4  cp -f $live/*.flavor $live/flavors.list $PKGS
     2.5  separator | dblog
     2.6  { _ 'Total flavors size: %s' "$(du -sh $live | awk '{print $1}')"; newline; } | dblog
     2.7 -rm -f $command
     2.8  separator | dblog
     2.9  _ 'Cook pkgdb end: %s' "$(date "$(_ '+%%F %%R')")" | dblog
    2.10  
    2.11 +> $command
    2.12 +
    2.13  
    2.14  exit 0