summaryrefslogtreecommitdiffstats
path: root/needs-checking/split-patch
blob: 08ce4316097baee913b93ef43879496e6d6ac09a (plain) (blame)
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
#!/usr/bin/perl -w
$out = "";
while (<>) {
	next if (/^Only/);
	next if (/^Binary/);
	if (/^diff/ || /^Index/) {
		if ($out) {
			close OUT;
		}
		(@out) = split(' ', $_);
		shift(@out) if (/^diff/);
		$out = pop(@out);
		$out =~ s:/*usr/:/:;
		$out =~ s:/*src/:/:;
		$out =~ s:^/*linux[^/]*::;
		$out =~ s:\(w\)::;
		next if ($out eq "");
		$out = "/var/tmp/patches/$out";
		$dir = $out;
		$dir =~ s:/[^/]*$::;
		print STDERR "$out\n";
		system("mkdir -p $dir");
		open(OUT, ">$out") || die("cannot open $out");
	}
	if ($out) {
		print OUT $_;
	}
}