--- pkgsrc/pkgtools/pkgdiff/files/patchdiff.pl 2000/06/28 01:42:42 1.1 +++ pkgsrc/pkgtools/pkgdiff/files/patchdiff.pl 2004/01/10 05:40:40 1.6 @@ -1,6 +1,6 @@ -#!@PREFIX@/bin/perl +#!@PERL5@ # -# $NetBSD: patchdiff.pl,v 1.1 2000/06/28 01:42:42 wiz Exp $ +# $NetBSD: patchdiff.pl,v 1.6 2004/01/10 05:40:40 jlam Exp $ # # patchdiff: compares a set of patches patch-aa, patch-ab, ... in # $WRKDIR/.newpatches in the with another set in patches. @@ -11,26 +11,23 @@ use Getopt::Std; use Cwd; +use File::Spec; my $oldpatchdir, $newpatchdir; -my $wrkdir; +my $wrkdir, $thisdir; my %orig, %new; -# change to WRKDIR - -sub goto_wrkdir { - chdir $wrkdir or die ("can't cd to WRKDIR ($wrkdir)"); -} - sub getfilename { my $fname=shift; local $_; local *handle; open(handle, $fname); while () { - next unless m/^\+\+\+ ([^ ]*)/; + next unless m/^\+\+\+[ ]([^ ]*)/; close(handle); - return $1; + $_ = $1; + chomp(); + return $_; } close(handle); return undef; @@ -45,8 +42,7 @@ sub putinhash { while() { chomp; $temp=getfilename($_); - $$hash{$temp}=$_; -# print "put in hash: $temp // $_"; + $$hash{$temp}=File::Spec->abs2rel($_, $thisdir); } close(handle); } @@ -65,11 +61,13 @@ EOF %orig=(); %new=(); -$oldpatchdir=cwd(); +$thisdir=cwd(); +chomp($thisdir); +$oldpatchdir=`@MAKE@ show-var VARNAME=PATCHDIR` or + die ("can't find PATCHDIR -- wrong dir?"); chomp($oldpatchdir); -$oldpatchdir=$oldpatchdir."/patches"; -$wrkdir=`make show-var VARNAME=WRKDIR` or +$wrkdir=`@MAKE@ show-var VARNAME=WRKDIR` or die ("can't find WRKDIR -- wrong dir?"); chomp($wrkdir);