cookutils rev 770

fix-desktop-file: not remove Comment[locale] unconditionally when Name[locale] == Name
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Nov 07 17:06:25 2015 +0200 (2015-11-07)
parents 5afd5252a5e7
children 79b706ec6fde
files cook fix-desktop-file
line diff
     1.1 --- a/cook	Sat Nov 07 16:00:41 2015 +0200
     1.2 +++ b/cook	Sat Nov 07 17:06:25 2015 +0200
     1.3 @@ -485,11 +485,11 @@
     1.4  	fi
     1.5  
     1.6  	for desktop in $(find $install/usr/share/applications -name '*.desktop'); do
     1.7 +		cp "$desktop" "$desktop.orig"
     1.8 +
     1.9  		# Sort out .desktop file (is prerequisite to correct working of `fix-desktop-file`)
    1.10  		sdft "$desktop" -i
    1.11  
    1.12 -		cp "$desktop" "$desktop.orig"
    1.13 -
    1.14  		# Fix common errors in .desktop file
    1.15  		fix-desktop-file "$desktop"
    1.16  
     2.1 --- a/fix-desktop-file	Sat Nov 07 16:00:41 2015 +0200
     2.2 +++ b/fix-desktop-file	Sat Nov 07 17:06:25 2015 +0200
     2.3 @@ -74,12 +74,6 @@
     2.4  		if (Name) next;  # Name already printed
     2.5  		Name = gensub(/^[^=]+=[[:space:]]*/, "", "");
     2.6  		print;
     2.7 -		for (i in name) {
     2.8 -			if (name[i] &&
     2.9 -			    name[i] != Name) {  # skip redundant
    2.10 -				printf "Name[%s]=%s\n", i, name[i];
    2.11 -			}
    2.12 -		}
    2.13  		next;
    2.14  	}
    2.15  
    2.16 @@ -91,12 +85,8 @@
    2.17  		name[locale] = value;
    2.18  		if (Name &&
    2.19  		    Name != value) {  # skip redundant
    2.20 -			name[locale] = value;
    2.21  			print;
    2.22  		}
    2.23 -		if (comment[locale] &&  # print pending Comment[xx]
    2.24 -		    tolower(comment[locale]) != tolower(name[locale]))
    2.25 -			printf "Comment[%s]=%s\n", locale, comment[locale];
    2.26  		next;
    2.27  	}
    2.28  
    2.29 @@ -109,13 +99,6 @@
    2.30  		} else {
    2.31  			print;
    2.32  		}
    2.33 -		for (i in comment) {
    2.34 -			if (comment[i] &&
    2.35 -			    tolower(comment[i]) != tolower(Comment) &&
    2.36 -			    tolower(comment[i]) != tolower(name[i])) {  # skip redundant
    2.37 -				printf "Comment[%s]=%s\n", i, comment[i];
    2.38 -			}
    2.39 -		}
    2.40  		next;
    2.41  	}
    2.42  
    2.43 @@ -125,9 +108,7 @@
    2.44  		locomm = gensub(/^[^=]*=[[:space:]]*(.*)$/, "\\1", "");
    2.45  		if (comment[locale]) next;  # Comment[locale] already printed
    2.46  		comment[locale] = locomm;
    2.47 -		if (Comment &&  # pending until Comment appear
    2.48 -		    name[locale] &&  # pending until Name[xx] appear
    2.49 -		    tolower(locomm) != tolower(Comment) &&
    2.50 +		if (tolower(locomm) != tolower(Comment) &&
    2.51  		    tolower(locomm) != tolower(name[locale])) {  # skip redundant
    2.52  			comment[locale] = locomm;
    2.53  			print;