forked from lix-project/hydra
File::Slurp -> File::Slurper
This commit is contained in:
parent
c54629b732
commit
c880888f1e
9 changed files with 10 additions and 14 deletions
|
@ -454,7 +454,7 @@
|
||||||
DigestSHA1
|
DigestSHA1
|
||||||
EmailMIME
|
EmailMIME
|
||||||
EmailSender
|
EmailSender
|
||||||
FileSlurp
|
FileSlurper
|
||||||
FileWhich
|
FileWhich
|
||||||
final.nix.perl-bindings
|
final.nix.perl-bindings
|
||||||
git
|
git
|
||||||
|
|
|
@ -12,7 +12,6 @@ use JSON::Any;
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Digest::SHA qw(sha256_hex);
|
use Digest::SHA qw(sha256_hex);
|
||||||
use Text::Diff;
|
use Text::Diff;
|
||||||
use File::Slurp;
|
|
||||||
use IPC::Run qw(run);
|
use IPC::Run qw(run);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ use Hydra::Helper::Nix;
|
||||||
use Hydra::Helper::CatalystUtils;
|
use Hydra::Helper::CatalystUtils;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use File::stat;
|
use File::stat;
|
||||||
use File::Slurp;
|
|
||||||
use Data::Dump qw(dump);
|
use Data::Dump qw(dump);
|
||||||
use Nix::Store;
|
use Nix::Store;
|
||||||
use Nix::Config;
|
use Nix::Config;
|
||||||
|
|
|
@ -4,7 +4,7 @@ use utf8;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use base 'Hydra::Base::Controller::REST';
|
use base 'Hydra::Base::Controller::REST';
|
||||||
use File::Slurp;
|
use File::Slurper qw(read_text);
|
||||||
use Crypt::RandPasswd;
|
use Crypt::RandPasswd;
|
||||||
use Digest::SHA1 qw(sha1_hex);
|
use Digest::SHA1 qw(sha1_hex);
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
|
@ -165,7 +165,7 @@ sub github_login :Path('/github-login') Args(0) {
|
||||||
my $client_id = $c->config->{github_client_id} or die "github_client_id not configured.";
|
my $client_id = $c->config->{github_client_id} or die "github_client_id not configured.";
|
||||||
my $client_secret = $c->config->{github_client_secret} // do {
|
my $client_secret = $c->config->{github_client_secret} // do {
|
||||||
my $client_secret_file = $c->config->{github_client_secret_file} or die "github_client_secret nor github_client_secret_file is configured.";
|
my $client_secret_file = $c->config->{github_client_secret_file} or die "github_client_secret nor github_client_secret_file is configured.";
|
||||||
my $client_secret = read_file($client_secret_file);
|
my $client_secret = read_text($client_secret_file);
|
||||||
$client_secret =~ s/\s+//;
|
$client_secret =~ s/\s+//;
|
||||||
$client_secret;
|
$client_secret;
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,6 @@ use File::stat;
|
||||||
use File::Path;
|
use File::Path;
|
||||||
use File::Temp;
|
use File::Temp;
|
||||||
use File::Spec;
|
use File::Spec;
|
||||||
use File::Slurp;
|
|
||||||
use Hydra::Helper::CatalystUtils;
|
use Hydra::Helper::CatalystUtils;
|
||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
|
|
|
@ -5,7 +5,6 @@ use warnings;
|
||||||
use Email::MIME;
|
use Email::MIME;
|
||||||
use Email::Sender::Simple qw(sendmail);
|
use Email::Sender::Simple qw(sendmail);
|
||||||
use Exporter 'import';
|
use Exporter 'import';
|
||||||
use File::Slurp;
|
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
use Sys::Hostname::Long;
|
use Sys::Hostname::Long;
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ use Config::General;
|
||||||
use Data::Dump qw(dump);
|
use Data::Dump qw(dump);
|
||||||
use Digest::SHA qw(sha256_hex);
|
use Digest::SHA qw(sha256_hex);
|
||||||
use Encode;
|
use Encode;
|
||||||
use File::Slurp;
|
use File::Slurper qw(read_text);
|
||||||
use Hydra::Helper::AddBuilds;
|
use Hydra::Helper::AddBuilds;
|
||||||
use Hydra::Helper::CatalystUtils;
|
use Hydra::Helper::CatalystUtils;
|
||||||
use Hydra::Helper::Email;
|
use Hydra::Helper::Email;
|
||||||
|
@ -569,7 +569,7 @@ sub checkJobsetWrapped {
|
||||||
die "multiple alternatives for the input containing the declarative project specification are not supported\n"
|
die "multiple alternatives for the input containing the declarative project specification are not supported\n"
|
||||||
if scalar @declInputs != 1;
|
if scalar @declInputs != 1;
|
||||||
my $declFile = $declInput->{storePath} . "/" . $project->declfile;
|
my $declFile = $declInput->{storePath} . "/" . $project->declfile;
|
||||||
my $declText = read_file($declFile)
|
my $declText = read_text($declFile)
|
||||||
or die "Couldn't read declarative specification file $declFile: $!\n";
|
or die "Couldn't read declarative specification file $declFile: $!\n";
|
||||||
my $declSpec;
|
my $declSpec;
|
||||||
eval {
|
eval {
|
||||||
|
|
|
@ -5,7 +5,7 @@ use warnings;
|
||||||
use Hydra::Schema;
|
use Hydra::Schema;
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
use Hydra::Model::DB;
|
use Hydra::Model::DB;
|
||||||
use File::Slurp;
|
use File::Slurper qw(read_text);
|
||||||
use SQL::SplitStatement;
|
use SQL::SplitStatement;
|
||||||
use List::Util qw(max);
|
use List::Util qw(max);
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ my $maxSchemaVersion = max (map { /.*\/upgrade-(\d.*)\.sql/; $1 } (glob "$home/s
|
||||||
my @tables = $dbh->tables;
|
my @tables = $dbh->tables;
|
||||||
if (! grep { /SchemaVersion/i } @tables) {
|
if (! grep { /SchemaVersion/i } @tables) {
|
||||||
print STDERR "initialising the Hydra database schema...\n";
|
print STDERR "initialising the Hydra database schema...\n";
|
||||||
my $schema = read_file(
|
my $schema = read_text(
|
||||||
$dbh->{Driver}->{Name} eq 'Pg' ? "$home/sql/hydra.sql" :
|
$dbh->{Driver}->{Name} eq 'Pg' ? "$home/sql/hydra.sql" :
|
||||||
die "unsupported database type $dbh->{Driver}->{Name}\n");
|
die "unsupported database type $dbh->{Driver}->{Name}\n");
|
||||||
my @statements = $sql_splitter->split($schema);
|
my @statements = $sql_splitter->split($schema);
|
||||||
|
@ -58,7 +58,7 @@ QUOTE
|
||||||
for (my $n = $schemaVersion; $n < $maxSchemaVersion; $n++) {
|
for (my $n = $schemaVersion; $n < $maxSchemaVersion; $n++) {
|
||||||
my $m = $n + 1;
|
my $m = $n + 1;
|
||||||
print STDERR "upgrading Hydra schema from version $n to $m\n";
|
print STDERR "upgrading Hydra schema from version $n to $m\n";
|
||||||
my $schema = read_file("$home/sql/upgrade-$m.sql");
|
my $schema = read_text("$home/sql/upgrade-$m.sql");
|
||||||
my @statements = $sql_splitter->split($schema);
|
my @statements = $sql_splitter->split($schema);
|
||||||
eval {
|
eval {
|
||||||
$dbh->begin_work;
|
$dbh->begin_work;
|
||||||
|
|
|
@ -5,7 +5,7 @@ use warnings;
|
||||||
use utf8;
|
use utf8;
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
use Net::Statsd;
|
use Net::Statsd;
|
||||||
use File::Slurp;
|
use File::Slurper qw(read_text);
|
||||||
use JSON;
|
use JSON;
|
||||||
use Getopt::Long qw(:config gnu_getopt);
|
use Getopt::Long qw(:config gnu_getopt);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ while (1) {
|
||||||
1;
|
1;
|
||||||
} or do { warn "$@"; };
|
} or do { warn "$@"; };
|
||||||
|
|
||||||
my $meminfo = read_file("/proc/meminfo", err_mode => 'quiet') // "";
|
my $meminfo = read_text("/proc/meminfo") // "";
|
||||||
$meminfo =~ m/Dirty:\s*(\d+) kB/;
|
$meminfo =~ m/Dirty:\s*(\d+) kB/;
|
||||||
if (defined $1) {
|
if (defined $1) {
|
||||||
my $dirty = $1 / (1024.0 * 1024.0);
|
my $dirty = $1 / (1024.0 * 1024.0);
|
||||||
|
|
Loading…
Reference in a new issue