Commit 6fb21a20 authored by Salamandar's avatar Salamandar Committed by Bastien Nocera
Browse files

build: Add script to check for duplicated mime-types

Replaces the shell in Makefile.am
parent b1662f0c
...@@ -38,7 +38,8 @@ EXTRA_DIST = \ ...@@ -38,7 +38,8 @@ EXTRA_DIST = \
shared-mime-info.pc.in \ shared-mime-info.pc.in \
data/freedesktop_generate.sh \ data/freedesktop_generate.sh \
po/check_translations.sh \ po/check_translations.sh \
tests/test_generic_icons.sh tests/test_generic_icons.sh \
tests/test_duplicate_mime_types.sh
CLEANFILES = freedesktop.org.xml po/stamp-it CLEANFILES = freedesktop.org.xml po/stamp-it
...@@ -128,12 +129,7 @@ else ...@@ -128,12 +129,7 @@ else
rm -rf "$(top_builddir)/temp-mime-dir/" ; \ rm -rf "$(top_builddir)/temp-mime-dir/" ; \
fi; \ fi; \
fi fi
@if test x`grep '<mime-type' $(srcdir)/data/freedesktop.org.xml.in | tr -d '[:blank:]' | sort | uniq -d` != "x"; then \ @$(srcdir)/tests/test_duplicate_mime_types.sh $(srcdir)/data/freedesktop.org.xml.in
echo "*************************************************************" ; \
echo "*** Some mime-types are duplicated, fix before committing ***" ; \
echo "*************************************************************" ; \
exit 1 ; \
fi
@$(srcdir)/tests/test_generic_icons.sh $(srcdir)/data/freedesktop.org.xml.in @$(srcdir)/tests/test_generic_icons.sh $(srcdir)/data/freedesktop.org.xml.in
endif endif
......
#!/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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment