clone nix-dist to create strategoxt-dist

svn path=/nixpkgs/trunk/; revision=603
This commit is contained in:
Eelco Visser 2003-12-29 17:01:32 +00:00
parent 5fb4265643
commit 68361ac199
9 changed files with 225 additions and 0 deletions

29
strategoxt-dist/build+upload.sh Executable file
View File

@ -0,0 +1,29 @@
#! /bin/sh
url="https://svn.cs.uu.nl:12443/repos/trace/nix/trunk/"
if ! rev=$(curl --silent -k https://svn.cs.uu.nl:12443/repos/trace/nix/trunk/ \
| grep '<h2>Revision' \
| sed 's/.*Revision \(.*\):.*/\1/'); \
then exit 1; fi
echo "building revision $rev of $url"
echo $rev > head-revision.nix
if ! storeexprs=($(nix-instantiate -vvv do-it.nix)); then exit 1; fi
srcexpr=${storeexprs[0]}
testexpr=${storeexprs[1]}
if ! nix-store -vvvv -r "$srcexpr" > /dev/null; then exit 1; fi
if ! outpath=$(nix-store -qn "$srcexpr"); then exit 1; fi
uploader="http://losser.st-lab.cs.uu.nl/~eelco/cgi-bin/upload.pl/"
curl --silent -T "$outpath/manual.html" "$uploader" || exit 1
curl --silent -T "$outpath/style.css" "$uploader" || exit 1
curl --silent -T "$outpath"/nix-*.tar.bz2 "$uploader" || exit 1
if ! nix-store -vvvv -r "$testexpr" > /dev/null; then exit 1; fi

26
strategoxt-dist/do-it.nix Normal file
View File

@ -0,0 +1,26 @@
let {
system = "i686-linux";
pkgs = (import ../pkgs/system/all-packages.nix) {system = system;};
stdenv = pkgs.stdenv_;
sourcedist = (import ./nix-source-dist.nix) {
stdenv = stdenv;
autoconf = pkgs.autoconf;
automake = pkgs.automake;
libxml2 = pkgs.libxml2;
libxslt = pkgs.libxslt;
docbook_dtd = pkgs.docbook_xml_dtd;
docbook_xslt = pkgs.docbook_xml_xslt;
fetchurl = pkgs.fetchurl;
fetchsvn = pkgs.fetchsvn;
rev = import ./head-revision.nix;
};
testbuild = (import ./nix-test-build.nix) {
stdenv = stdenv;
getopt = pkgs.getopt;
src = sourcedist;
};
body = [sourcedist testbuild];
}

33
strategoxt-dist/mail-result.sh Executable file
View File

@ -0,0 +1,33 @@
#! /bin/sh
email=$1
shift
logfile=/tmp/logfile-$$ # !!! security
trap "rm $logfile" EXIT
echo $logfile
if ! "$@" > $logfile 2>&1; then
BLOCKER=/tmp/inhibit-notify
if ! test -f $BLOCKER; then
HEAD=`head $logfile`
TAIL=`tail $logfile`
bzip2 < $logfile > $logfile.bz2
mail -s "Nix build failed" -a $logfile.bz2 $email <<EOF
A Nix build failed. See the attached log file for details.
No further messages will be sent until the file $BLOCKER is removed.
The first few lines of the log are:
$HEAD
The last few lines are:
$TAIL
EOF
rm $logfile.bz2
touch $BLOCKER
fi
fi

View File

