BDSD2JLV4V4I52SE7MCZLYNDC4XU27ZNH7TYKLT7CA7YR5WRMQBAC
2T42QGZDK23C5V4ZHO4R7EBJESIQ62GKWDBWVX7OBEE3YVBUNUFAC
2JQ7WEFMU5IPCUKLGRLVVT4MYMKVHJDZVMOOOPL6K5RLEZ532LGQC
IN272KZWHENW2TCR3LWQ6OZAEESJL5S7AEL3GYLJTWHJUDE6HADAC
2GK5DOU7ODF4WBSN3QTD3WIO52VTL2LOAXKGCDEMMAQPTEO4A4HAC
WZ3AEJ67LOG5L335AAC2BDLIJPIU4VSCGBMATBHDZC26ECRS5A6AC
AFTXA575C6JTVLVXTYJUKQGPLBO3NFORLO5XDSPHNL44HXLRH4TAC
IWVA2P2Y2RMX3F6AQNJ5JMK6VTAAC2YCQT25GYN5TTEXUWCBDY2QC
Y35C6GHH45ZUEZHHYZU4BQK3GOPJENOY2DZM3TMVUA6AMSPT2I7AC
}
sub queryPathInfo {
my $path = shift;
# !!! like above, this breaks abstraction. What we really need is
# Perl bindings for libstore :-)
open FH, "</nix/var/nix/db/info/" . basename $path
or die "cannot open info file for $path";
my $hash;
my $deriver;
my @refs = ();
while (<FH>) {
if (/^Hash: (\S+)$/) {
$hash = $1;
}
elsif (/^Deriver: (\S+)$/) {
$deriver = $1;
}
elsif (/^References: (.*)$/) {
@refs = split / /, $1;
}
}
close FH;
die unless defined $hash;
return ($hash, $deriver, \@refs);