1 |
Add postinst-qa-check.d checks for missed desktop, mime-info and GTK+ |
2 |
icon cache updates. In all of the cases the checks simply look for any |
3 |
installed files that are newer than the cache. |
4 |
|
5 |
This check has some limitations: it assumes that mtime is not preserved |
6 |
when copying files to D, it can't distinguish whether the files |
7 |
were installed by the current package (it reports all new files since |
8 |
the last cache update) and it can't distinguish between the update |
9 |
on postinst and postrm. However, it's certainly a step forward and will |
10 |
help find a few bugs. |
11 |
--- |
12 |
bin/postinst-qa-check.d/50gnome2-utils | 38 ++++++++++++++++++++ |
13 |
bin/postinst-qa-check.d/50xdg-utils | 65 ++++++++++++++++++++++++++++++++++ |
14 |
2 files changed, 103 insertions(+) |
15 |
create mode 100644 bin/postinst-qa-check.d/50gnome2-utils |
16 |
create mode 100644 bin/postinst-qa-check.d/50xdg-utils |
17 |
|
18 |
diff --git a/bin/postinst-qa-check.d/50gnome2-utils b/bin/postinst-qa-check.d/50gnome2-utils |
19 |
new file mode 100644 |
20 |
index 000000000..68e21cb74 |
21 |
--- /dev/null |
22 |
+++ b/bin/postinst-qa-check.d/50gnome2-utils |
23 |
@@ -0,0 +1,38 @@ |
24 |
+# check for missing calls to gnome2-utils regen functions |
25 |
+ |
26 |
+gnome2_icon_cache_check() { |
27 |
+ local d f files=() find_args |
28 |
+ for d in usr/share/icons/*/; do |
29 |
+ # gnome2_icon_cache_update updates only themes with an index |
30 |
+ [[ -f ${d}/index.theme ]] || continue |
31 |
+ |
32 |
+ find_args=() |
33 |
+ # if the cache does not exist at all, we complain for any file |
34 |
+ # otherwise, we look for files newer than the cache |
35 |
+ [[ -f ${d}/icon-theme.cache ]] && |
36 |
+ find_args+=( -newer "${d}"/icon-theme.cache ) |
37 |
+ |
38 |
+ # (use -mindepth 2 to easily skip the cache files) |
39 |
+ while read -r -d $'\0' f; do |
40 |
+ files+=( "${f}" ) |
41 |
+ done < <(find "${d}" -mindepth 2 -type f "${find_args[@]}" -print0) |
42 |
+ done |
43 |
+ |
44 |
+ if [[ ${files[@]} ]]; then |
45 |
+ eqawarn "QA Notice: new icons were found installed but GTK+ icon cache" |
46 |
+ eqawarn "has not been updated:" |
47 |
+ eqatag -v gnome2-utils.icon-cache "${files[@]/#//}" |
48 |
+ eqawarn "Please make sure to call gnome2_icon_cache_update()" |
49 |
+ eqawarn "in pkg_postinst() and pkg_postrm() phases of appropriate pkgs." |
50 |
+ fi |
51 |
+} |
52 |
+ |
53 |
+gnome2_utils_postinst_check() { |
54 |
+ cd "${EROOT}" || die |
55 |
+ gnome2_icon_cache_check |
56 |
+} |
57 |
+ |
58 |
+gnome2_utils_postinst_check |
59 |
+: # guarantee successful exit |
60 |
+ |
61 |
+# vim:ft=sh |
62 |
diff --git a/bin/postinst-qa-check.d/50xdg-utils b/bin/postinst-qa-check.d/50xdg-utils |
63 |
new file mode 100644 |
64 |
index 000000000..4bc7bee9a |
65 |
--- /dev/null |
66 |
+++ b/bin/postinst-qa-check.d/50xdg-utils |
67 |
@@ -0,0 +1,65 @@ |
68 |
+# check for missing calls to xdg-utils regen functions |
69 |
+ |
70 |
+xdg_desktop_database_check() { |
71 |
+ local d f files=() |
72 |
+ for d in usr/share/applications; do |
73 |
+ [[ -d ${d} ]] || continue |
74 |
+ |
75 |
+ find_args=() |
76 |
+ # if the cache does not exist at all, we complain for any file |
77 |
+ # otherwise, we look for files newer than the cache |
78 |
+ [[ -f ${d}/mimeinfo.cache ]] && |
79 |
+ find_args+=( -newer "${d}"/mimeinfo.cache ) |
80 |
+ |
81 |
+ # look for any .desktop files that are newer than the cache |
82 |
+ # and that have any mime types defined |
83 |
+ while read -r -d $'\0' f; do |
84 |
+ files+=( "${f}" ) |
85 |
+ done < <(find "${d}" -name '*.desktop' "${find_args[@]}" \ |
86 |
+ -exec grep -lZi '^MimeType=' {} +) |
87 |
+ done |
88 |
+ |
89 |
+ if [[ ${files[@]} ]]; then |
90 |
+ eqawarn "QA Notice: .desktop files with MimeType= were found installed" |
91 |
+ eqawarn "but desktop mimeinfo cache has not been updated:" |
92 |
+ eqatag -v xdg-utils.desktop "${files[@]/#//}" |
93 |
+ eqawarn "Please make sure to call xdg_desktop_database_update()" |
94 |
+ eqawarn "in pkg_postinst() and pkg_postrm() phases of appropriate pkgs." |
95 |
+ fi |
96 |
+} |
97 |
+ |
98 |
+xdg_mimeinfo_database_check() { |
99 |
+ local d f files=() |
100 |
+ for d in usr/share/mime; do |
101 |
+ [[ -d ${d} ]] || continue |
102 |
+ |
103 |
+ find_args=() |
104 |
+ # if the cache does not exist at all, we complain for any file |
105 |
+ # otherwise, we look for files newer than the cache |
106 |
+ [[ -f ${d}/mime.cache ]] && |
107 |
+ find_args+=( -newer "${d}"/mime.cache ) |
108 |
+ |
109 |
+ while read -r -d $'\0' f; do |
110 |
+ files+=( "${f}" ) |
111 |
+ done < <(find "${d}" -name '*.xml' "${find_args[@]}" -print0) |
112 |
+ done |
113 |
+ |
114 |
+ if [[ ${files[@]} ]]; then |
115 |
+ eqawarn "QA Notice: mime-info files were found installed but mime-info" |
116 |
+ eqawarn "cache has not been updated:" |
117 |
+ eqatag -v xdg-utils.mime-info "${files[@]/#//}" |
118 |
+ eqawarn "Please make sure to call xdg_mimeinfo_database_update()" |
119 |
+ eqawarn "in pkg_postinst() and pkg_postrm() phases of appropriate pkgs." |
120 |
+ fi |
121 |
+} |
122 |
+ |
123 |
+xdg_utils_postinst_check() { |
124 |
+ cd "${EROOT}" || die |
125 |
+ xdg_desktop_database_check |
126 |
+ xdg_mimeinfo_database_check |
127 |
+} |
128 |
+ |
129 |
+xdg_utils_postinst_check |
130 |
+: # guarantee successful exit |
131 |
+ |
132 |
+# vim:ft=sh |
133 |
-- |
134 |
2.14.1 |