diff options
author | Félix Piédallu <felix@piedallu.me> | 2020-02-20 16:00:10 +0100 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2020-02-20 17:02:09 +0100 |
commit | 872f28a4efbb4657e8f025756d138b1ad5086fab (patch) | |
tree | 5fe012ba459bf921bd0cc2c5dafd7c3eabaeac8c | |
parent | f9b35cc54a43b1410f6bdfc69f930292c9660ba2 (diff) | |
download | shared-mime-info-872f28a4efbb4657e8f025756d138b1ad5086fab.tar.gz |
build: Add script to check for duplicated mime-types
Replaces the shell in Makefile.am
-rw-r--r-- | Makefile.am | 7 | ||||
-rwxr-xr-x | tests/test_duplicate_mime_types.sh | 15 |
2 files changed, 16 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am index 29961d25..f4691e11 100644 --- a/Makefile.am +++ b/Makefile.am @@ -125,12 +125,7 @@ else rm -rf "$(top_builddir)/temp-mime-dir/" ; \ fi; \ fi - @if test x`grep '<mime-type' $(srcdir)/data/freedesktop.org.xml.in | tr -d '[:blank:]' | sort | uniq -d` != "x"; then \ - echo "*************************************************************" ; \ - echo "*** Some mime-types are duplicated, fix before committing ***" ; \ - echo "*************************************************************" ; \ - exit 1 ; \ - fi + @$(srcdir)/tests/test_duplicate_mime_types.sh $(srcdir)/data/freedesktop.org.xml.in @$(srcdir)/tests/test_generic_icons.sh $(srcdir)/data/freedesktop.org.xml.in endif diff --git a/tests/test_duplicate_mime_types.sh b/tests/test_duplicate_mime_types.sh new file mode 100755 index 00000000..401b383d --- /dev/null +++ b/tests/test_duplicate_mime_types.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +xml_db_file="${1}" + +duplicated=$( + grep '<mime-type' ${xml_db_file} | tr -d '[:blank:]' | sort | uniq -d +) + +if [[ -n "${duplicated}" ]]; then + echo "*************************************************************" + echo "** Some mime-types are duplicated, fix before committing: **" + echo "${duplicated}" + echo "*************************************************************" + exit 1 +fi |