summaryrefslogtreecommitdiff
path: root/scripts/parseLicense.pl
blob: 2dc61ef61a0efb380ef15e382f27052d5607f8cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl

# this parses a line

#/big2/y-manabe/licensereration/fedora/srcrpm_sandbox/lua-lgi-0.7.1-1.fc19/lgi-0.7.1/lgi/marshal.c;UNKNOWN

#into
# pkg name: lua-lgi-0.7.1-1.fc19
# file:     lgi-0.7.1/lgi/marshal.c
# license:  UNKNOWN

use strict;

while (<>) {
    chomp;
    my @fields = split(';');
    my $license = $fields[1];
    my @f = split('/', $fields[0]);
    my $pkg = $f[6];
    my $file = join('/', splice(@f, 7, scalar(@f) -1));

    print "$pkg;$file;$license\n";
}