Browse Source

Performance optimization of kde-tde conversion scripts

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
pull/1/head
Slávek Banko 3 years ago
parent
commit
95b74a657c

+ 11
- 9
kde-tde/convert_existing_kde3_app_to_tde View File

@@ -501,15 +501,17 @@ xargs -r0 sed -ri \
501 501
  -e "s|kde toolbar widget|tde toolbar widget|g"
502 502
 
503 503
 # Convert desktop files
504
-find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i '/^Keyword/ { s,\,,;,g }' {} \;
505
-find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i 's/^ServiceTypes=/X-TDE-ServiceTypes=/g' {} \;
506
-find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i 's/^ServiceTypes\[\(.*\)\]=/X-TDE-ServiceTypes\[\1\]=/g' {} \;
507
-find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i 's/^ExcludeServiceTypes=/X-TDE-ExcludeServiceTypes=/g' {} \;
508
-find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i 's/^ExcludeServiceTypes\[\(.*\)\]=/X-TDE-ExcludeServiceTypes\[\1\]=/g' {} \;
509
-find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i 's/^DocPath=/X-DocPath=/g' {} \;
510
-find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i 's/^DocPath\[\(.*\)\]=/X-DocPath\[\1\]=/g' {} \;
511
-find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i 's/^InitialPreference=/X-TDE-InitialPreference=/g' {} \;
512
-find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i 's/^InitialPreference\[\(.*\)\]=/X-TDE-InitialPreference\[\1\]=/g' {} \;
504
+find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -print0 | \
505
+xargs -r0 sed -i \
506
+    -e '/^Keyword/ { s,\,,;,g }' \
507
+    -e 's/^ServiceTypes=/X-TDE-ServiceTypes=/g' \
508
+    -e 's/^ServiceTypes\[\(.*\)\]=/X-TDE-ServiceTypes\[\1\]=/g' \
509
+    -e 's/^ExcludeServiceTypes=/X-TDE-ExcludeServiceTypes=/g' \
510
+    -e 's/^ExcludeServiceTypes\[\(.*\)\]=/X-TDE-ExcludeServiceTypes\[\1\]=/g' \
511
+    -e 's/^DocPath=/X-DocPath=/g' \
512
+    -e 's/^DocPath\[\(.*\)\]=/X-DocPath\[\1\]=/g' \
513
+    -e 's/^InitialPreference=/X-TDE-InitialPreference=/g' \
514
+    -e 's/^InitialPreference\[\(.*\)\]=/X-TDE-InitialPreference\[\1\]=/g'
513 515
 
514 516
 # Rename files
515 517
 find . -name "kio_*" | while read f; do mv "${f}" "${f/kio_/tdeio_}"; done

+ 19
- 25
kde-tde/tde_action_conversion View File

@@ -34,32 +34,38 @@ function rename_files {
34 34
 }
35 35
 
