chiark / gitweb /
do not update LICENCE if not needed (saves on rebuilding)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 26 Sep 2020 18:36:09 +0000 (19:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 26 Sep 2020 18:36:09 +0000 (19:36 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
media-scraper

index 2d8fcfe39d5ffac044b6af8ad566412793b896c0..da73cbc7ff47dd8b21862166fdac9853890c6e12 100755 (executable)
@@ -12,6 +12,7 @@ use TOML::Parser;
 use Data::Dumper;
 use Time::HiRes;
 use Digest::MD5 qw(md5_hex);
+use File::Compare;
 
 our $max_rate = 2; # per second
 
@@ -200,5 +201,12 @@ END
 }
 
 close $makefile or die $!;
-rename "$licpath.tmp", $licpath or die $!;
+
+my $cmp = compare("$licpath.tmp", $licpath);
+die if $cmp < 0;
+if ($cmp) {
+  rename "$licpath.tmp", $licpath or die $!;
+} else {
+  remove "$licpath.tmp";
+}
 rename "$makepath.tmp", $makepath or die $!;