mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 00:08:07 +02:00
* Switched from wget to curl.
* Made the dependencies on bzip2 and the shell explicit.
This commit is contained in:
parent
59b94ee18a
commit
03f1d1ecb5
11 changed files with 47 additions and 36 deletions
|
@ -42,7 +42,10 @@ AC_LANG_PUSH(C++)
|
||||||
AC_CHECK_HEADERS([locale])
|
AC_CHECK_HEADERS([locale])
|
||||||
AC_LANG_POP(C++)
|
AC_LANG_POP(C++)
|
||||||
|
|
||||||
AC_PATH_PROG(wget, wget)
|
AC_PATH_PROG(curl, curl)
|
||||||
|
AC_PATH_PROG(bzip2, bzip2)
|
||||||
|
AC_PATH_PROG(bunzip2, bunzip2)
|
||||||
|
AC_PATH_PROG(shell, sh)
|
||||||
AC_PATH_PROG(xmllint, xmllint)
|
AC_PATH_PROG(xmllint, xmllint)
|
||||||
AC_PATH_PROG(xsltproc, xsltproc)
|
AC_PATH_PROG(xsltproc, xsltproc)
|
||||||
AC_PATH_PROG(flex, flex, false)
|
AC_PATH_PROG(flex, flex, false)
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
#! /bin/sh
|
#! @shell@ -e
|
||||||
|
|
||||||
export PATH=/bin:/usr/bin
|
export PATH=/bin:/usr/bin
|
||||||
|
|
||||||
echo "downloading $url into $out..."
|
echo "downloading $url into $out"
|
||||||
|
|
||||||
prefetch=@prefix@/store/nix-prefetch-url-$md5
|
prefetch=@prefix@/store/nix-prefetch-url-$md5
|
||||||
if test -f "$prefetch"; then
|
if test -f "$prefetch"; then
|
||||||
echo "using prefetched $prefetch";
|
echo "using prefetched $prefetch";
|
||||||
mv $prefetch $out || exit 1
|
mv $prefetch $out
|
||||||
else
|
else
|
||||||
@wget@ --passive-ftp "$url" -O "$out" || exit 1
|
@curl@ --fail --location --max-redirs 20 "$url" > "$out"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
actual=$(@bindir@/nix-hash --flat $out)
|
actual=$(@bindir@/nix-hash --flat $out)
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
#! /bin/sh
|
#! @shell@ -e
|
||||||
|
|
||||||
|
# !!! impure; fix this
|
||||||
export PATH=/bin:/usr/bin
|
export PATH=/bin:/usr/bin
|
||||||
|
|
||||||
echo "packing $path into $out..."
|
echo "packing $path into $out..."
|
||||||
mkdir $out || exit 1
|
mkdir $out
|
||||||
dst=$out/`basename $path`.nar.bz2
|
dst=$out/$(basename $path).nar.bz2
|
||||||
@bindir@/nix-store --dump "$path" | bzip2 > $dst || exit 1
|
@bindir@/nix-store --dump "$path" | @bzip2@ > $dst
|
||||||
|
|
||||||
md5=$(md5sum -b $dst | cut -c1-32)
|
md5=$(md5sum -b $dst | cut -c1-32)
|
||||||
if test $? != 0; then exit 1; fi
|
if test $? != 0; then exit 1; fi
|
||||||
echo $md5 > $out/md5 || exit 1
|
echo $md5 > $out/md5
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
#! /bin/sh
|
#! @shell@ -e
|
||||||
|
|
||||||
export PATH=/bin:/usr/bin
|
|
||||||
|
|
||||||
echo "unpacking $narFile to $out..."
|
echo "unpacking $narFile to $out..."
|
||||||
bunzip2 < $narFile | @bindir@/nix-store --restore "$out" || exit 1
|
@bunzip2@ < $narFile | @bindir@/nix-store --restore "$out"
|
||||||
|
|
|
@ -34,7 +34,7 @@ foreach my $link (@links) {
|
||||||
|
|
||||||
my $extraarg = "";
|
my $extraarg = "";
|
||||||
if ($keepsuccessors) { $extraarg = "--include-successors"; };
|
if ($keepsuccessors) { $extraarg = "--include-successors"; };
|
||||||
my $pid = open2(\*READ, \*WRITE, "nix-store --query --requisites $extraarg @roots")
|
my $pid = open2(\*READ, \*WRITE, "@bindir@/nix-store --query --requisites $extraarg @roots")
|
||||||
or die "determining live paths";
|
or die "determining live paths";
|
||||||
close WRITE;
|
close WRITE;
|
||||||
while (<READ>) {
|
while (<READ>) {
|
||||||
|
|
|
@ -17,7 +17,7 @@ system "bunzip2 < $pkgfile | (cd $tmpdir && tar xf -)";
|
||||||
die if $?;
|
die if $?;
|
||||||
|
|
||||||
print "This package contains the following derivations:\n";
|
print "This package contains the following derivations:\n";
|
||||||
system "nix-env -qasf $tmpdir/default.nix";
|
system "@bindir@/nix-env -qasf $tmpdir/default.nix";
|
||||||
die if $?;
|
die if $?;
|
||||||
|
|
||||||
print "Do you wish to install these (Y/N)? ";
|
print "Do you wish to install these (Y/N)? ";
|
||||||
|
@ -26,11 +26,11 @@ chomp $reply;
|
||||||
exit if (!($reply eq "y"));
|
exit if (!($reply eq "y"));
|
||||||
|
|
||||||
print "Pulling caches...\n";
|
print "Pulling caches...\n";
|
||||||
system "nix-pull `cat $tmpdir/caches`";
|
system "@bindir@/nix-pull `cat $tmpdir/caches`";
|
||||||
die if $?;
|
die if $?;
|
||||||
|
|
||||||
print "Installing package...\n";
|
print "Installing package...\n";
|
||||||
system "nix-env -if $tmpdir/default.nix '*'";
|
system "@bindir@/nix-env -if $tmpdir/default.nix '*'";
|
||||||
die if $?;
|
die if $?;
|
||||||
|
|
||||||
print "Installation succeeded! Press Enter to continue.\n";
|
print "Installation succeeded! Press Enter to continue.\n";
|
||||||
|
|
|
@ -10,7 +10,7 @@ print "fetching $url...\n";
|
||||||
|
|
||||||
my $out = "@storedir@/nix-prefetch-url-$$";
|
my $out = "@storedir@/nix-prefetch-url-$$";
|
||||||
|
|
||||||
system "@wget@ --passive-ftp '$url' -O '$out'";
|
system "@curl@ --fail --location --max-redirs 20 \"$url\" > \"$out\"";
|
||||||
$? == 0 or die "unable to fetch $url";
|
$? == 0 or die "unable to fetch $url";
|
||||||
|
|
||||||
my $hash=`@bindir@/nix-hash --flat $out`;
|
my $hash=`@bindir@/nix-hash --flat $out`;
|
||||||
|
@ -27,11 +27,12 @@ my $nixexpr =
|
||||||
"(import @datadir@/nix/corepkgs/fetchurl) " .
|
"(import @datadir@/nix/corepkgs/fetchurl) " .
|
||||||
"{url = $url; md5 = \"$hash\"; system = \"@system@\";}";
|
"{url = $url; md5 = \"$hash\"; system = \"@system@\";}";
|
||||||
|
|
||||||
print "expr: $nixexpr\n";
|
#print STDERR "expr: $nixexpr\n";
|
||||||
|
|
||||||
# Instantiate a Nix expression.
|
# Instantiate a Nix expression.
|
||||||
print STDERR "instantiating Nix expression...\n";
|
#print STDERR "instantiating Nix expression...\n";
|
||||||
my $pid = open2(\*READ, \*WRITE, "nix-instantiate -") or die "cannot run nix-instantiate";
|
my $pid = open2(\*READ, \*WRITE, "@bindir@/nix-instantiate -")
|
||||||
|
or die "cannot run nix-instantiate";
|
||||||
|
|
||||||
print WRITE $nixexpr;
|
print WRITE $nixexpr;
|
||||||
close WRITE;
|
close WRITE;
|
||||||
|
@ -43,8 +44,13 @@ waitpid $pid, 0;
|
||||||
$? == 0 or die "nix-instantiate failed";
|
$? == 0 or die "nix-instantiate failed";
|
||||||
|
|
||||||
# Run Nix.
|
# Run Nix.
|
||||||
print STDERR "realising store expression $drvpath...\n";
|
#print STDERR "realising store expression $drvpath...\n";
|
||||||
system "nix-store --realise $drvpath > /dev/null";
|
system "@bindir@/nix-store --realise $drvpath > /dev/null";
|
||||||
$? == 0 or die "realisation failed";
|
$? == 0 or die "realisation failed";
|
||||||
|
|
||||||
|
my $path = `@bindir@/nix-store -qn $drvpath`;
|
||||||
|
$? == 0 or die "query failed";
|
||||||
|
|
||||||
|
print "path is $path";
|
||||||
|
|
||||||
unlink $out2;
|
unlink $out2;
|
||||||
|
|
|
@ -65,7 +65,7 @@ $fullexpr .= "]";
|
||||||
|
|
||||||
# Instantiate store expressions from the Nix expressions we created above.
|
# Instantiate store expressions from the Nix expressions we created above.
|
||||||
print STDERR "instantiating store expressions...\n";
|
print STDERR "instantiating store expressions...\n";
|
||||||
my $pid = open2(\*READ, \*WRITE, "nix-instantiate -") or die "cannot run nix-instantiate";
|
my $pid = open2(\*READ, \*WRITE, "@bindir@/nix-instantiate -") or die "cannot run nix-instantiate";
|
||||||
|
|
||||||
print WRITE $fullexpr;
|
print WRITE $fullexpr;
|
||||||
close WRITE;
|
close WRITE;
|
||||||
|
@ -91,7 +91,7 @@ while (scalar @subs > 0) {
|
||||||
if ($n > 256) { $n = 256 };
|
if ($n > 256) { $n = 256 };
|
||||||
my @subs2 = @subs[0..$n - 1];
|
my @subs2 = @subs[0..$n - 1];
|
||||||
@subs = @subs[$n..scalar @subs - 1];
|
@subs = @subs[$n..scalar @subs - 1];
|
||||||
system "nix-store --substitute @subs2";
|
system "@bindir@/nix-store --substitute @subs2";
|
||||||
if ($?) { die "`nix-store --substitute' failed"; }
|
if ($?) { die "`nix-store --substitute' failed"; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,6 @@ while (scalar @sucs > 0) {
|
||||||
if ($n > 256) { $n = 256 };
|
if ($n > 256) { $n = 256 };
|
||||||
my @sucs2 = @sucs[0..$n - 1];
|
my @sucs2 = @sucs[0..$n - 1];
|
||||||
@sucs = @sucs[$n..scalar @sucs - 1];
|
@sucs = @sucs[$n..scalar @sucs - 1];
|
||||||
system "nix-store --successor @sucs2";
|
system "@bindir@/nix-store --successor @sucs2";
|
||||||
if ($?) { die "`nix-store --successor' failed"; }
|
if ($?) { die "`nix-store --successor' failed"; }
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ my $manifest = "$tmpdir/MANIFEST";
|
||||||
|
|
||||||
END { unlink $manifest; unlink $nixfile; rmdir $tmpdir; }
|
END { unlink $manifest; unlink $nixfile; rmdir $tmpdir; }
|
||||||
|
|
||||||
my $curl = "curl --fail --silent";
|
my $curl = "@curl@ --fail --silent";
|
||||||
|
|
||||||
|
|
||||||
# Parse the command line.
|
# Parse the command line.
|
||||||
|
@ -30,10 +30,10 @@ foreach my $storeexpr (@ARGV) {
|
||||||
|
|
||||||
# Get all paths referenced by the normalisation of the given
|
# Get all paths referenced by the normalisation of the given
|
||||||
# Nix expression.
|
# Nix expression.
|
||||||
system "nix-store --realise $storeexpr > /dev/null";
|
system "@bindir@/nix-store --realise $storeexpr > /dev/null";
|
||||||
die if ($?);
|
die if ($?);
|
||||||
|
|
||||||
open PATHS, "nix-store --query --requisites --include-successors $storeexpr 2> /dev/null |" or die;
|
open PATHS, "@bindir@/nix-store --query --requisites --include-successors $storeexpr 2> /dev/null |" or die;
|
||||||
while (<PATHS>) {
|
while (<PATHS>) {
|
||||||
chomp;
|
chomp;
|
||||||
die "bad: $_" unless /^\//;
|
die "bad: $_" unless /^\//;
|
||||||
|
@ -69,7 +69,7 @@ close NIX;
|
||||||
# Instantiate store expressions from the Nix expression.
|
# Instantiate store expressions from the Nix expression.
|
||||||
my @storeexprs;
|
my @storeexprs;
|
||||||
print STDERR "instantiating store expressions...\n";
|
print STDERR "instantiating store expressions...\n";
|
||||||
open STOREEXPRS, "nix-instantiate $nixfile |" or die "cannot run nix-instantiate";
|
open STOREEXPRS, "@bindir@/nix-instantiate $nixfile |" or die "cannot run nix-instantiate";
|
||||||
while (<STOREEXPRS>) {
|
while (<STOREEXPRS>) {
|
||||||
chomp;
|
chomp;
|
||||||
die unless /^\//;
|
die unless /^\//;
|
||||||
|
@ -90,10 +90,10 @@ while (scalar @tmp > 0) {
|
||||||
my @tmp2 = @tmp[0..$n - 1];
|
my @tmp2 = @tmp[0..$n - 1];
|
||||||
@tmp = @tmp[$n..scalar @tmp - 1];
|
@tmp = @tmp[$n..scalar @tmp - 1];
|
||||||
|
|
||||||
system "nix-store --realise -B @tmp2 > /dev/null";
|
system "@bindir@/nix-store --realise -B @tmp2 > /dev/null";
|
||||||
if ($?) { die "`nix-store --realise' failed"; }
|
if ($?) { die "`nix-store --realise' failed"; }
|
||||||
|
|
||||||
open NARPATHS, "nix-store --query --list @tmp2 |" or die "cannot run nix";
|
open NARPATHS, "@bindir@/nix-store --query --list @tmp2 |" or die "cannot run nix";
|
||||||
while (<NARPATHS>) {
|
while (<NARPATHS>) {
|
||||||
chomp;
|
chomp;
|
||||||
die unless (/^\//);
|
die unless (/^\//);
|
||||||
|
@ -135,7 +135,7 @@ for (my $n = 0; $n < scalar @storepaths; $n++) {
|
||||||
print MANIFEST " MD5: $hash\n";
|
print MANIFEST " MD5: $hash\n";
|
||||||
|
|
||||||
if ($storepath =~ /\.store$/) {
|
if ($storepath =~ /\.store$/) {
|
||||||
open PREDS, "nix-store --query --predecessors $storepath |" or die "cannot run nix";
|
open PREDS, "@bindir@/nix-store --query --predecessors $storepath |" or die "cannot run nix";
|
||||||
while (<PREDS>) {
|
while (<PREDS>) {
|
||||||
chomp;
|
chomp;
|
||||||
die unless (/^\//);
|
die unless (/^\//);
|
||||||
|
|
|
@ -10,7 +10,7 @@ sub processURL {
|
||||||
$url =~ s/\/$//;
|
$url =~ s/\/$//;
|
||||||
print "obtaining list of Nix archives at $url...\n";
|
print "obtaining list of Nix archives at $url...\n";
|
||||||
|
|
||||||
system("curl --fail --silent --show-error " .
|
system("@curl@ --fail --silent --show-error --location --max-redirs 20 " .
|
||||||
"'$url' > '$manifest' 2> /dev/null") == 0
|
"'$url' > '$manifest' 2> /dev/null") == 0
|
||||||
or die "curl failed: $?";
|
or die "curl failed: $?";
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,10 @@
|
||||||
-e "s^@libexecdir\@^$(libexecdir)^g" \
|
-e "s^@libexecdir\@^$(libexecdir)^g" \
|
||||||
-e "s^@storedir\@^$(storedir)^g" \
|
-e "s^@storedir\@^$(storedir)^g" \
|
||||||
-e "s^@system\@^$(system)^g" \
|
-e "s^@system\@^$(system)^g" \
|
||||||
-e "s^@wget\@^$(wget)^g" \
|
-e "s^@shell\@^$(shell)^g" \
|
||||||
|
-e "s^@curl\@^$(curl)^g" \
|
||||||
|
-e "s^@bzip2\@^$(bzip2)^g" \
|
||||||
|
-e "s^@bunzip2\@^$(bunzip2)^g" \
|
||||||
-e "s^@perl\@^$(perl)^g" \
|
-e "s^@perl\@^$(perl)^g" \
|
||||||
-e "s^@version\@^$(VERSION)^g" \
|
-e "s^@version\@^$(VERSION)^g" \
|
||||||
< $< > $@ || rm $@
|
< $< > $@ || rm $@
|
||||||
|
|
Loading…
Reference in a new issue