On 09/29/2014 01:19 PM, Panu Matilainen wrote: > Please put the actual validation into an external script, > brp-desktop-file-validate or whatever. That way its consistent with the > other similar things, easier to test-run outside rpmbuild and unlike > inlining, has room for future growth. Thanks for the comments, Panu! I had a chat with releng in the mean time and they also preferred to not add anything more than absolutely necessary to the minimum koji buildroot. So here comes next version. desktop-file-utils rpm would install the validation brp script in /usr/lib/rpm/ and if it's there, redhat-rpm-config macros run the script at the end of %install. This is the script that desktop-file-utils rpm would install (appdata script would be analogous): --------- #!/bin/bash errors_terminate=$1 # If using normal root, return immediately if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then exit 0 fi # If no desktop files are installed, return immediately if ! ls -A "$RPM_BUILD_ROOT"/usr/share/applications/ 2>/dev/null; then exit 0 fi desktop-file-validate "$RPM_BUILD_ROOT"/usr/share/applications/*.desktop if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then # One or more of the files had a syntax error exit 1 fi exit 0 --------- ... and the redhat-rpm-config patch: >From d5f57dc742e7b71b5da7b7b2ecea3b30b155bed2 Mon Sep 17 00:00:00 2001 From: Kalev Lember <kalevlember@xxxxxxxxx> Date: Wed, 1 Oct 2014 12:13:01 +0200 Subject: [PATCH] Run desktop file and appdata validation scripts if they exist This also adds two new macros that can be used from within individual spec files to make the validation errors non-fatal. To do that, use one of the following in spec files: %global _desktop_file_validate_errors_terminate_build 0 %global _appdata_validate_errors_terminate_build 0 In F21, the default setting for both of the macros will be 0, but in F22 and above they'll default to 1. --- macros | 8 ++++++++ redhat-rpm-config.spec | 5 ++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/macros b/macros index 6d855fa..7c0e428 100644 --- a/macros +++ b/macros @@ -93,6 +93,8 @@ /usr/lib/rpm/brp-strip-static-archive %{__strip} \ /usr/lib/rpm/brp-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build} \ /usr/lib/rpm/brp-python-hardlink \ + [ -x /usr/lib/rpm/brp-desktop-file-validate ] && /usr/lib/rpm/brp-desktop-file-validate %{?_desktop_file_validate_errors_terminate_build} \ + [ -x /usr/lib/rpm/brp-appdata-validate ] && /usr/lib/rpm/brp-appdata-validate %{?_appdata_validate_errors_terminate_build} \ %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \ %{nil} @@ -112,6 +114,12 @@ # Should missing buildids terminate a build? %_missing_build_ids_terminate_build 1 +# Should desktop-file-validate errors terminate a build? +%_desktop_file_validate_errors_terminate_build 1 + +# Should appdata validate errors terminate a build? +%_appdata_validate_errors_terminate_build 1 + # ## Should python bytecompilation errors terminate a build? %_python_bytecompile_errors_terminate_build 1 diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index fa65527..bb15a8f 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -6,7 +6,7 @@ Summary: Red Hat specific rpm configuration files Name: redhat-rpm-config -Version: 26 +Version: 27 Release: 1%{?dist} # No version specified. License: GPL+ @@ -135,6 +135,9 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov %{_rpmconfigdir}/macros.d/macros.kmp %changelog +* Wed Oct 01 2014 Kalev Lember <kalevlember@xxxxxxxxx> - 27-1 +- Run desktop file and appdata validation scripts if they exist + * Mon Sep 22 2014 Panu Matilainen <pmatilai@xxxxxxxxxx> - 26-1 - Gnat macros are now in a package of their own (#1133632) -- 2.1.0 -- devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxxx https://admin.fedoraproject.org/mailman/listinfo/devel Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct