From e582ee67cd682c13667daccf33e8071189ef946c Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 21 Mar 2003 14:10:06 +0000 Subject: [PATCH] * Fetch sources from the network. --- pkg/aterm-2.0-build.sh | 2 +- pkg/aterm-2.0.nix | 3 ++- src/nix-instantiate | 34 +++++++++++++++++++++++++++++----- test/build/gtk+-build.sh | 2 +- test/build/pan-build.sh | 2 +- test/register | 19 ++++++++++++------- test/tmpl/aterm-2.0.nix | 2 +- test/tmpl/atk-1.2.0.nix | 2 +- test/tmpl/glib-2.2.1.nix | 2 +- test/tmpl/gnet-1.1.8.nix | 2 +- test/tmpl/gtk+-2.2.1.nix | 2 +- test/tmpl/pango-1.2.1.nix | 2 +- test/tmpl/pkgconfig-0.15.0.nix | 2 +- 13 files changed, 53 insertions(+), 23 deletions(-) diff --git a/pkg/aterm-2.0-build.sh b/pkg/aterm-2.0-build.sh index 5d65b7878..872e7aac8 100755 --- a/pkg/aterm-2.0-build.sh +++ b/pkg/aterm-2.0-build.sh @@ -1,6 +1,6 @@ #! /bin/sh -export PATH=$utils/bin +export PATH=$sys1/bin:$sys2/bin export LIBRARY_PATH=$glibc/lib export CC=$gcc/bin/gcc export CFLAGS="-isystem $glibc/include -isystem $kernel/include" diff --git a/pkg/aterm-2.0.nix b/pkg/aterm-2.0.nix index 2484001be..da2494ad8 100644 --- a/pkg/aterm-2.0.nix +++ b/pkg/aterm-2.0.nix @@ -1,5 +1,6 @@ # Dependencies. -utils <- 5703121fe19cbeeaee7edd659cf4a25b # prog-bootstrap +sys1 <- 1e80cb7e0fbfc9f5c0509a465ecdf6cf # sys1-bootstrap +sys2 <- 7512824c50c61ea8d89d0f193a4f72d1 # sys2-bootstrap gcc <- 02212b3dc4e50349376975367d433929 # gcc-bootstrap glibc <- c0ce03ee0bab298babbe7e3b6159d36c # glibc-bootstrap kernel <- 3dc8333a2c2b4d627b892755417acf89 # kernel-bootstrap diff --git a/src/nix-instantiate b/src/nix-instantiate index 4823d2212..63c858864 100755 --- a/src/nix-instantiate +++ b/src/nix-instantiate @@ -4,10 +4,34 @@ use strict; use FileHandle; use File::Spec; -my $outdir = $ARGV[0]; +my $outdir = File::Spec->rel2abs($ARGV[0]); +my $netdir = File::Spec->rel2abs($ARGV[1]); my %donetmpls = (); +sub fetchFile { + my $loc = shift; + + if ($loc =~ /^([+\w\d\.\/-]+)$/) { + return $1; + } elsif ($loc =~ /^url\((.*)\)$/) { + my $url = $1; + $url =~ /\/([^\/]+)$/ || die "invalid url $url"; + my $fn = "$netdir/$1"; + if (! -f $fn) { + print "fetching $url...\n"; + system "cd $netdir; wget --quiet -N $url"; + if ($? != 0) { + unlink($fn); + die; + } + } + return $fn; + } else { + die "invalid file specified $loc"; + } +} + sub convert { my $descr = shift; @@ -28,9 +52,9 @@ sub convert { while (<$IN>) { chomp; - if (/^(\w+)\s*=\s*([+\w\d\.\/-]+)\s*(\#.*)?$/) { - my $name = $1; - my $file = $2; + if (/^(\w+)\s*=\s*([^\#\s]*)\s*(\#.*)?$/) { + my ($name, $loc) = ($1, $2); + my $file = fetchFile($loc); $file = File::Spec->rel2abs($file, $dir); my $out = `md5sum $file`; die unless ($? == 0); @@ -56,6 +80,6 @@ sub convert { return $outfile; } -for (my $i = 1; $i < scalar @ARGV; $i++) { +for (my $i = 2; $i < scalar @ARGV; $i++) { convert(File::Spec->rel2abs($ARGV[$i])); } diff --git a/test/build/gtk+-build.sh b/test/build/gtk+-build.sh index 8c887fec4..d2b3d694a 100755 --- a/test/build/gtk+-build.sh +++ b/test/build/gtk+-build.sh @@ -2,7 +2,7 @@ export PATH=$pkgconfig/bin:/bin:/usr/bin export PKG_CONFIG_PATH=$glib/lib/pkgconfig:$atk/lib/pkgconfig:$pango/lib/pkgconfig -export LD_LIBRARY_PATH=$glib/lib +export LD_LIBRARY_PATH=$glib/lib:$atk/lib:$pango/lib top=`pwd` tar xvfj $src diff --git a/test/build/pan-build.sh b/test/build/pan-build.sh index 468814ff6..a29255881 100755 --- a/test/build/pan-build.sh +++ b/test/build/pan-build.sh @@ -2,7 +2,7 @@ export PATH=$pkgconfig/bin:$gnet/bin:/bin:/usr/bin export PKG_CONFIG_PATH=$glib/lib/pkgconfig:$atk/lib/pkgconfig:$pango/lib/pkgconfig:$gtk/lib/pkgconfig -export LD_LIBRARY_PATH=$gnet/lib +export LD_LIBRARY_PATH=$gnet/lib:$atk/lib:$pango/lib:$gtk/lib:$gnet/lib top=`pwd` tar xvfj $src diff --git a/test/register b/test/register index a50dd051a..60cabd292 100755 --- a/test/register +++ b/test/register @@ -1,17 +1,22 @@ #! /bin/sh +root=/home/eelco/Dev/nix/test +cd $root + +mkdir -p db +mkdir -p pkg +mkdir -p descr +mkdir -p netcache + nix init -root=/home/eelco/Dev/nix/test - -cd $root/tmpl - -if ! nix-instantiate $root/descr $root/tmpl/*.nix; then +if ! nix-instantiate descr netcache tmpl/*.nix; then exit 1; fi -for i in $root/dist/*; do nix regfile $i; done -for i in $root/descr/*; do +for i in netcache/*; do nix regfile $i; done +for i in build/*; do nix regfile $i; done +for i in descr/*; do md5sum $i nix regfile $i done diff --git a/test/tmpl/aterm-2.0.nix b/test/tmpl/aterm-2.0.nix index b65714e6a..24c427faf 100644 --- a/test/tmpl/aterm-2.0.nix +++ b/test/tmpl/aterm-2.0.nix @@ -1,5 +1,5 @@ # Original sources. -src = ../dist/aterm-2.0.tar.gz +src = url(http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.tar.gz) # Build script. build = ../build/aterm-build.sh diff --git a/test/tmpl/atk-1.2.0.nix b/test/tmpl/atk-1.2.0.nix index d540c90d8..9899a95b1 100644 --- a/test/tmpl/atk-1.2.0.nix +++ b/test/tmpl/atk-1.2.0.nix @@ -1,6 +1,6 @@ pkgconfig <- ./pkgconfig-0.15.0.nix glib <- ./glib-2.2.1.nix -src = ../dist/atk-1.2.0.tar.bz2 +src = url(ftp://ftp.gtk.org/pub/gtk/v2.2/atk-1.2.0.tar.bz2) build = ../build/atk-build.sh diff --git a/test/tmpl/glib-2.2.1.nix b/test/tmpl/glib-2.2.1.nix index 5e5c6efdd..d9fdf0f1f 100644 --- a/test/tmpl/glib-2.2.1.nix +++ b/test/tmpl/glib-2.2.1.nix @@ -1,5 +1,5 @@ pkgconfig <- ./pkgconfig-0.15.0.nix -src = ../dist/glib-2.2.1.tar.bz2 +src = url(ftp://ftp.gtk.org/pub/gtk/v2.2/glib-2.2.1.tar.bz2) build = ../build/glib-build.sh diff --git a/test/tmpl/gnet-1.1.8.nix b/test/tmpl/gnet-1.1.8.nix index 672cfdf5a..7f2b33cab 100644 --- a/test/tmpl/gnet-1.1.8.nix +++ b/test/tmpl/gnet-1.1.8.nix @@ -1,6 +1,6 @@ pkgconfig <- ./pkgconfig-0.15.0.nix glib <- ./glib-2.2.1.nix -src = ../dist/gnet-1.1.8.tar.gz +src = url(http://www.gnetlibrary.org/src/gnet-1.1.8.tar.gz) build = ../build/gnet-build.sh diff --git a/test/tmpl/gtk+-2.2.1.nix b/test/tmpl/gtk+-2.2.1.nix index 30c77aec3..b1a6fcbfb 100644 --- a/test/tmpl/gtk+-2.2.1.nix +++ b/test/tmpl/gtk+-2.2.1.nix @@ -3,6 +3,6 @@ glib <- ./glib-2.2.1.nix atk <- ./atk-1.2.0.nix pango <- ./pango-1.2.1.nix -src = ../dist/gtk+-2.2.1.tar.bz2 +src = url(ftp://ftp.gtk.org/pub/gtk/v2.2/gtk+-2.2.1.tar.bz2) build = ../build/gtk+-build.sh diff --git a/test/tmpl/pango-1.2.1.nix b/test/tmpl/pango-1.2.1.nix index 2436bc49a..4be4c8991 100644 --- a/test/tmpl/pango-1.2.1.nix +++ b/test/tmpl/pango-1.2.1.nix @@ -1,6 +1,6 @@ pkgconfig <- ./pkgconfig-0.15.0.nix glib <- ./glib-2.2.1.nix -src = ../dist/pango-1.2.1.tar.bz2 +src = url(ftp://ftp.gtk.org/pub/gtk/v2.2/pango-1.2.1.tar.bz2) build = ../build/pango-build.sh diff --git a/test/tmpl/pkgconfig-0.15.0.nix b/test/tmpl/pkgconfig-0.15.0.nix index 882a69234..3ee7c13cd 100644 --- a/test/tmpl/pkgconfig-0.15.0.nix +++ b/test/tmpl/pkgconfig-0.15.0.nix @@ -1,3 +1,3 @@ -src = ../dist/pkgconfig-0.15.0.tar.gz +src = url(http://www.freedesktop.org/software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz) build = ../build/pkgconfig-build.sh