about summary refs log blame commit diff
path: root/src/nix-instantiate
blob: 242bcfaf9332641b0fe5e00dcb8f9049383e6860 (plain) (tree)






















                                                   
#! /usr/bin/perl -w

my $descr = $ARGV[0];

open DESCR, "< $descr";

while (<DESCR>) {
    chomp;

    if (/^(\w+)\s*=\s*([\w\d\.\/-]+)\s*(\#.*)?$/) {
	my $name = $1;
	my $file = $2;
	my $out = `md5sum $file`;
	$out =~ /^([0-9a-f]+)\s/;
	my $hash = $1;
        print "$name = $hash\n";
    } else {
	print "$_\n";
    }

}

close DESCR;