Merge pull request #26770 from volth/jetbrains-update-script-2

jetbrains updater: use perlPackages.LWPProtocolhttps

authored by Jörg Thalheim and committed by GitHub f3b626cf a807c96e

+5 -24
+5 -24
pkgs/applications/editors/jetbrains/update.pl
··· 1 1 #!/usr/bin/env nix-shell 2 - #!nix-shell -i perl -p perl perlPackages.LWP 2 + #!nix-shell -i perl -p perl perlPackages.LWPProtocolhttps perlPackages.FileSlurp 3 3 4 4 use strict; 5 5 use List::Util qw(reduce); 6 - use File::Basename qw(dirname); 6 + use File::Slurp; 7 7 use LWP::Simple; 8 - 9 - sub readFile { 10 - my ($filename) = @_; 11 - local $/ = undef; 12 - open FILE, $filename or die "readFile($filename) failed: $!"; 13 - binmode FILE; 14 - my $data = <FILE>; 15 - close FILE; 16 - return $data; 17 - } 18 - 19 - sub writeFile { 20 - my ($filename, $content) = @_; 21 - make_path(dirname($filename)) or die "$!" unless -d dirname($filename); 22 - open FH, ">$filename" or die "writeFile($filename) failed: $!"; 23 - binmode FH; # do not emit \r 24 - print FH $content; 25 - close FH; 26 - } 27 8 28 9 sub semantic_less { 29 10 my ($a, $b) = @_; ··· 88 69 return $block; 89 70 } 90 71 91 - my $nix = readFile 'default.nix'; 92 - $nix =~ s/(= build\w+ rec \{.+?\};\n\n)/update_nix_block($1)/gse; 93 - writeFile 'default.nix', $nix; 72 + my $nix = read_file 'default.nix'; 73 + $nix =~ s/(= build\w+ rec \{.+?\n \};\n)/update_nix_block($1)/gse; 74 + write_file 'default.nix', $nix;