36 36
 function convert_files {
37
+	[ -d ~/tde-git/tde/main ] && \
37 38
 	cd ~/tde-git/tde/main
38 39
 
39 40
 	echo "==================================================="
40 41
 	echo "Converting $1..."
41 42
 
42
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/IconSet(\"$1\"/IconSet(\"$2\"/g" {} \;
43
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/IconSet( \"$1\"/IconSet( \"$2\"/g" {} \;
43
+	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -print0 | \
44
+	xargs -r0 grep -ZIl "\(Icon\(Set\|\)( \?\)\"$1\"" | \
45
+	xargs -r0 sed -i "s/\(Icon\(Set\|\)( \?\)\"$1\"/\1\"$2\"/g"
44 46
 
45
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/Icon(\"$1\"/Icon(\"$2\"/g" {} \;
46
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/Icon( \"$1\"/Icon( \"$2\"/g" {} \;
47
+	find ./ -type f -iname "*.ui*" -not -iwholename '*.git*' -print0 | \
48
+	xargs -r0 grep -ZIl "<iconset>\"$1\"" | \
49
+	xargs -r0 sed -i "s/<iconset>\"$1\"/<iconset>\"$2\"/g"
47 50
 
48
-	find ./ -type f -iname "*.ui*" -not -iwholename '*.git*' -exec sed -i "s/<iconset>\"$1\"/<iconset>\"$2\"/g" {} \;
51
+	find ./ -type f -iregex ".*\.\(directory\|desktop\|protocol\)" -not -iwholename '*.git*' -print0 | \
52
+	xargs -r0 grep -ZIl "Icon=$1" | \
53
+	xargs -r0 sed -i "s/Icon=$1/Icon=$2/g"
49 54
 
50
-	find ./ -type f -iname "*.directory" -not -iwholename '*.git*' -exec sed -i "s/Icon=$1/Icon=$2/g" {} \;
51
-	find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i "s/Icon=$1/Icon=$2/g" {} \;
52
-	find ./ -type f -iname "*.protocol" -not -iwholename '*.git*' -exec sed -i "s/Icon=$1/Icon=$2/g" {} \;
53
-
54
-	find ./ -type f -iname "*.rc" -not -iwholename '*.git*' -exec sed -i "s/icon=\"$1\"/icon=\"$2\"/g" {} \;
55
+	find ./ -type f -iname "*.rc" -not -iwholename '*.git*' -print0 | \
56
+	xargs -r0 grep -ZIl "icon=\"$1\"" | \
57
+	xargs -r0 sed -i "s/icon=\"$1\"/icon=\"$2\"/g"
55 58
 
56 59
 	echo "==================================================="
57 60
 	echo "Renaming $1..."
58
-	cd $WORKDIR/tdelibs/pics
61
+	[ -d $WORKDIR/tdelibs/pics ] && \
62
+	cd $WORKDIR/tdelibs/pics && \
59 63
 	rename_files $1 $2
60
-	cd $WORKDIR/tdeartwork/IconThemes
64
+	[ -d $WORKDIR/tdeartwork/IconThemes ] && \
65
+	cd $WORKDIR/tdeartwork/IconThemes && \
61 66
 	rename_files $1 $2
62
-	cd $WORKDIR/tdeaccessibility/IconThemes
67
+	[ -d $WORKDIR/tdeaccessibility/IconThemes ] && \
68
+	cd $WORKDIR/tdeaccessibility/IconThemes && \
63 69
 	rename_files $1 $2
64 70
 	cd $WORKDIR
65 71
 	echo "==================================================="
@@ -146,15 +152,3 @@ convert_files "input_devices_settings" "preferences-desktop-peripherals"
146 152
 convert_files "kcmsystem" "preferences-system"
147 153
 convert_files "personal" "preferences-desktop-personal"
148 154
 convert_files "looknfeel" "preferences-desktop"
149
-convert_files "package_development" "applications-development"
150
-convert_files "package_games" "applications-games"
151
-convert_files "package_graphics" "applications-graphics"
152
-convert_files "package_network" "applications-internet"
153
-convert_files "package_multimedia" "applications-multimedia"
154
-convert_files "package_wordprocessing" "applications-office"
155
-convert_files "edu_science" "applications-science"
156
-convert_files "package_utilities" "applications-utilities"
157
-convert_files "looknfeel" "preferences-desktop"
158
-convert_files "input_devices_settings" "preferences-desktop-peripherals"
159
-convert_files "personal" "preferences-desktop-personal"
160
-convert_files "kcmsystem" "preferences-system"

+ 19
- 13
kde-tde/tde_device_conversion View File

@@ -34,32 +34,38 @@ function rename_files {
34 34
 }
35 35
 
36 36
 function convert_files {
37
+	[ -d ~/tde-git/tde/main ] && \
37 38
 	cd ~/tde-git/tde/main
38 39
 
39 40
 	echo "==================================================="
40 41
 	echo "Converting $1..."
41 42
 
42
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/IconSet(\"$1\"/IconSet(\"$2\"/g" {} \;
43
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/IconSet( \"$1\"/IconSet( \"$2\"/g" {} \;
43
+	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -print0 | \
44
+	xargs -r0 grep -ZIl "\(Icon\(Set\|\)( \?\)\"$1\"" | \
45
+	xargs -r0 sed -i "s/\(Icon\(Set\|\)( \?\)\"$1\"/\1\"$2\"/g"
44 46
 
45
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/Icon(\"$1\"/Icon(\"$2\"/g" {} \;
46
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/Icon( \"$1\"/Icon( \"$2\"/g" {} \;
47
+	find ./ -type f -iname "*.ui*" -not -iwholename '*.git*' -print0 | \
48
+	xargs -r0 grep -ZIl "<iconset>\"$1\"" | \
49
+	xargs -r0 sed -i "s/<iconset>\"$1\"/<iconset>\"$2\"/g"
47 50
 
48
-	find ./ -type f -iname "*.ui*" -not -iwholename '*.git*' -exec sed -i "s/<iconset>\"$1\"/<iconset>\"$2\"/g" {} \;
51
+	find ./ -type f -iregex ".*\.\(directory\|desktop\|protocol\)" -not -iwholename '*.git*' -print0 | \
52
+	xargs -r0 grep -ZIl "Icon=$1" | \
53
+	xargs -r0 sed -i "s/Icon=$1/Icon=$2/g"
49 54
 
50
-	find ./ -type f -iname "*.directory" -not -iwholename '*.git*' -exec sed -i "s/Icon=$1/Icon=$2/g" {} \;
51
-	find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i "s/Icon=$1/Icon=$2/g" {} \;
52
-	find ./ -type f -iname "*.protocol" -not -iwholename '*.git*' -exec sed -i "s/Icon=$1/Icon=$2/g" {} \;
53
-
54
-	find ./ -type f -iname "*.rc" -not -iwholename '*.git*' -exec sed -i "s/icon=\"$1\"/icon=\"$2\"/g" {} \;
55
+	find ./ -type f -iname "*.rc" -not -iwholename '*.git*' -print0 | \
56
+	xargs -r0 grep -ZIl "icon=\"$1\"" | \
57
+	xargs -r0 sed -i "s/icon=\"$1\"/icon=\"$2\"/g"
55 58
 
56 59
 	echo "==================================================="
57 60
 	echo "Renaming $1..."
58
-	cd $WORKDIR/tdelibs/pics
61
+	[ -d $WORKDIR/tdelibs/pics ] && \
62
+	cd $WORKDIR/tdelibs/pics && \
59 63
 	rename_files $1 $2
60
-	cd $WORKDIR/tdeartwork/IconThemes
64
+	[ -d $WORKDIR/tdeartwork/IconThemes ] && \
65
+	cd $WORKDIR/tdeartwork/IconThemes && \
61 66
 	rename_files $1 $2
62
-	cd $WORKDIR/tdeaccessibility/IconThemes
67
+	[ -d $WORKDIR/tdeaccessibility/IconThemes ] && \
68
+	cd $WORKDIR/tdeaccessibility/IconThemes && \
63 69
 	rename_files $1 $2
64 70
 	cd $WORKDIR
65 71
 	echo "==================================================="

+ 19
- 13
kde-tde/tde_mimetype_conversion View File

@@ -34,32 +34,38 @@ function rename_files {
34 34
 }
35 35
 
36 36
 function convert_files {
37
+	[ -d ~/tde-git/tde/main ] && \
37 38
 	cd ~/tde-git/tde/main
38 39
 
39 40
 	echo "==================================================="
40 41
 	echo "Converting $1..."
41 42
 
42
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/IconSet(\"$1\"/IconSet(\"$2\"/g" {} \;
43
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/IconSet( \"$1\"/IconSet( \"$2\"/g" {} \;
43
+	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -print0 | \
44
+	xargs -r0 grep -ZIl "\(Icon\(Set\|\)( \?\)\"$1\"" | \
45
+	xargs -r0 sed -i "s/\(Icon\(Set\|\)( \?\)\"$1\"/\1\"$2\"/g"
44 46
 
45
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/Icon(\"$1\"/Icon(\"$2\"/g" {} \;
46
-	find ./ -type f -iname "*.c*" -not -iwholename '*.git*' -exec sed -i "s/Icon( \"$1\"/Icon( \"$2\"/g" {} \;
47
+	find ./ -type f -iname "*.ui*" -not -iwholename '*.git*' -print0 | \
48
+	xargs -r0 grep -ZIl "<iconset>\"$1\"" | \
49
+	xargs -r0 sed -i "s/<iconset>\"$1\"/<iconset>\"$2\"/g"
47 50
 
48
-	find ./ -type f -iname "*.ui*" -not -iwholename '*.git*' -exec sed -i "s/<iconset>\"$1\"/<iconset>\"$2\"/g" {} \;
51
+	find ./ -type f -iregex ".*\.\(directory\|desktop\|protocol\)" -not -iwholename '*.git*' -print0 | \
52
+	xargs -r0 grep -ZIl "Icon=$1" | \
53
+	xargs -r0 sed -i "s/Icon=$1/Icon=$2/g"
49 54
 
50
-	find ./ -type f -iname "*.directory" -not -iwholename '*.git*' -exec sed -i "s/Icon=$1/Icon=$2/g" {} \;
51
-	find ./ -type f -iname "*.desktop" -not -iwholename '*.git*' -exec sed -i "s/Icon=$1/Icon=$2/g" {} \;
52
-	find ./ -type f -iname "*.protocol" -not -iwholename '*.git*' -exec sed -i "s/Icon=$1/Icon=$2/g" {} \;
53
-
54
-	find ./ -type f -iname "*.rc" -not -iwholename '*.git*' -exec sed -i "s/icon=\"$1\"/icon=\"$2\"/g" {} \;
55
+	find ./ -type f -iname "*.rc" -not -iwholename '*.git*' -print0 | \
56
+	xargs -r0 grep -ZIl "icon=\"$1\"" | \
57
+	xargs -r0 sed -i "s/icon=\"$1\"/icon=\"$2\"/g"
55 58
 
56 59
 	echo "==================================================="
57 60
 	echo "Renaming $1..."
58
-	cd $WORKDIR/tdelibs/pics
61
+	[ -d $WORKDIR/tdelibs/pics ] && \
62
+	cd $WORKDIR/tdelibs/pics && \
59 63
 	rename_files $1 $2
60
-	cd $WORKDIR/tdeartwork/IconThemes
64
+	[ -d $WORKDIR/tdeartwork/IconThemes ] && \
65
+	cd $WORKDIR/tdeartwork/IconThemes && \
61 66
 	rename_files $1 $2
62
-	cd $WORKDIR/tdeaccessibility/IconThemes
67
+	[ -d $WORKDIR/tdeaccessibility/IconThemes ] && \
68
+	cd $WORKDIR/tdeaccessibility/IconThemes && \
63 69
 	rename_files $1 $2
64 70
 	cd $WORKDIR
65 71
 	echo "==================================================="

Loading…
Cancel
Save