File: t_dist_manifest.pl

package info (click to toggle)
verilator 3.833-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 10,196 kB
  • sloc: cpp: 49,566; perl: 7,111; yacc: 2,221; lex: 1,702; makefile: 651; sh: 175
file content (72 lines) | stat: -rwxr-xr-x 2,128 bytes parent folder | download | duplicates (4)
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/usr/bin/perl
if (!$::Driver) { use FindBin; exec("$FindBin::Bin/bootstrap.pl", @ARGV, $0); die; }
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# Copyright 2003 by Wilson Snyder. This program is free software; you can
# redistribute it and/or modify it under the terms of either the GNU
# Lesser General Public License Version 3 or the Perl Artistic License
# Version 2.0.

my $root = "..";
my $Debug;

### Must trim output before and after our file list
`cd $root && make dist-file-list`;
my $manifest_files = `cd $root && make dist-file-list`;
$manifest_files =~ s!.*begin-dist-file-list:!!sg;
$manifest_files =~ s!end-dist-file-list:.*$!!sg;
print "MF $manifest_files\n";
my %files;
foreach my $file (split /\s+/,$manifest_files) {
    next if $file eq '';
    $files{$file} |= 1;
}

my $all_files = `cd $root && find . -type f -print`;
foreach my $file (split /\s+/,$all_files) {
    next if $file eq '';
    $file =~ s!^\./!!;
    $files{$file} |= 2;
}

my %file_regexps;
my $skip = file_contents("$root/MANIFEST.SKIP");
foreach my $file (sort keys %files) {
    foreach my $skip (split /\s+/,$skip) {
	if ($file =~ /$skip/) {
	    $files{$file} |= 4;
	    $file_regexps{$file} = $skip;
	}
    }
}

my %warns;
foreach my $file (sort keys %files) {
    my $tar = $files{$file}&1;
    my $dir = $files{$file}&2;
    my $skip = $files{$file}&4;

    print +(($tar ? "TAR ":"    ")
	    .($dir ? "DIR ":"    ")
	    .($skip ? "SKIP ":"     ")
	    ."  $file\n") if $Debug;

    if ($dir && !$tar && !$skip) {
	$warns{$file} = "File not in manifest or MANIFEST.SKIP: $file";
    } elsif (!$dir && $tar && !$skip) {
	$warns{$file} = "File in manifest, but not directory: $file";
    } elsif ($dir && $tar && $skip) {
	$warns{$file} = "File in manifest and also MANIFEST.SKIP, too general skip regexp '$file_regexps{$file}'?: $file";
    }
}

if (keys %warns) {
    # First warning lists everything as that's shown in the driver summary
    $Self->error("Files mismatch with manifest: ",join(' ',sort keys %warns));
    foreach my $file (sort keys %warns) {
	$Self->error($warns{$file});
    }
}

ok(1);
1;