On 09/26/2014 05:20 PM, Kalev Lember wrote:
On 09/26/2014 02:39 PM, Richard Hughes wrote:
On 26 September 2014 13:36, Kalev Lember kalevlember@gmail.com wrote:
An option would be to add libappstream-glib to the minimal koji buildroot and run the check automatically for every package that's built in koji.
If you know how to do that, that'd be awesome.
And same thing with desktop-file-validate, instead of manually adding it in every package's %check / %install, could just have rpmbuild automatically run it for all builds.
Right.
Here's a quick patch to redhat-rpm-config that makes it automatically run desktop-file-validate after %install. The appdata validation would be similar, just another 2 lines to the macro files. Alternatively, could also put it in desktop-file-utils-srpm-macros or something, but I think it's overkill for just two lines.
Any opinions / comments from the rpm maintainers?
As a concept, I've no problem. This patch as-is wont quite do however, see below:
From 69f1dddeed7c1e399e6a88f8adadfe98a1dd8f2b Mon Sep 17 00:00:00 2001 From: Kalev Lember kalevlember@gmail.com Date: Fri, 26 Sep 2014 15:25:53 +0200 Subject: [PATCH] Automatically run desktop-file-validate in %check
macros | 2 ++ redhat-rpm-config.spec | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/macros b/macros index 6d855fa..464d549 100644 --- a/macros +++ b/macros @@ -19,6 +19,7 @@ %_fmoddir %{_libdir}/gfortran/modules
%_enable_debug_packages 1 +%_enable_desktop_file_validate 1 %_include_minidebuginfo 1
#============================================================================== @@ -94,6 +95,7 @@ /usr/lib/rpm/brp-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build} \ /usr/lib/rpm/brp-python-hardlink \ %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \
- %{?_enable_desktop_file_validate:if ls -A %{buildroot}%{_datadir}/applications/ 2>/dev/null; then desktop-file-validate %{buildroot}%{_datadir}/applications/*.desktop; fi} \ %{nil}
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.
# /usr/lib/rpm/redhat/brp-implant-ident-static diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index fa65527..609b5ff 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+ @@ -62,6 +62,7 @@ Source602: libsymlink.attr
BuildArch: noarch Requires: coreutils +Requires: desktop-file-utils
This is a problem, redhat-rpm-config is one of the distro bootstrap packages and we dont want any extra dependencies here. Plus there's no point dragging desktop-file-utils and its dependencies on every single build when its only useful for packages with .. well, desktop files.
I'd rather see this done in a way that it only executes when desktop-file-utils is installed, which should already be a buildrequire for all packages containing desktop files I think.
Requires: perl-srpm-macros Requires: ocaml-srpm-macros Requires: gnat-srpm-macros @@ -135,6 +136,9 @@ install -p -m 755 -t %{buildroot}%{_rpmconfigdir} kmod.prov %{_rpmconfigdir}/macros.d/macros.kmp
%changelog +* Fri Sep 26 2014 Kalev Lember kalevlember@gmail.com - 27-1 +- Automatically run desktop-file-validate in %%check
This is not related to %check, the build root policy scripts run at end of %install.
- Panu -
- Mon Sep 22 2014 Panu Matilainen pmatilai@redhat.com - 26-1
- Gnat macros are now in a package of their own (#1133632)