blob: e640e1185f63782c256defc95b733585b847b28a (
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
|
#!/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 {
# check files only in /usr/share/applications
return unless $File::Find::dir eq $buildroot . '/usr/share/applications';
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);
|