#!/usr/bin/perl $patchroot = $ENV{'HOME'} . "/linux/patches"; $viewroot = $ENV{'HOME'} . "/linux/views"; chomp($pwd = `pwd`); die "Invalid starting directory" unless ($pwd =~ m#^$viewroot#); $basename = $pwd; $basename =~ s#^$viewroot/?##; $oldtree = shift(@ARGV); $oldtree =~ s#/$##; $newtree = shift(@ARGV); $newtree =~ s#/$##; $patch = shift(@ARGV); $patch = $newtree if ($patch eq ""); die "Old tree \"${oldtree}\" does not exist" unless -d $oldtree; die "New tree \"${newtree}\" does not exist" unless -d $newtree; $patchdir = "$patchroot/$basename"; $patchpath = "$patchdir/$patch"; if (!-d $patchdir) { print "Making new patch directory $patchdir\n"; mkdir($patchdir) if (!-d $patchdir); } print "linuxdiff $oldtree $newtree > $patchpath\n"; system("linuxdiff $oldtree $newtree > $patchpath");