summaryrefslogtreecommitdiffstats
path: root/commands/find-unpackaged
blob: a7bcf6df3583fb3ddaaf5ca262834d681c9d9ad7 (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
#!/usr/bin/perl
# Find unpackaged modules. Pass the kernel name and installed name
# (normally the same).
use strict;
use warnings;
use File::Find ();
use File::Spec;

my $kernel = $ARGV[0];
my $installedname = $ARGV[1];

my $moddir = "/lib/modules/$installedname";
my $sourcedir = $ENV{SOURCEDIR} || '';

my %unpackaged;
my $dir = "$sourcedir$moddir";
File::Find::find(
    sub {
	$unpackaged{File::Spec->abs2rel($File::Find::name, $dir)} = 1
	    if /\.k?o$/;
    },
    $dir);
for my $dir (glob("debian/*-modules-$kernel-di$moddir")) {
    File::Find::find(
	sub {
	    delete $unpackaged{File::Spec->abs2rel($File::Find::name, $dir)}
	    if /\.k?o$/;
	},
	$dir);
}

print "These modules from $kernel are unpackaged:\n";
for my $path (sort(keys(%unpackaged))) {
    print "\t\t$path\n";
}