#!/usr/bin/perl # Copyright 2016 by Shlomi Fish # This program is distributed under the MIT (X11) License: # http://www.opensource.org/licenses/mit-license.php use strict; use warnings; use File::Find; my $FILTER = qr/\.desktop\z/; sub main { my $buildroot = $ENV{RPM_BUILD_ROOT}; find( { wanted => sub { # xsession files are not *really* desktop files # https://bugs.freedesktop.org/show_bug.cgi?id=85938 return if $File::Find::dir eq $builroot . '/usr/share/session'; my $fn = $File::Find::name; if ($fn =~ $FILTER) { if (system('desktop-file-validate', $fn) != 0) { die "Validating <$fn> failed!"; } } }, no_chdir => 1, }, $buildroot ); exit(0); } main(@ARGV);