From fff68af945d6e543790702655e8a3588c774cf3d Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sat, 6 Dec 2003 17:12:03 +0000 Subject: [PATCH] Do not generate empty diffs. Try to preserve files mtime. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2139 7894878c-1315-0410-8ee3-d5d059ff63e0 --- mkpatch/mkpatch.pl | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/mkpatch/mkpatch.pl b/mkpatch/mkpatch.pl index 5fa97c6d..fccaec4d 100755 --- a/mkpatch/mkpatch.pl +++ b/mkpatch/mkpatch.pl @@ -32,27 +32,30 @@ $temp = "mkpatch/.temp"; sub print_diff { my ($package_root,$kernel_root,$kernel_file,$package_file) = @_; - my ($diff_command,$dummy); + my ($diff_command,$package_mtime,$kernel_mtime); $diff_command = "diff -u"; if ( -e "$kernel_root/$kernel_file") { - $diff_command .= " $kernel_root/$kernel_file "; - } else { - $diff_command .= " /dev/null "; - } - if ( -e "$package_root/$package_file") { - $diff_command .= " $package_root/$package_file "; + $diff_command .= " $kernel_root/$kernel_file"; + $kernel_mtime = (stat("$kernel_root/$kernel_file"))[9]; } else { $diff_command .= " /dev/null"; + $kernel_mtime = 0; + } + if ( -e "$package_root/$package_file") { + $diff_command .= " $package_root/$package_file"; + $package_mtime = (stat("$package_root/$package_file"))[9]; + } else { + $diff_command .= " /dev/null"; + $package_mtime = 0; } open INPUT, "$diff_command|" or die "Can't execute `$diff_command'"; - $dummy = ; - $dummy = ; - print "--- linux-old/$kernel_file\t".`date`; - print "+++ linux/$kernel_file\t".`date`; - - while () { - print; + if () { + ; + print "--- linux-old/$kernel_file\t".gmtime($kernel_mtime)."\n". + "+++ linux/$kernel_file\t".gmtime($package_mtime)."\n"; + + print while ; } close INPUT; }