forked from lix-project/hydra
Use the new Nix Perl bindings
This commit is contained in:
parent
5333c67bf9
commit
c613b885f2
2
deps.nix
2
deps.nix
|
@ -33,5 +33,5 @@ with pkgs;
|
||||||
perlPackages.TestMore
|
perlPackages.TestMore
|
||||||
perlPackages.SysHostnameLong
|
perlPackages.SysHostnameLong
|
||||||
perlPackages.Starman
|
perlPackages.Starman
|
||||||
perlPackages.nixPerl
|
nixUnstable
|
||||||
]
|
]
|
||||||
|
|
|
@ -8,7 +8,7 @@ use Hydra::Helper::CatalystUtils;
|
||||||
use Hydra::Helper::AddBuilds;
|
use Hydra::Helper::AddBuilds;
|
||||||
use File::stat;
|
use File::stat;
|
||||||
use Data::Dump qw(dump);
|
use Data::Dump qw(dump);
|
||||||
use Nix;
|
use Nix::Store;
|
||||||
|
|
||||||
|
|
||||||
sub build : Chained('/') PathPart CaptureArgs(1) {
|
sub build : Chained('/') PathPart CaptureArgs(1) {
|
||||||
|
@ -41,7 +41,7 @@ sub view_build : Chained('build') PathPart('') Args(0) {
|
||||||
$c->stash->{drvAvailable} = isValidPath $build->drvpath;
|
$c->stash->{drvAvailable} = isValidPath $build->drvpath;
|
||||||
$c->stash->{flashMsg} = $c->flash->{buildMsg};
|
$c->stash->{flashMsg} = $c->flash->{buildMsg};
|
||||||
|
|
||||||
my $pathHash = $c->stash->{available} ? Nix::queryPathHash($build->outpath) : "Not available";
|
my $pathHash = $c->stash->{available} ? queryPathHash($build->outpath) : "Not available";
|
||||||
$c->stash->{pathHash} = $pathHash;
|
$c->stash->{pathHash} = $pathHash;
|
||||||
|
|
||||||
if (!$build->finished && $build->schedulingInfo->busy) {
|
if (!$build->finished && $build->schedulingInfo->busy) {
|
||||||
|
|
|
@ -5,6 +5,7 @@ use feature 'switch';
|
||||||
use XML::Simple;
|
use XML::Simple;
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
use IPC::Run;
|
use IPC::Run;
|
||||||
|
use Nix::Store;
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
use Digest::SHA qw(sha256_hex);
|
use Digest::SHA qw(sha256_hex);
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
|
|
@ -3,6 +3,7 @@ package Hydra::Helper::CatalystUtils;
|
||||||
use strict;
|
use strict;
|
||||||
use Exporter;
|
use Exporter;
|
||||||
use Readonly;
|
use Readonly;
|
||||||
|
use Nix::Store;
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
|
@ -117,8 +118,8 @@ sub getChannelData {
|
||||||
|
|
||||||
my @storePaths = ();
|
my @storePaths = ();
|
||||||
foreach my $build (@builds2) {
|
foreach my $build (@builds2) {
|
||||||
next unless Hydra::Helper::Nix::isValidPath($build->outpath);
|
next unless isValidPath($build->outpath);
|
||||||
if (Hydra::Helper::Nix::isValidPath($build->drvpath)) {
|
if (isValidPath($build->drvpath)) {
|
||||||
# Adding `drvpath' implies adding `outpath' because of the
|
# Adding `drvpath' implies adding `outpath' because of the
|
||||||
# `--include-outputs' flag passed to `nix-store'.
|
# `--include-outputs' flag passed to `nix-store'.
|
||||||
push @storePaths, $build->drvpath;
|
push @storePaths, $build->drvpath;
|
||||||
|
|
|
@ -4,12 +4,10 @@ use strict;
|
||||||
use Exporter;
|
use Exporter;
|
||||||
use File::Path;
|
use File::Path;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
use Nix;
|
|
||||||
use Hydra::Helper::CatalystUtils;
|
use Hydra::Helper::CatalystUtils;
|
||||||
|
|
||||||
our @ISA = qw(Exporter);
|
our @ISA = qw(Exporter);
|
||||||
our @EXPORT = qw(
|
our @EXPORT = qw(
|
||||||
isValidPath
|
|
||||||
getHydraPath getHydraDBPath openHydraDB getHydraConf txn_do
|
getHydraPath getHydraDBPath openHydraDB getHydraConf txn_do
|
||||||
registerRoot getGCRootsDir gcRootFor
|
registerRoot getGCRootsDir gcRootFor
|
||||||
getPrimaryBuildsForView
|
getPrimaryBuildsForView
|
||||||
|
@ -17,12 +15,6 @@ our @EXPORT = qw(
|
||||||
getViewResult getLatestSuccessfulViewResult jobsetOverview removeAsciiEscapes);
|
getViewResult getLatestSuccessfulViewResult jobsetOverview removeAsciiEscapes);
|
||||||
|
|
||||||
|
|
||||||
sub isValidPath {
|
|
||||||
my $path = shift;
|
|
||||||
return Nix::isValidPath($path);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub getHydraPath {
|
sub getHydraPath {
|
||||||
my $dir = $ENV{"HYDRA_DATA"} || "/var/lib/hydra";
|
my $dir = $ENV{"HYDRA_DATA"} || "/var/lib/hydra";
|
||||||
die "The HYDRA_DATA directory ($dir) does not exist!\n" unless -d $dir;
|
die "The HYDRA_DATA directory ($dir) does not exist!\n" unless -d $dir;
|
||||||
|
|
|
@ -3,7 +3,7 @@ package Hydra::View::NixManifest;
|
||||||
use strict;
|
use strict;
|
||||||
use base qw/Catalyst::View/;
|
use base qw/Catalyst::View/;
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
use Nix;
|
use Nix::Store;
|
||||||
|
|
||||||
|
|
||||||
sub process {
|
sub process {
|
||||||
|
@ -13,7 +13,7 @@ sub process {
|
||||||
|
|
||||||
$c->response->content_type('text/x-nix-manifest');
|
$c->response->content_type('text/x-nix-manifest');
|
||||||
|
|
||||||
my @paths = Nix::computeFSClosure(0, 1, @storePaths);
|
my @paths = computeFSClosure(0, 1, @storePaths);
|
||||||
|
|
||||||
my $manifest =
|
my $manifest =
|
||||||
"version {\n" .
|
"version {\n" .
|
||||||
|
@ -21,7 +21,7 @@ sub process {
|
||||||
"}\n";
|
"}\n";
|
||||||
|
|
||||||
foreach my $path (@paths) {
|
foreach my $path (@paths) {
|
||||||
my ($deriver, $hash, $time, $narSize, $refs) = Nix::queryPathInfo $path;
|
my ($deriver, $hash, $time, $narSize, $refs) = queryPathInfo $path;
|
||||||
|
|
||||||
# Escape the characters that are allowed to appear in a Nix
|
# Escape the characters that are allowed to appear in a Nix
|
||||||
# path name but have special meaning in a URI.
|
# path name but have special meaning in a URI.
|
||||||
|
|
|
@ -7,7 +7,7 @@ use POSIX qw(dup2 :sys_wait_h);
|
||||||
use Hydra::Schema;
|
use Hydra::Schema;
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
use IO::Handle;
|
use IO::Handle;
|
||||||
use Nix;
|
use Nix::Store;
|
||||||
|
|
||||||
chdir getHydraPath or die;
|
chdir getHydraPath or die;
|
||||||
my $db = openHydraDB;
|
my $db = openHydraDB;
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
use strict;
|
use strict;
|
||||||
use File::Path;
|
use File::Path;
|
||||||
use File::Basename;
|
use File::Basename;
|
||||||
|
use Nix::Store;
|
||||||
use Hydra::Schema;
|
use Hydra::Schema;
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
use POSIX qw(strftime);
|
use POSIX qw(strftime);
|
||||||
|
|
Loading…
Reference in a new issue