blob: da43fcdf7a02add3dc0c3cfc6fc0d4565ca6d051 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/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 $buildroot = $ENV{RPM_BUILD_ROOT};
die "No build root defined" unless $buildroot;
die "Invalid build root" unless -d $buildroot;
# normalize build root
$buildroot =~ s|/$||;
my $FILTER = qr/\.desktop\z/;
sub main
{
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 $buildroot . '/usr/share/xsession';
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);
|