mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
Merge pull request #26770 from volth/jetbrains-update-script-2
jetbrains updater: use perlPackages.LWPProtocolhttps
This commit is contained in:
commit
f3b626cf4d
@ -1,30 +1,11 @@
|
|||||||
#!/usr/bin/env nix-shell
|
#!/usr/bin/env nix-shell
|
||||||
#!nix-shell -i perl -p perl perlPackages.LWP
|
#!nix-shell -i perl -p perl perlPackages.LWPProtocolhttps perlPackages.FileSlurp
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use List::Util qw(reduce);
|
use List::Util qw(reduce);
|
||||||
use File::Basename qw(dirname);
|
use File::Slurp;
|
||||||
use LWP::Simple;
|
use LWP::Simple;
|
||||||
|
|
||||||
sub readFile {
|
|
||||||
my ($filename) = @_;
|
|
||||||
local $/ = undef;
|
|
||||||
open FILE, $filename or die "readFile($filename) failed: $!";
|
|
||||||
binmode FILE;
|
|
||||||
my $data = <FILE>;
|
|
||||||
close FILE;
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub writeFile {
|
|
||||||
my ($filename, $content) = @_;
|
|
||||||
make_path(dirname($filename)) or die "$!" unless -d dirname($filename);
|
|
||||||
open FH, ">$filename" or die "writeFile($filename) failed: $!";
|
|
||||||
binmode FH; # do not emit \r
|
|
||||||
print FH $content;
|
|
||||||
close FH;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub semantic_less {
|
sub semantic_less {
|
||||||
my ($a, $b) = @_;
|
my ($a, $b) = @_;
|
||||||
$a =~ s/\b(\d+)\b/sprintf("%010s", $1)/eg;
|
$a =~ s/\b(\d+)\b/sprintf("%010s", $1)/eg;
|
||||||
@ -88,6 +69,6 @@ sub update_nix_block {
|
|||||||
return $block;
|
return $block;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $nix = readFile 'default.nix';
|
my $nix = read_file 'default.nix';
|
||||||
$nix =~ s/(= build\w+ rec \{.+?\};\n\n)/update_nix_block($1)/gse;
|
$nix =~ s/(= build\w+ rec \{.+?\n \};\n)/update_nix_block($1)/gse;
|
||||||
writeFile 'default.nix', $nix;
|
write_file 'default.nix', $nix;
|
||||||
|
Loading…
Reference in New Issue
Block a user