@ -0,0 +1,38 @@
{ stdenv, autoconf, automake, libxml2, libxslt
, docbook_dtd, docbook_xslt
, fetchurl, fetchsvn, rev
}:
derivation {
name = "nix-source-dist";
system = stdenv.system;
builder = ./nix-source-dist.sh;
src = fetchsvn {
url = "https://svn.cs.uu.nl:12443/repos/trace/nix/trunk/";
rev = rev;
};
bdbSrc = fetchurl {
url = "http://www.sleepycat.com/update/snapshot/db-4.1.25.tar.gz";
md5 = "df71961002b552c0e72c6e4e358f27e1";
};
atermSrc = fetchurl {
url = http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.0.5.tar.gz;
md5 = "68aefb0c10b2ab876b8d3c0b2d0cdb1b";
};
sdfSrc = fetchurl {
url = ftp://ftp.stratego-language.org/pub/stratego/sdf2/sdf2-bundle-1.6.tar.gz;
md5 = "283be0b4c7c9575c1b5cc735316e6192";
};
stdenv = stdenv;
autoconf = autoconf;
automake = automake;
libxml2 = libxml2;
libxslt = libxslt;
docbook_dtd = docbook_dtd;
docbook_xslt = docbook_xslt;
}

View File

@ -0,0 +1,32 @@
#! /bin/sh
buildinputs="$autoconf $automake $libxml2 $libxslt"
. $stdenv/setup
echo "copying sources..."
cp -prd $src/* . || exit 1
chmod -R u+w . || exit 1
cp -p $bdbSrc externals/db-4.1.25.tar.gz || exit 1 # !!!
cp -p $atermSrc externals/aterm-2.0.5.tar.gz || exit 1
cp -p $sdfSrc externals/sdf2-bundle-1.6.tar.gz || exit 1
echo "autoconfing..."
autoreconf -i || exit 1
echo "configuring..."
./configure \
--with-docbook-catalog=$docbook_dtd/xml/dtd/docbook/docbook.cat \
--with-docbook-xsl=$docbook_xslt/xml/xsl/docbook \
--with-xml-flags="--nonet" || exit 1
echo "building..."
make distdir || exit 1
pkgname=$(echo nix-*)
tar cvfz $pkgname.tar.gz $pkgname || exit 1
tar cvfj $pkgname.tar.bz2 $pkgname || exit 1
echo "copying result..."
mkdir $out || exit 1
cp -p $pkgname.tar.gz $pkgname.tar.bz2 $out || exit 1
cp -p doc/manual/book.html $out/manual.html || exit 1
cp -p doc/manual/style.css $out/ || exit 1

View File

@ -0,0 +1,12 @@
{stdenv, getopt, src}:
derivation {
name = "nix-test-build";
system = stdenv.system;
builder = ./nix-test-build.sh;
src = src;
stdenv = stdenv;
getopt = getopt; # required by sdf2table
}

View File

@ -0,0 +1,11 @@
#! /bin/sh
buildinputs="$getopt"
. $stdenv/setup || exit 1
tar xvfj $src/*.tar.bz2 || exit 1
cd nix-* || exit 1
./configure --prefix=$out || exit 1
make || exit 1
make check || exit 1
make install || exit 1

View File

@ -0,0 +1,21 @@
#! /usr/bin/perl -w
use strict;
use FileHandle;
use File::Spec;
use Digest::MD5;
my $path = $ENV{"PATH_INFO"};
# Sanitise path.
die unless $path =~ /^(\/[A-Za-z0-9-][A-Za-z0-9-\.]+)+$/;
my $fullpath = "/home/eelco/public_html/nix/$path";
open FILE, "< $fullpath" or die "cannot open $fullpath";
# !!! error checking
my $hash = Digest::MD5->new->addfile(*FILE)->hexdigest;
close FILE;
print "Content-Type: text/plain\n\n";
print "$hash";

View File

@ -0,0 +1,23 @@
#! /usr/bin/perl -w
use strict;
my $uploadpath = $ENV{"PATH_INFO"};
# Sanitise upload path.
die unless $uploadpath =~ /^(\/[A-Za-z0-9-][A-Za-z0-9-\.]+)+$/;
my $dst = "/home/eelco/public_html/nix/$uploadpath";
my $tmp = "${dst}_$$";
open OUT, ">$tmp" or die;
while (<STDIN>) {
print OUT "$_" or die;
}
close OUT or die;
rename $tmp, $dst or die;
print "Content-Type: text/plain\n\n";
print "upload succesful\n";
print "upload path: $uploadpath\n";