From: Ian Jackson Date: Sun, 27 Sep 2020 18:14:53 +0000 (+0100) Subject: media-scraper: Handle a scraper which doesn't want to edit LICENCE X-Git-Tag: otter-0.2.0~834 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=2d310401c9b333cef4c9771a77b8bac72cf88971;p=otter.git media-scraper: Handle a scraper which doesn't want to edit LICENCE Signed-off-by: Ian Jackson --- diff --git a/media-scraper b/media-scraper index a464e334..c037065b 100755 --- a/media-scraper +++ b/media-scraper @@ -151,8 +151,12 @@ my $method_fn = ${*::}{"method_$method"}; my $methodlic_fn = ${*::}{"methodlic_$method"}; my $licpath = "$basename/LICENCE"; -my $licfile = new IO::File "$licpath.tmp", '>' or die $!; -print $licfile <($scraper), <($scraper); +if (defined $method_lictext) { + my $licfile = new IO::File "$licpath.tmp", '>' or die $!; + + print $licfile <('spdx') } (applies to the contents of this directory unless otherwise stated) @@ -160,7 +164,8 @@ END The download was done by media-scraper, controlled by $input. END -close $licfile or die $!; + close $licfile or die $!; +} my $makepath = "$basename/files.make"; my $makefile = new IO::File "$makepath.tmp", '>' or die $!; @@ -203,11 +208,14 @@ END close $makefile or die $!; -my $cmp = compare("$licpath.tmp", $licpath); -die if $cmp < 0; -if ($cmp) { - rename "$licpath.tmp", $licpath or die $!; -} else { - remove "$licpath.tmp"; +if (defined($method_lictext)) { + 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 $!;