Projects
Threads by month
- ----- 2025 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- 1049 discussions
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* src/vm/virtual_machine.hh: Move the implementation of
rarely used methods to...
* src/vm/virtual_machine.cc: This file.
Index: src/vm/virtual_machine.hh
--- src/vm/virtual_machine.hh (revision 109)
+++ src/vm/virtual_machine.hh (working copy)
@@ -73,9 +73,8 @@
public:
/// Reset the vm
- void reset()
- {
- }
+ void reset();
+
/// Print the vm
void print(std::ostream& ostr) const
{
@@ -86,31 +85,11 @@
public:
/// Load a program into memory.
- void load_program(const inst::Program& program)
- {
- if (! program.text_section ().has_label(inst::Label("main")))
- {
- std::cerr << "No `main' label in assembly file." << std::endl;
- exit_set(exit_runtime);
- return;
- }
- mmu_.data_store(program.data_section());
- mmu_.inst_store(program.text_section());
- cpu_.set_pc(program.text_section ().get_offset(inst::Label("main")));
- }
+ void load_program(const inst::Program& program);
public:
/// Execute a program.
- void execute()
- {
- // FIXME: precondition on loaded program
-
- while (!cpu_.get_halt())
- {
- cpu_.step();
- cp0_.set_count(cp0_.get_count() + 1);
- }
- }
+ void execute();
/** \name Shell entry point
\{ */
@@ -129,48 +108,10 @@
public:
/// Execute a program
- void execute(bool trace_p)
- {
- if (status_ == stop)
- return;
-
- cpu_.set_trace(trace_p);
- while (status_ == run)
- {
- cpu_.step();
- cp0_.set_count(cp0_.get_count() + 1);
- if (cpu_.get_halt())
- {
- status_ = halt;
- std::cerr << "Program exited." << std::endl;
- break;
- }
- if (has(breakpoints_, cpu_.get_pc()))
- {
- std::cout << "Breakpoint at pc = " << cpu_.get_pc() << std::endl;
- status_ = pause;
- }
- if (mode_ == step)
- status_ = pause;
- }
- }
+ void execute(bool trace_p);
/// Add a breakpoint
- void add_breakpoint(const std::string& label)
- {
- int offset;
-
- if (!has_label(label))
- {
- std::cerr << "Label " << label << " not found" << std::endl;
- return;
- }
- offset = get_offset(label);
-
- std::cout << "Breakpoint " << label
- << " at " << offset << " (+4)" << std::endl;
- breakpoints_.push_back(offset + 4);
- }
+ void add_breakpoint(const std::string& label);
protected:
/// The list of breakpoints
Index: src/vm/Makefile.am
--- src/vm/Makefile.am (revision 109)
+++ src/vm/Makefile.am (working copy)
@@ -9,5 +9,5 @@
cpu.hh cpu.cc \
segment.hh \
memory.hh \
- virtual_machine.hh \
+ virtual_machine.hh virtual_machine.cc \
vm-tasks.hh vm-tasks.cc
Index: src/vm/virtual_machine.cc
--- src/vm/virtual_machine.cc (revision 0)
+++ src/vm/virtual_machine.cc (revision 0)
@@ -0,0 +1,100 @@
+//
+// This file is part of Nolimips, a MIPS simulator with unlimited registers
+// Copyright (C) 2003, 2004 Benoit Perrot <benoit(a)lrde.epita.fr>
+//
+// Nolimips is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// Nolimips is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+#include "vm/virtual_machine.hh"
+
+namespace vm
+{
+
+ void
+ VirtualMachine::reset()
+ {
+ }
+
+ void
+ VirtualMachine::load_program(const inst::Program &program)
+ {
+ if (! program.text_section ().has_label(inst::Label("main")))
+ {
+ std::cerr << "No `main' label in assembly file." << std::endl;
+ exit_set(exit_runtime);
+ return;
+ }
+ mmu_.data_store(program.data_section());
+ mmu_.inst_store(program.text_section());
+ cpu_.set_pc(program.text_section ().get_offset(inst::Label("main")));
+ }
+
+ void
+ VirtualMachine::execute()
+ {
+ // FIXME: precondition on loaded program
+
+ while (!cpu_.get_halt())
+ {
+ cpu_.step();
+ cp0_.set_count(cp0_.get_count() + 1);
+ }
+ }
+
+ void
+ VirtualMachine::execute(bool trace_p)
+ {
+ if (status_ == stop)
+ return;
+
+ cpu_.set_trace(trace_p);
+ while (status_ == run)
+ {
+ cpu_.step();
+ cp0_.set_count(cp0_.get_count() + 1);
+ if (cpu_.get_halt())
+ {
+ status_ = halt;
+ std::cerr << "Program exited." << std::endl;
+ break;
+ }
+ if (has(breakpoints_, cpu_.get_pc()))
+ {
+ std::cout << "Breakpoint at pc = " << cpu_.get_pc() << std::endl;
+ status_ = pause;
+ }
+ if (mode_ == step)
+ status_ = pause;
+ }
+ }
+
+ void
+ VirtualMachine::add_breakpoint(const std::string& label)
+ {
+ int offset;
+
+ if (!has_label(label))
+ {
+ std::cerr << "Label " << label << " not found" << std::endl;
+ return;
+ }
+ offset = get_offset(label);
+
+ std::cout << "Breakpoint " << label
+ << " at " << offset << " (+4)" << std::endl;
+ breakpoints_.push_back(offset + 4);
+ }
+
+
+} // namespace vm
1
0
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* src/shell.cc (readline): When the true readline is lacking, use
STL's getline instead of istream::operator>> to get a line instead
of a word.
Reported by Julien Vanegue.
2004-07-14 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: src/shell/shell.cc
--- src/shell/shell.cc (revision 110)
+++ src/shell/shell.cc (working copy)
@@ -58,7 +58,7 @@
#else // !HAVE_READLINE_READLINE_H
std::cout << prompt;
- std::cin >> line;
+ getline(std::cin, line);
return !std::cin.eof();
#endif // HAVE_READLINE_READLINE_H
1
0
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* INSTALL: Explain --with-readline-{includes,library} usage.
Suggested by Marco Tessari.
Index: INSTALL
--- INSTALL (revision 109)
+++ INSTALL (working copy)
@@ -10,7 +10,8 @@
* GNU make
The interactive shell is more ergonomic when libreadline is installed
-on the system, but it is not mandatory to build Nolimips.
+on the system, but it is not mandatory to build Nolimips:
+ * libreadline
Extra development tools are needed to build a copy from Nolimips' repository:
@@ -36,11 +37,24 @@
--------------------
The following command will check your system configuration and prepare
-Nolimips for an installation in /usr/local. To specify another directory,
-use the --prefix option of configure (see ./configure --help):
+Nolimips for an installation in `/usr/local'. To specify another directory,
+use the `--prefix' option of configure (see ./configure --help):
$ ./configure
+By default, the configure script assumes that Nolimips must be built
+with readline. If the readline library or its include files cannot be
+found in standard path, the script will complain (but not fail, as if
+`--without-readline' was used). To precise the path to them, use the
+options `--with-readline-includes' and `--with-readline-library':
+
+ $ ./configure --with-readline-includes=/path/to/readline-includes \
+ --with-readline-library=/path/to/readline-library
+
+With `/path/to/readline-includes' containing a subdirectory named
+`readline/' containing the file `readline.h', and `/path/to/readline-library'
+containing the library `libreadline-XXX.a'.
+
Then build Nolimips:
$ make && make check
1
0
Index: ChangeLog
from Clement Vasseur <clement.vasseur(a)lrde.epita.fr>
* auto-build/auto_build.pl: Rename to...
* auto-build/auto-build: ...this.
2004-07-13 Clement Vasseur <clement.vasseur(a)lrde.epita.fr>
Index: auto-build/auto-build
--- auto-build/auto-build (revision 0)
+++ auto-build/auto-build (revision 79)
@@ -0,0 +1,643 @@
+#!/usr/bin/perl -w
+#
+# Auto Build System - auto-build
+# Copyright (C) 2004 LRDE - EPITA Research and Development Laboratory
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+
+# Authors:
+# Clement Vasseur <clement.vasseur(a)lrde.epita.fr>
+# Nicolas Pouillard <nicolas.pouillard(a)lrde.epita.fr>
+
+# Any contribution should follow the Perl style guide: perldoc perlstyle
+# This script should remain self-contained and it should not depend on any
+# module besides the ones in the standard Perl 5.8 installation.
+
+my $VERSION = 0.1;
+
+=pod
+
+=head1 NAME
+
+auto-build
+
+=head1 SYNOPSIS
+
+auto-build [options] packages.list
+
+ -m, --man display the manual
+ -h, --help print this help and exit
+ -V, --version print version information and exit
+ -d, --delay=DELAY redo a build cycle after DELAY minutes
+
+=head1 DESCRIPTION
+
+=cut
+
+use strict;
+use Getopt::Long;
+use Pod::Usage;
+
+my $report_dir;
+my $build_dir;
+my $inst_dir;
+my @packages;
+
+my %variables;
+my @colors;
+my %deps;
+
+my $packages;
+my $man = 0;
+my $help = 0;
+my $delay = 0;
+
+GetOptions(
+ 'man|m' => \$man,
+ 'help|h|?' => \$help,
+ 'version|V' => \&version,
+ 'delay|d=i' => \$delay,
+ '<>' => sub { $packages = $_[0] },
+) or pod2usage(-verbose => 0);
+
+pod2usage(-verbose => 1) if $help;
+pod2usage(-verbose => 2) if $man;
+pod2usage(-verbose => 0) unless defined $packages;
+
+&read_pkg_list($packages);
+&create_dir($report_dir);
+&create_dir($build_dir);
+&create_dir($inst_dir);
+&prepare_pkgs;
+
+while (1) {
+ &auto_build;
+ last if $delay == 0;
+ sleep $delay * 60;
+}
+
+sub auto_build {
+ &gen_summary;
+
+ foreach my $pkg (@packages) {
+ print "$pkg->{'name'}\n";
+
+ next if &check_revision($pkg);
+ &gen_pkg_report($pkg);
+
+ my $ok = 1;
+ foreach my $dep (@{$deps{$pkg->{'name'}}}) {
+ foreach (@packages) {
+ $ok = 0 if $_->{'name'} eq $dep
+ and ($_->{'status'} eq 'failed' or $_->{'status'} eq 'skipped');
+ }
+ unless ($ok) {
+ &set_status($pkg, 'skipped');
+ last;
+ }
+ }
+
+ &build_pkg($pkg) if $ok;
+ }
+}
+
+sub xopen {
+ my $filename = shift;
+ my $name = $filename;
+ my $FILE;
+
+ $name =~ s/^>//;
+ open $FILE, $filename
+ or die "$0: unable to open `$name': $!\n";
+ return $FILE;
+}
+
+sub xclose {
+ my $FILE = shift;
+ close $FILE or die "$0: unable to close `$FILE': $!\n";
+}
+
+sub header {
+ my ($filename, $title) = @_;
+ my $FILE = &xopen(">$filename");
+ select $FILE;
+
+ print <<HTML;
+<html>
+ <head>
+ <title>$title</title>
+ </head>
+ <body>
+HTML
+
+ return $FILE;
+}
+
+sub footer {
+ print <<HTML;
+ <hr/>
+ <h4>Generated by <i>auto-build</i> version $VERSION</h4>
+ </body>
+</html>
+HTML
+
+ select STDOUT;
+ my $FILE = shift;
+ &xclose($FILE);
+}
+
+sub read_pkg_list {
+ my $filename = shift;
+ my $LIST = &xopen($filename);
+ my $section;
+
+ while (<$LIST>) {
+ s/\s*\#.*$//;
+ next if m/^\s*$/;
+ chomp;
+
+ while (s/\s*\\\s*$/ /) {
+ my $l = <$LIST>;
+ $l =~ s/^\s*//;
+ $l =~ s/\s*\#.*$//;
+ $_ .= $l;
+ chomp;
+ }
+
+ unless (defined $report_dir) {
+ $report_dir = $_;
+ next;
+ }
+
+ unless (defined $build_dir) {
+ $build_dir = $_;
+ next;
+ }
+
+ unless (defined $inst_dir) {
+ $inst_dir = $_;
+ next;
+ }
+
+ if (m/^\s*color\s+(\w+)\s+\"(.*?)\"\s*$/) {
+ push @colors, [ $2, $1 ];
+
+ } elsif (m/^\s*section\s+\"(.*)\"\s*$/) {
+ $section = $1;
+
+ } elsif (m/^([\w\-]+)\s*=\s*(.*?)\s*$/) {
+ $variables{$1} = $2;
+
+ } elsif (m/^([\w\-]+)\s*$/) {
+ push @packages, {
+ 'name' => $1,
+ 'section' => $section,
+ 'opt' => '',
+ 'cfg' => '',
+ 'rev' => '0'
+ };
+
+ } elsif (m/^\s*(\w\w\w)\s*:\s*(.*?)\s*$/) {
+ my $field = $1;
+ my $value = $2;
+
+ my $err = 1;
+ foreach ('url', 'cfg', 'opt', 'env', 'dif') {
+ if ($field eq $_) {
+ $err = 0;
+ last;
+ }
+ }
+
+ die "$filename:$.: invalid field `$field'\n" if $err;
+ while ($value =~ m/\$\{([\w\-]+)\}/) {
+ if (defined $variables{$1}) {
+ $value =~ s/\$\{([\w\-]+)\}/$variables{$1}/;
+ } else {
+ $value =~ s/\$\{([\w\-]+)\}/$inst_dir\/$1/;
+ push @{$deps{$packages[-1]->{'name'}}}, $1;
+ }
+ }
+ $packages[-1]->{$field} = $value;
+
+ } else {
+ die "$filename:$.: syntax error\n";
+ }
+ }
+
+ &xclose($LIST);
+ (defined $report_dir and defined $build_dir and $inst_dir)
+ or die "$0: `report', `build' and `inst' directories must be defined\n";
+}
+
+sub create_dir {
+ my $dir = shift;
+ return if -d $dir;
+ system("/bin/mkdir -p \"$dir\"")
+ and die "$0: unable to mkdir `$dir'\n";
+}
+
+sub delete_dir {
+ my $dir = shift;
+ return unless -d $dir;
+ system("/bin/chmod -fR u+w \"$dir\"; /bin/rm -rf \"$dir\"")
+ and die "$0: unable to remove `$dir'\n";
+}
+
+sub ch_dir {
+ my $dir = shift;
+ chdir $dir or die "$0: unable to chdir `$dir': $!\n";
+}
+
+sub time_to_str {
+ $_ = shift;
+ my $t = '';
+
+ if (defined $_ and $_ ne '') {
+ $t = ($_ % 60) . "s";
+ $t = (($_/60) % 60) . "m$t" if $_ >= 60;
+ $t = (($_/(60 * 60)) % 60) . "h$t" if $_ >= 60 * 60;
+ }
+
+ return $t;
+}
+
+sub gen_summary {
+ my $SUMMARY = &header("$report_dir/index.html", "Auto Build System");
+ my $section = '';
+
+ print <<HTML;
+ <h1>Auto Build System</h1>
+ <hr/>
+ <table>
+HTML
+
+ foreach my $pkg (@packages) {
+ if ($pkg->{'section'} ne $section) {
+ if ($section ne '') {
+ print <<HTML;
+ <tr>
+ <td>
+
+ </td>
+ </tr>
+HTML
+ }
+ $section = $pkg->{'section'};
+ print <<HTML;
+ <tr>
+ <td>
+ <h3>$section</h3>
+ </td>
+ </tr>
+HTML
+ }
+
+ $pkg->{'status'} = '' unless defined $pkg->{'status'};
+
+ my $color = "black";
+ my $time = &time_to_str($pkg->{'time'});
+
+ $color = "red" if $pkg->{'status'} eq "failed";
+ $color = "green" if $pkg->{'status'} eq "succeeded";
+ $color = "gray" if $pkg->{'status'} eq "skipped";
+
+ print <<HTML;
+ <tr>
+ <td><a href=\"$pkg->{'name'}/$pkg->{'name'}.html\">$pkg->{'name'}</a></td>
+ <td> </td>
+ <td><font color=\"$color\">$pkg->{'status'}</font></td>
+ <td> </td>
+ <td><font color=\"gray\">$time</font></td>
+ </tr>
+HTML
+ }
+
+ print " </table>\n";
+ &footer($SUMMARY);
+}
+
+sub gen_pkg_report {
+ my $pkg = shift;
+ my $filename = "$report_dir/$pkg->{'name'}/$pkg->{'name'}.html";
+ my $REPORT = &header("$filename", "$pkg->{'name'} report");
+
+ my ($ts, $tf) = ('', '');
+ $ts = localtime $pkg->{'time_started'} if defined $pkg->{'time_started'};
+ $tf = localtime $pkg->{'time_finished'} if defined $pkg->{'time_finished'};
+
+ print <<HTML;
+ <h1>$pkg->{'name'}</h1>
+ <hr/>
+ <h3>Build started: $ts</h3>
+ <table cellpadding=\"8\">
+HTML
+
+ foreach my $step (@{$pkg->{'steps'}}) {
+ next unless defined $step->{'name'};
+ if (defined $step->{'status'}) {
+ my $color = "black";
+ $color = "green" if $step->{'status'} eq "succeeded";
+ $color = "red" if $step->{'status'} eq "failed";
+
+ my $time = &time_to_str($step->{'time'});
+
+ print <<HTML;
+ <tr>
+ <td><a href=\"$step->{'name'}.html\">$step->{'name'}</a></td>
+ <td><font color=\"$color\">$step->{'status'}</font></td>
+ <td><font color=\"gray\">$time</font></td>
+ </tr>
+HTML
+ } else {
+ print <<HTML;
+ <tr>
+ <td>$step->{'name'}</td>
+ </tr>
+HTML
+ }
+ }
+
+ print <<HTML;
+ </table>
+ <h3>Build finished: $tf</h3>
+HTML
+
+ if (defined $pkg->{'archives'}) {
+ foreach (@{$pkg->{'archives'}}) {
+ print " <a href=\"$_\">$_</a><br/>\n" if -f $_;
+ }
+ }
+
+ &footer($REPORT);
+}
+
+sub set_status {
+ $_[0]->{'status'} = $_[1];
+ print " $_[1]\n";
+ &gen_summary;
+}
+
+sub gen_log_page {
+ my $pkg = shift;
+ my $step = shift;
+ my $filename = "$report_dir/$pkg->{'name'}/$step->{'name'}.html";
+ my $REPORT = &header("$filename", "$pkg->{'name'} - $step->{'name'}");
+
+ print <<HTML;
+ <h1>$step->{'name'}</h1>
+ <h4>$step->{'cmd'}</h4>
+ <hr/>
+ <a href="$step->{'name'}.log">Log</a>
+HTML
+
+ &footer($REPORT);
+}
+
+sub run {
+ my $pkg = shift;
+ my $step = shift;
+ my $status = $step->{'name'};
+ my $out = "$report_dir/$pkg->{'name'}/$status";
+
+ &set_status($pkg, $status);
+ &gen_log_page($pkg, $step);
+
+ my $t = time;
+ my $exit_code = system("$step->{'cmd'} >$out.log 2>&1");
+ $step->{'time'} = time - $t;
+
+ my $REPORT = &header("$out.html", "$pkg->{'name'} - $status");
+
+ print <<HTML;
+ <h1>$step->{'name'}</h1>
+ <h4>$step->{'cmd'}</h4>
+ <hr/>
+ <pre>
+HTML
+
+ my $LOG = &xopen("$out.log");
+ my $archives_ready;
+
+ while (<$LOG>) {
+ my $color;
+ foreach my $c (@colors) {
+ $color = $c->[1] if m/^$c->[0]/;
+ last if defined $color;
+ }
+ if ($status eq 'check') {
+ if (($archives_ready and m/^($archives_ready\.tar\.(gz|bz2))$/)
+ or m/^(.*\.tar\.(gz|bz2)) is ready for distribution$/) {
+ push @{$pkg->{'archives'}}, $1;
+ system("/bin/cp \"$1\" \"$report_dir/$pkg->{'name'}\"")
+ and die "$0: unable to cp `$1' to `$report_dir/$pkg->{'name'}': $!\n"
;
+ }
+ $archives_ready = $1 if m/^(.*) archives ready for distribution: $/;
+ }
+ print "<font color=\"$color\">" if $color;
+ print;
+ print "</font>" if $color;
+ }
+
+ print " </pre>\n";
+ &xclose($LOG);
+ &footer($REPORT);
+ return undef if $exit_code;
+ return 1;
+}
+
+sub check_revision {
+ my $pkg = shift;
+ my $revfile = "$inst_dir/$pkg->{'name'}/.rev";
+ my $rev;
+
+ if ($pkg->{'url'} =~ m|^svn:(.*/([^/]+))$|) {
+ chomp($rev = `svn log -q \"https:$1\" 2>/dev/null | grep '^r' | head -n 1`)
;
+ $rev =~ s/^r(\d+).*$/$1/;
+ } elsif ($pkg->{'url'} =~ m/^((ht|f)tp:.*)$/) {
+ chomp($rev = `wget -qnv -O - \"$1\" | md5sum`);
+ }
+ $pkg->{'rev'} = $rev;
+
+ if (-f $revfile) {
+ chomp($rev = `cat \"$revfile\"`);
+ unlink $revfile if $pkg->{'rev'} ne $rev;
+ }
+ if (-f $revfile) {
+ chomp($pkg->{'time'} = `cat \"$inst_dir/$pkg->{'name'}/.time\"`);
+ &set_status($pkg, 'succeeded');
+ return 1;
+ }
+ return undef;
+}
+
+sub get_package {
+ my $pkg = shift;
+ my @steps;
+ $_ = $pkg->{'url'};
+
+ if (m|^http://.*/([^/]+)/?$|
+ or m|^ftp://.*/([^/]+)/?$|) {
+ $_ = "file://$1";
+ push @steps, {
+ 'name' => 'download',
+ 'cmd' => "wget -nv \"$pkg->{'url'}\""
+ };
+ }
+
+ if (m|^file://(.*)$|) {
+ my $file = $_ = $1;
+ my $c;
+
+ $c = "z" if m/\.tar\.gz$/ or m/\.tgz$/;
+ $c = "j" if m/\.tar\.bz2$/ or m/\.tbz2$/;
+ $pkg->{'dir'} = $file;
+
+ if (defined $c) {
+ push @steps, {
+ 'name' => 'unpack',
+ 'cmd' => "tar -x${c}vf \"$file\""
+ }, {
+ 'dir' => "tar -t${c}f \"$file\" | head -n 1 | cut -d '/' -f 0-1",
+ };
+ }
+
+ } elsif (m|^svn://(.*/([^/]+))/?$|) {
+ my $repository = "https://$1";
+ $pkg->{'dir'} = $2;
+
+ push @steps, {
+ 'name' => 'checkout',
+ 'cmd' => "svn checkout \"$repository\""
+ }, {
+ 'dir' => "echo \"$pkg->{'dir'}\"",
+ 'name' => 'bootstrap',
+ 'cmd' => '(./bootstrap || ./bootstrap.sh || autoreconf -fvi)'
+ };
+
+ } elsif (m|^prcs://(.*)$|) {
+ $pkg->{'dir'} = $1;
+
+ push @steps, {
+ 'dir' => "echo \"$1\"",
+ 'name' => 'checkout',
+ 'cmd' => "prcs checkout \"$1\""
+ }, {
+ 'name' => 'bootstrap',
+ 'cmd' => '(./bootstrap || ./bootstrap.sh || autoreconf -fvi)'
+ };
+
+ } else {
+ die "$0: invalid URL `$_': unknown protocol\n";
+ }
+
+ return @steps;
+}
+
+sub prepare_pkgs {
+ foreach my $pkg (@packages) {
+ my @steps = &get_package($pkg);
+ my $dir = "$report_dir/$pkg->{'name'}";
+ &create_dir($dir);
+
+ push @steps, {
+ 'name' => 'patch',
+ 'cmd' => "patch -p0 -t -i \"$pkg->{'dif'}\""
+ } if defined $pkg->{'dif'};
+ push @steps, {
+ 'name' => 'configure',
+ 'cmd' => "./configure --prefix=$inst_dir/$pkg->{'name'} $pkg->{'cfg'}"
+ }, {
+ 'name' => 'build', 'cmd' => 'make'
+ };
+ my $dcf = '';
+ defined $pkg->{'cfg'} and $pkg->{'cfg'} ne ''
+ and $dcf = "DISTCHECK_CONFIGURE_FLAGS=\"$pkg->{'cfg'}\" ";
+ push @steps, {
+ 'name' => 'check',
+ 'cmd' => "make ${dcf}distcheck"
+ } unless $pkg->{'opt'} =~ m/\bno-check\b/;
+ push @steps, {
+ 'rm' => "$inst_dir/$pkg->{'name'}"
+ },{
+ 'name' => 'install', 'cmd' => 'make install'
+ };
+ $pkg->{'steps'} = \@steps;
+ next if &check_revision($pkg);
+ &gen_pkg_report($pkg) unless -f "$dir/$pkg->{'name'}.html";
+ }
+}
+
+sub build_pkg {
+ my $pkg = shift;
+ my %env = %ENV;
+
+ if (defined $pkg->{'env'}) {
+ foreach (split /\s*,\s*/, $pkg->{'env'}) {
+ if (m/^\s*(\w+)\s*=\s*\"(.*)\"\s*$/) {
+ my ($v, $w) = ($1, $2);
+ $w =~ s/\$(\w+)/$ENV{$1}/;
+ $ENV{$v} = $w;
+ }
+ }
+ }
+
+ my $st;
+ my $dir = "$build_dir/$pkg->{'name'}";
+ &delete_dir($dir);
+ &create_dir($dir);
+ &ch_dir($dir);
+ $pkg->{'time_started'} = time;
+ foreach my $step (@{$pkg->{'steps'}}) {
+ $step->{'status'} = "running";
+ &gen_pkg_report($pkg);
+ &delete_dir($step->{'rm'}) if defined $step->{'rm'};
+ if (defined $step->{'dir'}) {
+ chomp($pkg->{'dir'} = `$step->{'dir'}`);
+ &create_dir($pkg->{'dir'});
+ &ch_dir($pkg->{'dir'});
+ }
+ if (not defined $step->{'cmd'}
+ or &run($pkg, $step)) {
+ $step->{'status'} = $st = "succeeded";
+ next;
+ }
+ $step->{'status'} = $st = "failed";
+ last;
+ }
+
+ $pkg->{'time_finished'} = time;
+ $pkg->{'time'} = $pkg->{'time_finished'} - $pkg->{'time_started'};
+ %ENV = %env;
+ &gen_pkg_report($pkg);
+ &ch_dir($build_dir);
+ &set_status($pkg, $st);
+ if ($st eq "succeeded") {
+ system("echo \"$pkg->{'rev'}\" > \"$inst_dir/$pkg->{'name'}/.rev\"");
+ system("echo \"$pkg->{'time'}\" > \"$inst_dir/$pkg->{'name'}/.time\"");
+ &delete_dir($pkg->{'name'});
+ }
+}
+
+sub version {
+ print "auto-build (Auto Build System) $VERSION\n",
+ "Written by Clement Vasseur and Nicolas Pouillard.\n\n",
+ "Copyright (C) 2004 LRDE - EPITA Research and Development Laboratory.\n",
+ "This is free software; see the source for copying conditions. ",
+ "There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A ",
+ "PARTICULAR PURPOSE.\n";
+ exit 0;
+}
Property changes on: auto-build/auto-build
___________________________________________________________________
Name: svn:executable
+ *
Index: auto-build/auto_build.pl
--- auto-build/auto_build.pl (revision 78)
+++ auto-build/auto_build.pl (revision 79)
@@ -1,643 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Auto Build System - auto-build
-# Copyright (C) 2004 LRDE - EPITA Research and Development Laboratory
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-# Authors:
-# Clement Vasseur <clement.vasseur(a)lrde.epita.fr>
-# Nicolas Pouillard <nicolas.pouillard(a)lrde.epita.fr>
-
-# Any contribution should follow the Perl style guide: perldoc perlstyle
-# This script should remain self-contained and it should not depend on any
-# module besides the ones in the standard Perl 5.8 installation.
-
-my $VERSION = 0.1;
-
-=pod
-
-=head1 NAME
-
-auto-build
-
-=head1 SYNOPSIS
-
-auto-build [options] packages.list
-
- -m, --man display the manual
- -h, --help print this help and exit
- -V, --version print version information and exit
- -d, --delay=DELAY redo a build cycle after DELAY minutes
-
-=head1 DESCRIPTION
-
-=cut
-
-use strict;
-use Getopt::Long;
-use Pod::Usage;
-
-my $report_dir;
-my $build_dir;
-my $inst_dir;
-my @packages;
-
-my %variables;
-my @colors;
-my %deps;
-
-my $packages;
-my $man = 0;
-my $help = 0;
-my $delay = 0;
-
-GetOptions(
- 'man|m' => \$man,
- 'help|h|?' => \$help,
- 'version|V' => \&version,
- 'delay|d=i' => \$delay,
- '<>' => sub { $packages = $_[0] },
-) or pod2usage(-verbose => 0);
-
-pod2usage(-verbose => 1) if $help;
-pod2usage(-verbose => 2) if $man;
-pod2usage(-verbose => 0) unless defined $packages;
-
-&read_pkg_list($packages);
-&create_dir($report_dir);
-&create_dir($build_dir);
-&create_dir($inst_dir);
-&prepare_pkgs;
-
-while (1) {
- &auto_build;
- last if $delay == 0;
- sleep $delay * 60;
-}
-
-sub auto_build {
- &gen_summary;
-
- foreach my $pkg (@packages) {
- print "$pkg->{'name'}\n";
-
- next if &check_revision($pkg);
- &gen_pkg_report($pkg);
-
- my $ok = 1;
- foreach my $dep (@{$deps{$pkg->{'name'}}}) {
- foreach (@packages) {
- $ok = 0 if $_->{'name'} eq $dep
- and ($_->{'status'} eq 'failed' or $_->{'status'} eq 'skipped');
- }
- unless ($ok) {
- &set_status($pkg, 'skipped');
- last;
- }
- }
-
- &build_pkg($pkg) if $ok;
- }
-}
-
-sub xopen {
- my $filename = shift;
- my $name = $filename;
- my $FILE;
-
- $name =~ s/^>//;
- open $FILE, $filename
- or die "$0: unable to open `$name': $!\n";
- return $FILE;
-}
-
-sub xclose {
- my $FILE = shift;
- close $FILE or die "$0: unable to close `$FILE': $!\n";
-}
-
-sub header {
- my ($filename, $title) = @_;
- my $FILE = &xopen(">$filename");
- select $FILE;
-
- print <<HTML;
-<html>
- <head>
- <title>$title</title>
- </head>
- <body>
-HTML
-
- return $FILE;
-}
-
-sub footer {
- print <<HTML;
- <hr/>
- <h4>Generated by <i>auto-build</i> version $VERSION</h4>
- </body>
-</html>
-HTML
-
- select STDOUT;
- my $FILE = shift;
- &xclose($FILE);
-}
-
-sub read_pkg_list {
- my $filename = shift;
- my $LIST = &xopen($filename);
- my $section;
-
- while (<$LIST>) {
- s/\s*\#.*$//;
- next if m/^\s*$/;
- chomp;
-
- while (s/\s*\\\s*$/ /) {
- my $l = <$LIST>;
- $l =~ s/^\s*//;
- $l =~ s/\s*\#.*$//;
- $_ .= $l;
- chomp;
- }
-
- unless (defined $report_dir) {
- $report_dir = $_;
- next;
- }
-
- unless (defined $build_dir) {
- $build_dir = $_;
- next;
- }
-
- unless (defined $inst_dir) {
- $inst_dir = $_;
- next;
- }
-
- if (m/^\s*color\s+(\w+)\s+\"(.*?)\"\s*$/) {
- push @colors, [ $2, $1 ];
-
- } elsif (m/^\s*section\s+\"(.*)\"\s*$/) {
- $section = $1;
-
- } elsif (m/^([\w\-]+)\s*=\s*(.*?)\s*$/) {
- $variables{$1} = $2;
-
- } elsif (m/^([\w\-]+)\s*$/) {
- push @packages, {
- 'name' => $1,
- 'section' => $section,
- 'opt' => '',
- 'cfg' => '',
- 'rev' => '0'
- };
-
- } elsif (m/^\s*(\w\w\w)\s*:\s*(.*?)\s*$/) {
- my $field = $1;
- my $value = $2;
-
- my $err = 1;
- foreach ('url', 'cfg', 'opt', 'env', 'dif') {
- if ($field eq $_) {
- $err = 0;
- last;
- }
- }
-
- die "$filename:$.: invalid field `$field'\n" if $err;
- while ($value =~ m/\$\{([\w\-]+)\}/) {
- if (defined $variables{$1}) {
- $value =~ s/\$\{([\w\-]+)\}/$variables{$1}/;
- } else {
- $value =~ s/\$\{([\w\-]+)\}/$inst_dir\/$1/;
- push @{$deps{$packages[-1]->{'name'}}}, $1;
- }
- }
- $packages[-1]->{$field} = $value;
-
- } else {
- die "$filename:$.: syntax error\n";
- }
- }
-
- &xclose($LIST);
- (defined $report_dir and defined $build_dir and $inst_dir)
- or die "$0: `report', `build' and `inst' directories must be defined\n";
-}
-
-sub create_dir {
- my $dir = shift;
- return if -d $dir;
- system("/bin/mkdir -p \"$dir\"")
- and die "$0: unable to mkdir `$dir'\n";
-}
-
-sub delete_dir {
- my $dir = shift;
- return unless -d $dir;
- system("/bin/chmod -fR u+w \"$dir\"; /bin/rm -rf \"$dir\"")
- and die "$0: unable to remove `$dir'\n";
-}
-
-sub ch_dir {
- my $dir = shift;
- chdir $dir or die "$0: unable to chdir `$dir': $!\n";
-}
-
-sub time_to_str {
- $_ = shift;
- my $t = '';
-
- if (defined $_ and $_ ne '') {
- $t = ($_ % 60) . "s";
- $t = (($_/60) % 60) . "m$t" if $_ >= 60;
- $t = (($_/(60 * 60)) % 60) . "h$t" if $_ >= 60 * 60;
- }
-
- return $t;
-}
-
-sub gen_summary {
- my $SUMMARY = &header("$report_dir/index.html", "Auto Build System");
- my $section = '';
-
- print <<HTML;
- <h1>Auto Build System</h1>
- <hr/>
- <table>
-HTML
-
- foreach my $pkg (@packages) {
- if ($pkg->{'section'} ne $section) {
- if ($section ne '') {
- print <<HTML;
- <tr>
- <td>
-
- </td>
- </tr>
-HTML
- }
- $section = $pkg->{'section'};
- print <<HTML;
- <tr>
- <td>
- <h3>$section</h3>
- </td>
- </tr>
-HTML
- }
-
- $pkg->{'status'} = '' unless defined $pkg->{'status'};
-
- my $color = "black";
- my $time = &time_to_str($pkg->{'time'});
-
- $color = "red" if $pkg->{'status'} eq "failed";
- $color = "green" if $pkg->{'status'} eq "succeeded";
- $color = "gray" if $pkg->{'status'} eq "skipped";
-
- print <<HTML;
- <tr>
- <td><a href=\"$pkg->{'name'}/$pkg->{'name'}.html\">$pkg->{'name'}</a></td>
- <td> </td>
- <td><font color=\"$color\">$pkg->{'status'}</font></td>
- <td> </td>
- <td><font color=\"gray\">$time</font></td>
- </tr>
-HTML
- }
-
- print " </table>\n";
- &footer($SUMMARY);
-}
-
-sub gen_pkg_report {
- my $pkg = shift;
- my $filename = "$report_dir/$pkg->{'name'}/$pkg->{'name'}.html";
- my $REPORT = &header("$filename", "$pkg->{'name'} report");
-
- my ($ts, $tf) = ('', '');
- $ts = localtime $pkg->{'time_started'} if defined $pkg->{'time_started'};
- $tf = localtime $pkg->{'time_finished'} if defined $pkg->{'time_finished'};
-
- print <<HTML;
- <h1>$pkg->{'name'}</h1>
- <hr/>
- <h3>Build started: $ts</h3>
- <table cellpadding=\"8\">
-HTML
-
- foreach my $step (@{$pkg->{'steps'}}) {
- next unless defined $step->{'name'};
- if (defined $step->{'status'}) {
- my $color = "black";
- $color = "green" if $step->{'status'} eq "succeeded";
- $color = "red" if $step->{'status'} eq "failed";
-
- my $time = &time_to_str($step->{'time'});
-
- print <<HTML;
- <tr>
- <td><a href=\"$step->{'name'}.html\">$step->{'name'}</a></td>
- <td><font color=\"$color\">$step->{'status'}</font></td>
- <td><font color=\"gray\">$time</font></td>
- </tr>
-HTML
- } else {
- print <<HTML;
- <tr>
- <td>$step->{'name'}</td>
- </tr>
-HTML
- }
- }
-
- print <<HTML;
- </table>
- <h3>Build finished: $tf</h3>
-HTML
-
- if (defined $pkg->{'archives'}) {
- foreach (@{$pkg->{'archives'}}) {
- print " <a href=\"$_\">$_</a><br/>\n" if -f $_;
- }
- }
-
- &footer($REPORT);
-}
-
-sub set_status {
- $_[0]->{'status'} = $_[1];
- print " $_[1]\n";
- &gen_summary;
-}
-
-sub gen_log_page {
- my $pkg = shift;
- my $step = shift;
- my $filename = "$report_dir/$pkg->{'name'}/$step->{'name'}.html";
- my $REPORT = &header("$filename", "$pkg->{'name'} - $step->{'name'}");
-
- print <<HTML;
- <h1>$step->{'name'}</h1>
- <h4>$step->{'cmd'}</h4>
- <hr/>
- <a href="$step->{'name'}.log">Log</a>
-HTML
-
- &footer($REPORT);
-}
-
-sub run {
- my $pkg = shift;
- my $step = shift;
- my $status = $step->{'name'};
- my $out = "$report_dir/$pkg->{'name'}/$status";
-
- &set_status($pkg, $status);
- &gen_log_page($pkg, $step);
-
- my $t = time;
- my $exit_code = system("$step->{'cmd'} >$out.log 2>&1");
- $step->{'time'} = time - $t;
-
- my $REPORT = &header("$out.html", "$pkg->{'name'} - $status");
-
- print <<HTML;
- <h1>$step->{'name'}</h1>
- <h4>$step->{'cmd'}</h4>
- <hr/>
- <pre>
-HTML
-
- my $LOG = &xopen("$out.log");
- my $archives_ready;
-
- while (<$LOG>) {
- my $color;
- foreach my $c (@colors) {
- $color = $c->[1] if m/^$c->[0]/;
- last if defined $color;
- }
- if ($status eq 'check') {
- if (($archives_ready and m/^($archives_ready\.tar\.(gz|bz2))$/)
- or m/^(.*\.tar\.(gz|bz2)) is ready for distribution$/) {
- push @{$pkg->{'archives'}}, $1;
- system("/bin/cp \"$1\" \"$report_dir/$pkg->{'name'}\"")
- and die "$0: unable to cp `$1' to `$report_dir/$pkg->{'name'}': $!\n"
;
- }
- $archives_ready = $1 if m/^(.*) archives ready for distribution: $/;
- }
- print "<font color=\"$color\">" if $color;
- print;
- print "</font>" if $color;
- }
-
- print " </pre>\n";
- &xclose($LOG);
- &footer($REPORT);
- return undef if $exit_code;
- return 1;
-}
-
-sub check_revision {
- my $pkg = shift;
- my $revfile = "$inst_dir/$pkg->{'name'}/.rev";
- my $rev;
-
- if ($pkg->{'url'} =~ m|^svn:(.*/([^/]+))$|) {
- chomp($rev = `svn log -q \"https:$1\" 2>/dev/null | grep '^r' | head -n 1`)
;
- $rev =~ s/^r(\d+).*$/$1/;
- } elsif ($pkg->{'url'} =~ m/^((ht|f)tp:.*)$/) {
- chomp($rev = `wget -qnv -O - \"$1\" | md5sum`);
- }
- $pkg->{'rev'} = $rev;
-
- if (-f $revfile) {
- chomp($rev = `cat \"$revfile\"`);
- unlink $revfile if $pkg->{'rev'} ne $rev;
- }
- if (-f $revfile) {
- chomp($pkg->{'time'} = `cat \"$inst_dir/$pkg->{'name'}/.time\"`);
- &set_status($pkg, 'succeeded');
- return 1;
- }
- return undef;
-}
-
-sub get_package {
- my $pkg = shift;
- my @steps;
- $_ = $pkg->{'url'};
-
- if (m|^http://.*/([^/]+)/?$|
- or m|^ftp://.*/([^/]+)/?$|) {
- $_ = "file://$1";
- push @steps, {
- 'name' => 'download',
- 'cmd' => "wget -nv \"$pkg->{'url'}\""
- };
- }
-
- if (m|^file://(.*)$|) {
- my $file = $_ = $1;
- my $c;
-
- $c = "z" if m/\.tar\.gz$/ or m/\.tgz$/;
- $c = "j" if m/\.tar\.bz2$/ or m/\.tbz2$/;
- $pkg->{'dir'} = $file;
-
- if (defined $c) {
- push @steps, {
- 'name' => 'unpack',
- 'cmd' => "tar -x${c}vf \"$file\""
- }, {
- 'dir' => "tar -t${c}f \"$file\" | head -n 1 | cut -d '/' -f 0-1",
- };
- }
-
- } elsif (m|^svn://(.*/([^/]+))/?$|) {
- my $repository = "https://$1";
- $pkg->{'dir'} = $2;
-
- push @steps, {
- 'name' => 'checkout',
- 'cmd' => "svn checkout \"$repository\""
- }, {
- 'dir' => "echo \"$pkg->{'dir'}\"",
- 'name' => 'bootstrap',
- 'cmd' => '(./bootstrap || ./bootstrap.sh || autoreconf -fvi)'
- };
-
- } elsif (m|^prcs://(.*)$|) {
- $pkg->{'dir'} = $1;
-
- push @steps, {
- 'dir' => "echo \"$1\"",
- 'name' => 'checkout',
- 'cmd' => "prcs checkout \"$1\""
- }, {
- 'name' => 'bootstrap',
- 'cmd' => '(./bootstrap || ./bootstrap.sh || autoreconf -fvi)'
- };
-
- } else {
- die "$0: invalid URL `$_': unknown protocol\n";
- }
-
- return @steps;
-}
-
-sub prepare_pkgs {
- foreach my $pkg (@packages) {
- my @steps = &get_package($pkg);
- my $dir = "$report_dir/$pkg->{'name'}";
- &create_dir($dir);
-
- push @steps, {
- 'name' => 'patch',
- 'cmd' => "patch -p0 -t -i \"$pkg->{'dif'}\""
- } if defined $pkg->{'dif'};
- push @steps, {
- 'name' => 'configure',
- 'cmd' => "./configure --prefix=$inst_dir/$pkg->{'name'} $pkg->{'cfg'}"
- }, {
- 'name' => 'build', 'cmd' => 'make'
- };
- my $dcf = '';
- defined $pkg->{'cfg'} and $pkg->{'cfg'} ne ''
- and $dcf = "DISTCHECK_CONFIGURE_FLAGS=\"$pkg->{'cfg'}\" ";
- push @steps, {
- 'name' => 'check',
- 'cmd' => "make ${dcf}distcheck"
- } unless $pkg->{'opt'} =~ m/\bno-check\b/;
- push @steps, {
- 'rm' => "$inst_dir/$pkg->{'name'}"
- },{
- 'name' => 'install', 'cmd' => 'make install'
- };
- $pkg->{'steps'} = \@steps;
- next if &check_revision($pkg);
- &gen_pkg_report($pkg) unless -f "$dir/$pkg->{'name'}.html";
- }
-}
-
-sub build_pkg {
- my $pkg = shift;
- my %env = %ENV;
-
- if (defined $pkg->{'env'}) {
- foreach (split /\s*,\s*/, $pkg->{'env'}) {
- if (m/^\s*(\w+)\s*=\s*\"(.*)\"\s*$/) {
- my ($v, $w) = ($1, $2);
- $w =~ s/\$(\w+)/$ENV{$1}/;
- $ENV{$v} = $w;
- }
- }
- }
-
- my $st;
- my $dir = "$build_dir/$pkg->{'name'}";
- &delete_dir($dir);
- &create_dir($dir);
- &ch_dir($dir);
- $pkg->{'time_started'} = time;
- foreach my $step (@{$pkg->{'steps'}}) {
- $step->{'status'} = "running";
- &gen_pkg_report($pkg);
- &delete_dir($step->{'rm'}) if defined $step->{'rm'};
- if (defined $step->{'dir'}) {
- chomp($pkg->{'dir'} = `$step->{'dir'}`);
- &create_dir($pkg->{'dir'});
- &ch_dir($pkg->{'dir'});
- }
- if (not defined $step->{'cmd'}
- or &run($pkg, $step)) {
- $step->{'status'} = $st = "succeeded";
- next;
- }
- $step->{'status'} = $st = "failed";
- last;
- }
-
- $pkg->{'time_finished'} = time;
- $pkg->{'time'} = $pkg->{'time_finished'} - $pkg->{'time_started'};
- %ENV = %env;
- &gen_pkg_report($pkg);
- &ch_dir($build_dir);
- &set_status($pkg, $st);
- if ($st eq "succeeded") {
- system("echo \"$pkg->{'rev'}\" > \"$inst_dir/$pkg->{'name'}/.rev\"");
- system("echo \"$pkg->{'time'}\" > \"$inst_dir/$pkg->{'name'}/.time\"");
- &delete_dir($pkg->{'name'});
- }
-}
-
-sub version {
- print "auto-build (Auto Build System) $VERSION\n",
- "Written by Clement Vasseur and Nicolas Pouillard.\n\n",
- "Copyright (C) 2004 LRDE - EPITA Research and Development Laboratory.\n",
- "This is free software; see the source for copying conditions. ",
- "There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A ",
- "PARTICULAR PURPOSE.\n";
- exit 0;
-}
1
0
Index: ChangeLog
from Clement Vasseur <clement.vasseur(a)lrde.epita.fr>
* auto_build: Rename to...
* auto-build: ...this.
2004-07-13 Clement Vasseur <clement.vasseur(a)lrde.epita.fr>
Index: auto_build/auto_build.pl
--- auto_build/auto_build.pl (revision 76)
+++ auto_build/auto_build.pl (working copy)
@@ -1,643 +0,0 @@
-#!/usr/bin/perl -w
-#
-# Auto Build System - auto-build
-# Copyright (C) 2004 LRDE - EPITA Research and Development Laboratory
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-
-# Authors:
-# Clement Vasseur <clement.vasseur(a)lrde.epita.fr>
-# Nicolas Pouillard <nicolas.pouillard(a)lrde.epita.fr>
-
-# Any contribution should follow the Perl style guide: perldoc perlstyle
-# This script should remain self-contained and it should not depend on any
-# module besides the ones in the standard Perl 5.8 installation.
-
-my $VERSION = 0.1;
-
-=pod
-
-=head1 NAME
-
-auto-build
-
-=head1 SYNOPSIS
-
-auto-build [options] packages.list
-
- -m, --man display the manual
- -h, --help print this help and exit
- -V, --version print version information and exit
- -d, --delay=DELAY redo a build cycle after DELAY minutes
-
-=head1 DESCRIPTION
-
-=cut
-
-use strict;
-use Getopt::Long;
-use Pod::Usage;
-
-my $report_dir;
-my $build_dir;
-my $inst_dir;
-my @packages;
-
-my %variables;
-my @colors;
-my %deps;
-
-my $packages;
-my $man = 0;
-my $help = 0;
-my $delay = 0;
-
-GetOptions(
- 'man|m' => \$man,
- 'help|h|?' => \$help,
- 'version|V' => \&version,
- 'delay|d=i' => \$delay,
- '<>' => sub { $packages = $_[0] },
-) or pod2usage(-verbose => 0);
-
-pod2usage(-verbose => 1) if $help;
-pod2usage(-verbose => 2) if $man;
-pod2usage(-verbose => 0) unless defined $packages;
-
-&read_pkg_list($packages);
-&create_dir($report_dir);
-&create_dir($build_dir);
-&create_dir($inst_dir);
-&prepare_pkgs;
-
-while (1) {
- &auto_build;
- last if $delay == 0;
- sleep $delay * 60;
-}
-
-sub auto_build {
- &gen_summary;
-
- foreach my $pkg (@packages) {
- print "$pkg->{'name'}\n";
-
- next if &check_revision($pkg);
- &gen_pkg_report($pkg);
-
- my $ok = 1;
- foreach my $dep (@{$deps{$pkg->{'name'}}}) {
- foreach (@packages) {
- $ok = 0 if $_->{'name'} eq $dep
- and ($_->{'status'} eq 'failed' or $_->{'status'} eq 'skipped');
- }
- unless ($ok) {
- &set_status($pkg, 'skipped');
- last;
- }
- }
-
- &build_pkg($pkg) if $ok;
- }
-}
-
-sub xopen {
- my $filename = shift;
- my $name = $filename;
- my $FILE;
-
- $name =~ s/^>//;
- open $FILE, $filename
- or die "$0: unable to open `$name': $!\n";
- return $FILE;
-}
-
-sub xclose {
- my $FILE = shift;
- close $FILE or die "$0: unable to close `$FILE': $!\n";
-}
-
-sub header {
- my ($filename, $title) = @_;
- my $FILE = &xopen(">$filename");
- select $FILE;
-
- print <<HTML;
-<html>
- <head>
- <title>$title</title>
- </head>
- <body>
-HTML
-
- return $FILE;
-}
-
-sub footer {
- print <<HTML;
- <hr/>
- <h4>Generated by <i>auto-build</i> version $VERSION</h4>
- </body>
-</html>
-HTML
-
- select STDOUT;
- my $FILE = shift;
- &xclose($FILE);
-}
-
-sub read_pkg_list {
- my $filename = shift;
- my $LIST = &xopen($filename);
- my $section;
-
- while (<$LIST>) {
- s/\s*\#.*$//;
- next if m/^\s*$/;
- chomp;
-
- while (s/\s*\\\s*$/ /) {
- my $l = <$LIST>;
- $l =~ s/^\s*//;
- $l =~ s/\s*\#.*$//;
- $_ .= $l;
- chomp;
- }
-
- unless (defined $report_dir) {
- $report_dir = $_;
- next;
- }
-
- unless (defined $build_dir) {
- $build_dir = $_;
- next;
- }
-
- unless (defined $inst_dir) {
- $inst_dir = $_;
- next;
- }
-
- if (m/^\s*color\s+(\w+)\s+\"(.*?)\"\s*$/) {
- push @colors, [ $2, $1 ];
-
- } elsif (m/^\s*section\s+\"(.*)\"\s*$/) {
- $section = $1;
-
- } elsif (m/^([\w\-]+)\s*=\s*(.*?)\s*$/) {
- $variables{$1} = $2;
-
- } elsif (m/^([\w\-]+)\s*$/) {
- push @packages, {
- 'name' => $1,
- 'section' => $section,
- 'opt' => '',
- 'cfg' => '',
- 'rev' => '0'
- };
-
- } elsif (m/^\s*(\w\w\w)\s*:\s*(.*?)\s*$/) {
- my $field = $1;
- my $value = $2;
-
- my $err = 1;
- foreach ('url', 'cfg', 'opt', 'env', 'dif') {
- if ($field eq $_) {
- $err = 0;
- last;
- }
- }
-
- die "$filename:$.: invalid field `$field'\n" if $err;
- while ($value =~ m/\$\{([\w\-]+)\}/) {
- if (defined $variables{$1}) {
- $value =~ s/\$\{([\w\-]+)\}/$variables{$1}/;
- } else {
- $value =~ s/\$\{([\w\-]+)\}/$inst_dir\/$1/;
- push @{$deps{$packages[-1]->{'name'}}}, $1;
- }
- }
- $packages[-1]->{$field} = $value;
-
- } else {
- die "$filename:$.: syntax error\n";
- }
- }
-
- &xclose($LIST);
- (defined $report_dir and defined $build_dir and $inst_dir)
- or die "$0: `report', `build' and `inst' directories must be defined\n";
-}
-
-sub create_dir {
- my $dir = shift;
- return if -d $dir;
- system("/bin/mkdir -p \"$dir\"")
- and die "$0: unable to mkdir `$dir'\n";
-}
-
-sub delete_dir {
- my $dir = shift;
- return unless -d $dir;
- system("/bin/chmod -fR u+w \"$dir\"; /bin/rm -rf \"$dir\"")
- and die "$0: unable to remove `$dir'\n";
-}
-
-sub ch_dir {
- my $dir = shift;
- chdir $dir or die "$0: unable to chdir `$dir': $!\n";
-}
-
-sub time_to_str {
- $_ = shift;
- my $t = '';
-
- if (defined $_ and $_ ne '') {
- $t = ($_ % 60) . "s";
- $t = (($_/60) % 60) . "m$t" if $_ >= 60;
- $t = (($_/(60 * 60)) % 60) . "h$t" if $_ >= 60 * 60;
- }
-
- return $t;
-}
-
-sub gen_summary {
- my $SUMMARY = &header("$report_dir/index.html", "Auto Build System");
- my $section = '';
-
- print <<HTML;
- <h1>Auto Build System</h1>
- <hr/>
- <table>
-HTML
-
- foreach my $pkg (@packages) {
- if ($pkg->{'section'} ne $section) {
- if ($section ne '') {
- print <<HTML;
- <tr>
- <td>
-
- </td>
- </tr>
-HTML
- }
- $section = $pkg->{'section'};
- print <<HTML;
- <tr>
- <td>
- <h3>$section</h3>
- </td>
- </tr>
-HTML
- }
-
- $pkg->{'status'} = '' unless defined $pkg->{'status'};
-
- my $color = "black";
- my $time = &time_to_str($pkg->{'time'});
-
- $color = "red" if $pkg->{'status'} eq "failed";
- $color = "green" if $pkg->{'status'} eq "succeeded";
- $color = "gray" if $pkg->{'status'} eq "skipped";
-
- print <<HTML;
- <tr>
- <td><a href=\"$pkg->{'name'}/$pkg->{'name'}.html\">$pkg->{'name'}</a></td>
- <td> </td>
- <td><font color=\"$color\">$pkg->{'status'}</font></td>
- <td> </td>
- <td><font color=\"gray\">$time</font></td>
- </tr>
-HTML
- }
-
- print " </table>\n";
- &footer($SUMMARY);
-}
-
-sub gen_pkg_report {
- my $pkg = shift;
- my $filename = "$report_dir/$pkg->{'name'}/$pkg->{'name'}.html";
- my $REPORT = &header("$filename", "$pkg->{'name'} report");
-
- my ($ts, $tf) = ('', '');
- $ts = localtime $pkg->{'time_started'} if defined $pkg->{'time_started'};
- $tf = localtime $pkg->{'time_finished'} if defined $pkg->{'time_finished'};
-
- print <<HTML;
- <h1>$pkg->{'name'}</h1>
- <hr/>
- <h3>Build started: $ts</h3>
- <table cellpadding=\"8\">
-HTML
-
- foreach my $step (@{$pkg->{'steps'}}) {
- next unless defined $step->{'name'};
- if (defined $step->{'status'}) {
- my $color = "black";
- $color = "green" if $step->{'status'} eq "succeeded";
- $color = "red" if $step->{'status'} eq "failed";
-
- my $time = &time_to_str($step->{'time'});
-
- print <<HTML;
- <tr>
- <td><a href=\"$step->{'name'}.html\">$step->{'name'}</a></td>
- <td><font color=\"$color\">$step->{'status'}</font></td>
- <td><font color=\"gray\">$time</font></td>
- </tr>
-HTML
- } else {
- print <<HTML;
- <tr>
- <td>$step->{'name'}</td>
- </tr>
-HTML
- }
- }
-
- print <<HTML;
- </table>
- <h3>Build finished: $tf</h3>
-HTML
-
- if (defined $pkg->{'archives'}) {
- foreach (@{$pkg->{'archives'}}) {
- print " <a href=\"$_\">$_</a><br/>\n" if -f $_;
- }
- }
-
- &footer($REPORT);
-}
-
-sub set_status {
- $_[0]->{'status'} = $_[1];
- print " $_[1]\n";
- &gen_summary;
-}
-
-sub gen_log_page {
- my $pkg = shift;
- my $step = shift;
- my $filename = "$report_dir/$pkg->{'name'}/$step->{'name'}.html";
- my $REPORT = &header("$filename", "$pkg->{'name'} - $step->{'name'}");
-
- print <<HTML;
- <h1>$step->{'name'}</h1>
- <h4>$step->{'cmd'}</h4>
- <hr/>
- <a href="$step->{'name'}.log">Log</a>
-HTML
-
- &footer($REPORT);
-}
-
-sub run {
- my $pkg = shift;
- my $step = shift;
- my $status = $step->{'name'};
- my $out = "$report_dir/$pkg->{'name'}/$status";
-
- &set_status($pkg, $status);
- &gen_log_page($pkg, $step);
-
- my $t = time;
- my $exit_code = system("$step->{'cmd'} >$out.log 2>&1");
- $step->{'time'} = time - $t;
-
- my $REPORT = &header("$out.html", "$pkg->{'name'} - $status");
-
- print <<HTML;
- <h1>$step->{'name'}</h1>
- <h4>$step->{'cmd'}</h4>
- <hr/>
- <pre>
-HTML
-
- my $LOG = &xopen("$out.log");
- my $archives_ready;
-
- while (<$LOG>) {
- my $color;
- foreach my $c (@colors) {
- $color = $c->[1] if m/^$c->[0]/;
- last if defined $color;
- }
- if ($status eq 'check') {
- if (($archives_ready and m/^($archives_ready\.tar\.(gz|bz2))$/)
- or m/^(.*\.tar\.(gz|bz2)) is ready for distribution$/) {
- push @{$pkg->{'archives'}}, $1;
- system("/bin/cp \"$1\" \"$report_dir/$pkg->{'name'}\"")
- and die "$0: unable to cp `$1' to `$report_dir/$pkg->{'name'}': $!\n"
;
- }
- $archives_ready = $1 if m/^(.*) archives ready for distribution: $/;
- }
- print "<font color=\"$color\">" if $color;
- print;
- print "</font>" if $color;
- }
-
- print " </pre>\n";
- &xclose($LOG);
- &footer($REPORT);
- return undef if $exit_code;
- return 1;
-}
-
-sub check_revision {
- my $pkg = shift;
- my $revfile = "$inst_dir/$pkg->{'name'}/.rev";
- my $rev;
-
- if ($pkg->{'url'} =~ m|^svn:(.*/([^/]+))$|) {
- chomp($rev = `svn log -q \"https:$1\" 2>/dev/null | grep '^r' | head -n 1`)
;
- $rev =~ s/^r(\d+).*$/$1/;
- } elsif ($pkg->{'url'} =~ m/^((ht|f)tp:.*)$/) {
- chomp($rev = `wget -qnv -O - \"$1\" | md5sum`);
- }
- $pkg->{'rev'} = $rev;
-
- if (-f $revfile) {
- chomp($rev = `cat \"$revfile\"`);
- unlink $revfile if $pkg->{'rev'} ne $rev;
- }
- if (-f $revfile) {
- chomp($pkg->{'time'} = `cat \"$inst_dir/$pkg->{'name'}/.time\"`);
- &set_status($pkg, 'succeeded');
- return 1;
- }
- return undef;
-}
-
-sub get_package {
- my $pkg = shift;
- my @steps;
- $_ = $pkg->{'url'};
-
- if (m|^http://.*/([^/]+)/?$|
- or m|^ftp://.*/([^/]+)/?$|) {
- $_ = "file://$1";
- push @steps, {
- 'name' => 'download',
- 'cmd' => "wget -nv \"$pkg->{'url'}\""
- };
- }
-
- if (m|^file://(.*)$|) {
- my $file = $_ = $1;
- my $c;
-
- $c = "z" if m/\.tar\.gz$/ or m/\.tgz$/;
- $c = "j" if m/\.tar\.bz2$/ or m/\.tbz2$/;
- $pkg->{'dir'} = $file;
-
- if (defined $c) {
- push @steps, {
- 'name' => 'unpack',
- 'cmd' => "tar -x${c}vf \"$file\""
- }, {
- 'dir' => "tar -t${c}f \"$file\" | head -n 1 | cut -d '/' -f 0-1",
- };
- }
-
- } elsif (m|^svn://(.*/([^/]+))/?$|) {
- my $repository = "https://$1";
- $pkg->{'dir'} = $2;
-
- push @steps, {
- 'name' => 'checkout',
- 'cmd' => "svn checkout \"$repository\""
- }, {
- 'dir' => "echo \"$pkg->{'dir'}\"",
- 'name' => 'bootstrap',
- 'cmd' => '(./bootstrap || ./bootstrap.sh || autoreconf -fvi)'
- };
-
- } elsif (m|^prcs://(.*)$|) {
- $pkg->{'dir'} = $1;
-
- push @steps, {
- 'dir' => "echo \"$1\"",
- 'name' => 'checkout',
- 'cmd' => "prcs checkout \"$1\""
- }, {
- 'name' => 'bootstrap',
- 'cmd' => '(./bootstrap || ./bootstrap.sh || autoreconf -fvi)'
- };
-
- } else {
- die "$0: invalid URL `$_': unknown protocol\n";
- }
-
- return @steps;
-}
-
-sub prepare_pkgs {
- foreach my $pkg (@packages) {
- my @steps = &get_package($pkg);
- my $dir = "$report_dir/$pkg->{'name'}";
- &create_dir($dir);
-
- push @steps, {
- 'name' => 'patch',
- 'cmd' => "patch -p0 -t -i \"$pkg->{'dif'}\""
- } if defined $pkg->{'dif'};
- push @steps, {
- 'name' => 'configure',
- 'cmd' => "./configure --prefix=$inst_dir/$pkg->{'name'} $pkg->{'cfg'}"
- }, {
- 'name' => 'build', 'cmd' => 'make'
- };
- my $dcf = '';
- defined $pkg->{'cfg'} and $pkg->{'cfg'} ne ''
- and $dcf = "DISTCHECK_CONFIGURE_FLAGS=\"$pkg->{'cfg'}\" ";
- push @steps, {
- 'name' => 'check',
- 'cmd' => "make ${dcf}distcheck"
- } unless $pkg->{'opt'} =~ m/\bno-check\b/;
- push @steps, {
- 'rm' => "$inst_dir/$pkg->{'name'}"
- },{
- 'name' => 'install', 'cmd' => 'make install'
- };
- $pkg->{'steps'} = \@steps;
- next if &check_revision($pkg);
- &gen_pkg_report($pkg) unless -f "$dir/$pkg->{'name'}.html";
- }
-}
-
-sub build_pkg {
- my $pkg = shift;
- my %env = %ENV;
-
- if (defined $pkg->{'env'}) {
- foreach (split /\s*,\s*/, $pkg->{'env'}) {
- if (m/^\s*(\w+)\s*=\s*\"(.*)\"\s*$/) {
- my ($v, $w) = ($1, $2);
- $w =~ s/\$(\w+)/$ENV{$1}/;
- $ENV{$v} = $w;
- }
- }
- }
-
- my $st;
- my $dir = "$build_dir/$pkg->{'name'}";
- &delete_dir($dir);
- &create_dir($dir);
- &ch_dir($dir);
- $pkg->{'time_started'} = time;
- foreach my $step (@{$pkg->{'steps'}}) {
- $step->{'status'} = "running";
- &gen_pkg_report($pkg);
- &delete_dir($step->{'rm'}) if defined $step->{'rm'};
- if (defined $step->{'dir'}) {
- chomp($pkg->{'dir'} = `$step->{'dir'}`);
- &create_dir($pkg->{'dir'});
- &ch_dir($pkg->{'dir'});
- }
- if (not defined $step->{'cmd'}
- or &run($pkg, $step)) {
- $step->{'status'} = $st = "succeeded";
- next;
- }
- $step->{'status'} = $st = "failed";
- last;
- }
-
- $pkg->{'time_finished'} = time;
- $pkg->{'time'} = $pkg->{'time_finished'} - $pkg->{'time_started'};
- %ENV = %env;
- &gen_pkg_report($pkg);
- &ch_dir($build_dir);
- &set_status($pkg, $st);
- if ($st eq "succeeded") {
- system("echo \"$pkg->{'rev'}\" > \"$inst_dir/$pkg->{'name'}/.rev\"");
- system("echo \"$pkg->{'time'}\" > \"$inst_dir/$pkg->{'name'}/.time\"");
- &delete_dir($pkg->{'name'});
- }
-}
-
-sub version {
- print "auto-build (Auto Build System) $VERSION\n",
- "Written by Clement Vasseur and Nicolas Pouillard.\n\n",
- "Copyright (C) 2004 LRDE - EPITA Research and Development Laboratory.\n",
- "This is free software; see the source for copying conditions. ",
- "There is NO\nwarranty; not even for MERCHANTABILITY or FITNESS FOR A ",
- "PARTICULAR PURPOSE.\n";
- exit 0;
-}
Index: auto_build/packages.list
--- auto_build/packages.list (revision 76)
+++ auto_build/packages.list (working copy)
@@ -1,238 +0,0 @@
-### Auto Build System #########################################################
-
-# report directory
-/mnt/ghost/stud/vasseu_c/www/build
-
-# build directory
-/work/nitro/auto-build/src
-
-# inst directory
-/work/nitro/auto-build/usr
-
-### Color highlighting ########################################################
-
-color red "make.*: \*\*\* "
-color red "SdfChecker:error: "
-color maroon "warning:"
-color maroon "SdfChecker:warning: "
-color gray "make.*:"
-
-### Tiger #####################################################################
-
-section "Tiger"
-
-#------------------------------------------------------------------------------
-
-havm
-
- url: svn://svn.lrde.epita.fr/svn/havm/trunk
- dif: /home/lrde/lrde-2005/vasseu_c/havm.diff
-
-#------------------------------------------------------------------------------
-
-nolimips
-
- url: svn://svn.lrde.epita.fr/svn/nolimips/trunk
-
-### StrategoXT ################################################################
-
-section "StrategoXT"
-
-#------------------------------------------------------------------------------
-
-aterm
-
- url: http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.2.tar.gz
- cfg: --with-gcc
-
-#------------------------------------------------------------------------------
-
-sdf
-
- url: ftp://ftp.stratego-language.org/pub/stratego/sdf2/sdf2-bundle-2.2.tar.gz
- cfg: --with-aterm=${aterm}
- opt: no-check
-
-#------------------------------------------------------------------------------
-
-strategoxt
-
- url: http://losser.st-lab.cs.uu.nl/~mbravenb/dailydist/strategoxt/src/stratego
xt-head.tar.gz
- cfg: --with-aterm=${aterm}\
- --with-sdf=${sdf}
- opt: no-check
-
-#------------------------------------------------------------------------------
-
-stratego-shell
-
- url: svn://svn.cs.uu.nl:12443/repos/StrategoXT/trunk/experimental/stratego-she
ll
- cfg: --with-aterm=${aterm}\
- --with-sdf=${sdf}\
- --with-strategoxt=${strategoxt}
- env: PATH="${strategoxt}/bin:$PATH"
-
-### Transformers ##############################################################
-
-section "Transformers"
-
-#------------------------------------------------------------------------------
-
-sdf-option
-
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/sdf-option
- cfg: --with-aterm=${aterm}\
- --with-strategoxt=${strategoxt}
- env: PATH="${strategoxt}/bin:$PATH"
-
-#------------------------------------------------------------------------------
-
-esdf
-
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/esdf
- cfg: --with-aterm=${aterm}\
- --with-sdf=${sdf}\
- --with-strategoxt=${strategoxt}
- env: PATH="${strategoxt}/bin:$PATH"
-
-#------------------------------------------------------------------------------
-
-boxedsdf
-
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/boxedsdf
- cfg: --with-aterm=${aterm}\
- --with-sdf=${sdf}\
- --with-strategoxt=${strategoxt}\
- --with-esdf=${esdf}
- env: PATH="${strategoxt}/bin:$PATH"
-
-#------------------------------------------------------------------------------
-
-sdf-detgen
-
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/sdf-detgen
- cfg: --with-aterm=${aterm}\
- --with-sdf=${sdf}\
- --with-strategoxt=${strategoxt}\
- --with-boxedsdf=${boxedsdf}\
- --with-esdf=${esdf}
- env: PATH="${strategoxt}/bin:$PATH"
-
-#------------------------------------------------------------------------------
-
-sdf-astgen
-
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/sdf-astgen
- cfg: --with-aterm=${aterm}\
- --with-sdf=${sdf}\
- --with-strategoxt=${strategoxt}
- env: PATH="${strategoxt}/bin:$PATH"
-
-#------------------------------------------------------------------------------
-
-sdf-attribute
-
- url: svn://svn.lrde.epita.fr/svn/transformers/experimental/sdf-attribute
- cfg: --with-aterm=${aterm}\
- --with-sdf=${sdf}\
- --with-strategoxt=${strategoxt}\
- --with-sdf-detgen=${sdf-detgen}\
- --with-esdf=${esdf}
- env: PATH="${strategoxt}/bin:$PATH"
-
-#------------------------------------------------------------------------------
-
-c-grammar
-
- url: svn://svn.lrde.epita.fr/svn/transformers/branches/c-grammar
- cfg: --with-aterm=${aterm}\
- --with-sdf=${sdf}\
- --with-strategoxt=${strategoxt}\
- --with-boxedsdf=${boxedsdf}\
- --with-sdf-option=${sdf-option}\
- --with-sdf-detgen=${sdf-detgen}\
- --with-sdf-astgen=${sdf-astgen}\
- --with-sdf-attribute=${sdf-attribute}\
- --with-esdf=${esdf}
- env: PATH="${sdf-detgen}/bin:${stratego-shell}/bin:${strategoxt}/bin:$PATH"
-
-#------------------------------------------------------------------------------
-
-cxx-grammar
-
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/cxx-grammar
- dif: /home/lrde/lrde-2005/vasseu_c/cxx-grammar.diff
- cfg: --with-aterm=${aterm}\
- --with-sdf=${sdf}\
- --with-strategoxt=${strategoxt}\
- --with-boxedsdf=${boxedsdf}\
- --with-sdf-option=${sdf-option}\
- --with-sdf-detgen=${sdf-detgen}\
- --with-sdf-astgen=${sdf-astgen}\
- --with-esdf=${esdf}
- env: PATH="${strategoxt}/bin:$PATH"
-
-#------------------------------------------------------------------------------
-
-cxx-basic
-
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/cxx-basic
- cfg: --with-aterm=${aterm}\
- --with-strategoxt=${strategoxt}\
- --with-cxx-grammar=${cxx-grammar}
- env: PATH="${strategoxt}/bin:$PATH"
-
-#------------------------------------------------------------------------------
-
-cxx-typecheck
-
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/cxx-typecheck
- cfg: --with-aterm=${aterm}\
- --with-sdf=${sdf}\
- --with-strategoxt=${strategoxt}\
- --with-boxedsdf=${boxedsdf}\
- --with-sdf-option=${sdf-option}\
- --with-cxx-grammar=${cxx-grammar}\
- --with-esdf=${esdf}
- env: PATH="${strategoxt}/bin:$PATH"
-
-#------------------------------------------------------------------------------
-
-specs-grammar
-
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/specs-grammar
- cfg: --with-aterm=${aterm}\
- --with-sdf=${sdf}\
- --with-strategoxt=${strategoxt}\
- --with-cxx-grammar=${cxx-grammar}\
- --with-boxedsdf=${boxedsdf}\
- --with-sdf-option=${sdf-option}\
- --with-sdf-detgen=${sdf-detgen}\
- --with-esdf=${esdf}\
- --with-sdf-astgen=${sdf-astgen}
- env: PATH="${strategoxt}/bin:$PATH"
-
-### Olena #####################################################################
-
-section "Olena"
-
-#------------------------------------------------------------------------------
-
-olena
-
- url: prcs://oln
- env: PRCS_REPOSITORY="/home/lrde/admin/prcs/repository"
-
-### Vaucanson #################################################################
-
-section "Vaucanson"
-
-#------------------------------------------------------------------------------
-
-vaucanson
-
- url: svn://svn.lrde.epita.fr/svn/vaucanson/trunk
- cfg: --with-xml
- env: PATH="/home/lrde/lrde-2005/vasseu_c/usr/bin/old:$PATH"
-
-#------------------------------------------------------------------------------
Index: auto_build/packages.yml
--- auto_build/packages.yml (revision 76)
+++ auto_build/packages.yml (working copy)
@@ -1,112 +0,0 @@
----
-working directory: '/tmp/auto_build'
-
-report directory: '/home/lrde/stud/pouill_n/build'
-
----
-# StrategoXT
-
-# - name: aterm
-# url: http://www.cwi.nl/projects/MetaEnv/daily-dist/aterm-2.1.tar.gz
-# cfg: '--with-gcc=${gcc}'
-# opt: [ nocheck ]
-#
-# - name: sdf
-# url: http://losser.st-lab.cs.uu.nl/~mbravenb/dailydist/sdf2-bundle/src/sdf2
-bundle-head.tar.gz
-# cfg: '--with-aterm=${aterm}'
-# opt: [ nocheck ]
-#
-# - name: strategoxt
-# url: http://losser.st-lab.cs.uu.nl/~mbravenb/dailydist/strategoxt/src/stra
tegoxt-head.tar.gz
-# cfg: '--with-aterm=${aterm} --with-sdf=${sdf}'
-# opt: [ nocheck ]
-
-# Transformers
-
-- name: sdf-option
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/sdf-option
- cfg: '--with-aterm=${aterm} --with-strategoxt=${strategoxt}'
- env: PATH="${strategoxt}/bin:$PATH"
-
-- name: esdf
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/esdf
- cfg: >
- --with-aterm=${aterm}
- --with-sdf=${sdf}
- --with-strategoxt=${strategoxt}
- env: PATH="${strategoxt}/bin:$PATH"
-
-- name: boxedsdf
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/boxedsdf
- cfg: >
- --with-aterm=${aterm}
- --with-sdf=${sdf}
- --with-strategoxt=${strategoxt}
- --with-esdf=${esdf}
- env: PATH="${strategoxt}/bin:$PATH"
-
-- name: sdf-detgen
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/sdf-detgen
- cfg: >
- --with-aterm=${aterm}
- --with-sdf=${sdf}
- --with-strategoxt=${strategoxt}
- --with-boxedsdf=${boxedsdf}
- --with-esdf=${esdf}
- env: PATH="${strategoxt}/bin:$PATH"
-
-- name: cxx-grammar
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/cxx-grammar
- cfg: >
- --with-aterm=${aterm}
- --with-sdf=${sdf}
- --with-strategoxt=${strategoxt}
- --with-boxedsdf=${boxedsdf}
- --with-sdf-option=${sdf-option}
- --with-sdf-detgen=${sdf-detgen}
- --with-esdf=${esdf}
- env: PATH="${strategoxt}/bin:$PATH"
-
-- name: cxx-basic
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/cxx-basic
- cfg: >
- --with-aterm=${aterm}
- --with-strategoxt=${strategoxt}
- --with-cxx-grammar=${cxx-grammar}
- env: PATH="${strategoxt}/bin:$PATH"
-
-- name: cxx-typecheck
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/cxx-typecheck
- cfg: >
- --with-aterm=${aterm}
- --with-sdf=${sdf}
- --with-strategoxt=${strategoxt}
- --with-boxedsdf=${boxedsdf}
- --with-sdf-option=${sdf-option}
- --with-cxx-grammar=${cxx-grammar}
- --with-esdf=${esdf}
- env: PATH="${strategoxt}/bin:$PATH"
-
-- name: sdf-astgen
-# url: svn://svn.lrde.epita.fr/svn/transformers/trunk/sdf-astgen
- url: file:///home/lrde/stud/pouill_n/transformers/sdf-astgen
- cfg: >
- --with-aterm=${aterm}
- --with-sdf=${sdf}
- --with-strategoxt=${strategoxt}
- env: PATH="${strategoxt}/bin:$PATH"
-
-- name: specs-grammar
- url: svn://svn.lrde.epita.fr/svn/transformers/trunk/specs-grammar
-# url: file:///home/lrde/stud/pouill_n/transformers_release/trunk/specs-gramma
r
- cfg: >
- --with-aterm=${aterm}
- --with-sdf=${sdf}
- --with-strategoxt=${strategoxt}
- --with-cxx-grammar=${cxx-grammar}
- --with-boxedsdf=${boxedsdf}
- --with-sdf-option=${sdf-option}
- --with-sdf-detgen=${sdf-detgen}
- --with-esdf=${esdf}
- --with-sdf-astgen=${sdf-astgen}
- env: PATH="${strategoxt}/bin:$PATH"
1
0
Index: ChangeLog
from Clement Vasseur <clement.vasseur(a)lrde.epita.fr>
* auto_build/auto_build.pl: Clean the script. Prepare for name change.
* auto_build/packages.list: Adjust.
Index: auto_build/auto_build.pl
--- auto_build/auto_build.pl (revision 76)
+++ auto_build/auto_build.pl (working copy)
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
#
-# Auto Build System - auto_build.pl
+# Auto Build System - auto-build
# Copyright (C) 2004 LRDE - EPITA Research and Development Laboratory
#
# This program is free software; you can redistribute it and/or modify
@@ -22,19 +22,23 @@
# Clement Vasseur <clement.vasseur(a)lrde.epita.fr>
# Nicolas Pouillard <nicolas.pouillard(a)lrde.epita.fr>
+# Any contribution should follow the Perl style guide: perldoc perlstyle
+# This script should remain self-contained and it should not depend on any
+# module besides the ones in the standard Perl 5.8 installation.
+
my $VERSION = 0.1;
=pod
=head1 NAME
-auto_build.pl
+auto-build
=head1 SYNOPSIS
-auto_build.pl [options] packages.list
+auto-build [options] packages.list
- -m, --man display the auto_build manual
+ -m, --man display the manual
-h, --help print this help and exit
-V, --version print version information and exit
-d, --delay=DELAY redo a build cycle after DELAY minutes
@@ -47,12 +51,13 @@
use Getopt::Long;
use Pod::Usage;
-my $work_dir;
my $report_dir;
+my $build_dir;
+my $inst_dir;
my @packages;
my %variables;
-my %colors;
+my @colors;
my %deps;
my $packages;
@@ -73,8 +78,9 @@
pod2usage(-verbose => 0) unless defined $packages;
&read_pkg_list($packages);
-&create_dir("$work_dir/src");
-&create_dir("$report_dir");
+&create_dir($report_dir);
+&create_dir($build_dir);
+&create_dir($inst_dir);
&prepare_pkgs;
while (1) {
@@ -89,25 +95,17 @@
foreach my $pkg (@packages) {
print "$pkg->{'name'}\n";
- my $rev = "$work_dir/usr/$pkg->{'name'}/.rev";
- if ($pkg->{'url'} =~ m/^svn:/) {
- &get_revision($pkg);
- unlink $rev if -f $rev and $pkg->{'rev'} > `cat $rev`;
- }
- if (-f $rev) {
- &set_status($pkg, "skipped");
- next;
- }
-
+ next if &check_revision($pkg);
&gen_pkg_report($pkg);
my $ok = 1;
foreach my $dep (@{$deps{$pkg->{'name'}}}) {
foreach (@packages) {
- $ok = 0 if $_->{'name'} eq $dep and $_->{'status'} eq "failed";
+ $ok = 0 if $_->{'name'} eq $dep
+ and ($_->{'status'} eq 'failed' or $_->{'status'} eq 'skipped');
}
unless ($ok) {
- &set_status($pkg, "skipped");
+ &set_status($pkg, 'skipped');
last;
}
}
@@ -116,36 +114,89 @@
}
}
-sub read_pkg_list {
+sub xopen {
my $filename = shift;
+ my $name = $filename;
+ my $FILE;
+
+ $name =~ s/^>//;
+ open $FILE, $filename
+ or die "$0: unable to open `$name': $!\n";
+ return $FILE;
+}
+
+sub xclose {
+ my $FILE = shift;
+ close $FILE or die "$0: unable to close `$FILE': $!\n";
+}
+
+sub header {
+ my ($filename, $title) = @_;
+ my $FILE = &xopen(">$filename");
+ select $FILE;
+
+ print <<HTML;
+<html>
+ <head>
+ <title>$title</title>
+ </head>
+ <body>
+HTML
+
+ return $FILE;
+}
- open LIST, $filename
- or die "$0: unable to open `$filename': $!\n";
+sub footer {
+ print <<HTML;
+ <hr/>
+ <h4>Generated by <i>auto-build</i> version $VERSION</h4>
+ </body>
+</html>
+HTML
- while (<LIST>) {
+ select STDOUT;
+ my $FILE = shift;
+ &xclose($FILE);
+}
+
+sub read_pkg_list {
+ my $filename = shift;
+ my $LIST = &xopen($filename);
+ my $section;
+
+ while (<$LIST>) {
s/\s*\#.*$//;
next if m/^\s*$/;
chomp;
while (s/\s*\\\s*$/ /) {
- my $l = <LIST>;
+ my $l = <$LIST>;
$l =~ s/^\s*//;
$l =~ s/\s*\#.*$//;
$_ .= $l;
chomp;
}
- unless (defined $work_dir) {
- $work_dir = $_;
- next;
- }
unless (defined $report_dir) {
$report_dir = $_;
next;
}
- if (m/^color\s+([\dA-Fa-f]+)\s+\"(.*?)\"\s*$/) {
- $colors{$2} = $1;
+ unless (defined $build_dir) {
+ $build_dir = $_;
+ next;
+ }
+
+ unless (defined $inst_dir) {
+ $inst_dir = $_;
+ next;
+ }
+
+ if (m/^\s*color\s+(\w+)\s+\"(.*?)\"\s*$/) {
+ push @colors, [ $2, $1 ];
+
+ } elsif (m/^\s*section\s+\"(.*)\"\s*$/) {
+ $section = $1;
} elsif (m/^([\w\-]+)\s*=\s*(.*?)\s*$/) {
$variables{$1} = $2;
@@ -153,12 +204,10 @@
} elsif (m/^([\w\-]+)\s*$/) {
push @packages, {
'name' => $1,
- 'status' => '',
+ 'section' => $section,
'opt' => '',
'cfg' => '',
- 'rev' => '0',
- 'time_started' => '',
- 'time_finished' => ''
+ 'rev' => '0'
};
} elsif (m/^\s*(\w\w\w)\s*:\s*(.*?)\s*$/) {
@@ -178,7 +227,7 @@
if (defined $variables{$1}) {
$value =~ s/\$\{([\w\-]+)\}/$variables{$1}/;
} else {
- $value =~ s/\$\{([\w\-]+)\}/$work_dir\/usr\/$1/;
+ $value =~ s/\$\{([\w\-]+)\}/$inst_dir\/$1/;
push @{$deps{$packages[-1]->{'name'}}}, $1;
}
}
@@ -189,8 +238,9 @@
}
}
- (defined $work_dir and defined $report_dir)
- or die "$0: `work' and `report' directories must be defined\n";
+ &xclose($LIST);
+ (defined $report_dir and defined $build_dir and $inst_dir)
+ or die "$0: `report', `build' and `inst' directories must be defined\n";
}
sub create_dir {
@@ -212,91 +262,127 @@
chdir $dir or die "$0: unable to chdir `$dir': $!\n";
}
+sub time_to_str {
+ $_ = shift;
+ my $t = '';
+
+ if (defined $_ and $_ ne '') {
+ $t = ($_ % 60) . "s";
+ $t = (($_/60) % 60) . "m$t" if $_ >= 60;
+ $t = (($_/(60 * 60)) % 60) . "h$t" if $_ >= 60 * 60;
+ }
+
+ return $t;
+}
+
sub gen_summary {
- open SUMMARY, ">$report_dir/index.html"
- or die "$0: unable to open `$report_dir/index.html': $!\n";
+ my $SUMMARY = &header("$report_dir/index.html", "Auto Build System");
+ my $section = '';
- print SUMMARY <<HTML;
-<html>
- <head>
- <title>Auto Build System</title>
- </head>
- <body>
+ print <<HTML;
<h1>Auto Build System</h1>
<hr/>
<table>
HTML
- foreach (@packages) {
+ foreach my $pkg (@packages) {
+ if ($pkg->{'section'} ne $section) {
+ if ($section ne '') {
+ print <<HTML;
+ <tr>
+ <td>
+
+ </td>
+ </tr>
+HTML
+ }
+ $section = $pkg->{'section'};
+ print <<HTML;
+ <tr>
+ <td>
+ <h3>$section</h3>
+ </td>
+ </tr>
+HTML
+ }
+
+ $pkg->{'status'} = '' unless defined $pkg->{'status'};
+
my $color = "black";
- $color = "red" if $_->{'status'} eq "failed";
- $color = "green" if $_->{'status'} eq "succeeded";
- $color = "gray" if $_->{'status'} eq "skipped";
+ my $time = &time_to_str($pkg->{'time'});
+
+ $color = "red" if $pkg->{'status'} eq "failed";
+ $color = "green" if $pkg->{'status'} eq "succeeded";
+ $color = "gray" if $pkg->{'status'} eq "skipped";
- print SUMMARY <<HTML;
+ print <<HTML;
<tr>
- <td><a href=\"$_->{'name'}/$_->{'name'}.html\">$_->{'name'}</a></td>
- <td><font color=\"$color\">$_->{'status'}</font></td>
+ <td><a href=\"$pkg->{'name'}/$pkg->{'name'}.html\">$pkg->{'name'}</a></td>
+ <td> </td>
+ <td><font color=\"$color\">$pkg->{'status'}</font></td>
+ <td> </td>
+ <td><font color=\"gray\">$time</font></td>
</tr>
HTML
}
- print SUMMARY <<HTML;
- </table>
- </body>
-</html>
-HTML
- close SUMMARY;
+ print " </table>\n";
+ &footer($SUMMARY);
}
sub gen_pkg_report {
my $pkg = shift;
- my $dir = "$report_dir/$pkg->{'name'}/$pkg->{'name'}.html";
+ my $filename = "$report_dir/$pkg->{'name'}/$pkg->{'name'}.html";
+ my $REPORT = &header("$filename", "$pkg->{'name'} report");
- open REPORT, ">$dir"
- or die "$0: unable to open `$dir': $!\n";
+ my ($ts, $tf) = ('', '');
+ $ts = localtime $pkg->{'time_started'} if defined $pkg->{'time_started'};
+ $tf = localtime $pkg->{'time_finished'} if defined $pkg->{'time_finished'};
- print REPORT <<HTML;
-<html>
- <head>
- <title>$pkg->{'name'} report</title>
- </head>
- <body>
+ print <<HTML;
<h1>$pkg->{'name'}</h1>
<hr/>
- <h3>Build started: $pkg->{'time_started'}</h3>
- <table>
+ <h3>Build started: $ts</h3>
+ <table cellpadding=\"8\">
HTML
- foreach (@{$pkg->{'steps'}}) {
- next unless defined $_->{'name'};
- if (defined $_->{'status'}) {
+ foreach my $step (@{$pkg->{'steps'}}) {
+ next unless defined $step->{'name'};
+ if (defined $step->{'status'}) {
my $color = "black";
- $color = "green" if $_->{'status'} eq "succeeded";
- $color = "red" if $_->{'status'} eq "failed";
+ $color = "green" if $step->{'status'} eq "succeeded";
+ $color = "red" if $step->{'status'} eq "failed";
+
+ my $time = &time_to_str($step->{'time'});
- print REPORT <<HTML;
+ print <<HTML;
<tr>
- <td><a href=\"$_->{'name'}.html\">$_->{'name'}</a></td>
- <td><font color=\"$color\">$_->{'status'}</font></td>
+ <td><a href=\"$step->{'name'}.html\">$step->{'name'}</a></td>
+ <td><font color=\"$color\">$step->{'status'}</font></td>
+ <td><font color=\"gray\">$time</font></td>
</tr>
HTML
} else {
- print REPORT <<HTML;
+ print <<HTML;
<tr>
- <td>$_->{'name'}</td>
+ <td>$step->{'name'}</td>
</tr>
HTML
}
}
- print REPORT <<HTML;
+ print <<HTML;
</table>
- <h3>Build finished: $pkg->{'time_finished'}</h3>
- </body>
-</html>
+ <h3>Build finished: $tf</h3>
HTML
- close REPORT;
+
+ if (defined $pkg->{'archives'}) {
+ foreach (@{$pkg->{'archives'}}) {
+ print " <a href=\"$_\">$_</a><br/>\n" if -f $_;
+ }
+ }
+
+ &footer($REPORT);
}
sub set_status {
@@ -305,92 +391,97 @@
&gen_summary;
}
-sub err {
- print "error: @_\n";
- return undef;
-}
-
sub gen_log_page {
my $pkg = shift;
- my $status = shift;
- my $out = "$report_dir/$pkg->{'name'}/$status.html";
-
- open LOG, ">$out"
- or die "$0: unable to open `$out': $!\n";
-
- print LOG <<HTML;
-<html>
- <head>
- <title>$pkg->{'name'} - $status</title>
- </head>
- <body>
- <h1>@_</h1>
+ my $step = shift;
+ my $filename = "$report_dir/$pkg->{'name'}/$step->{'name'}.html";
+ my $REPORT = &header("$filename", "$pkg->{'name'} - $step->{'name'}");
+
+ print <<HTML;
+ <h1>$step->{'name'}</h1>
+ <h4>$step->{'cmd'}</h4>
<hr/>
- <a href="$status.log">Log</a>
- </body>
-</html>
+ <a href="$step->{'name'}.log">Log</a>
HTML
- close LOG;
+ &footer($REPORT);
}
sub run {
my $pkg = shift;
- my $status = shift;
+ my $step = shift;
+ my $status = $step->{'name'};
my $out = "$report_dir/$pkg->{'name'}/$status";
&set_status($pkg, $status);
- &gen_log_page($pkg, $status, @_);
+ &gen_log_page($pkg, $step);
- my $exit_code = system("@_ >$out.log 2>&1");
+ my $t = time;
+ my $exit_code = system("$step->{'cmd'} >$out.log 2>&1");
+ $step->{'time'} = time - $t;
- open LOG, ">$out.html"
- or die "$0: unable to open `$out.html': $!\n";
+ my $REPORT = &header("$out.html", "$pkg->{'name'} - $status");
- print LOG <<HTML;
-<html>
- <head>
- <title>$pkg->{'name'} - $status</title>
- </head>
- <body>
- <h1>@_</h1>
+ print <<HTML;
+ <h1>$step->{'name'}</h1>
+ <h4>$step->{'cmd'}</h4>
<hr/>
<pre>
HTML
- open OUT, "$out.log"
- or die "$0: unable to open `$out.log': $!\n";
+ my $LOG = &xopen("$out.log");
+ my $archives_ready;
- while (<OUT>) {
+ while (<$LOG>) {
my $color;
- foreach my $regex (keys %colors) {
- $color = $colors{$regex} if m/^$regex$/;
- }
- print LOG "<font color=\"#$color\">" if $color;
- print LOG;
- print LOG "</font>" if $color;
- }
-
- print LOG <<HTML;
- </pre>
- </body>
-</html>
-HTML
- close LOG;
-
- return &err("command `@_' failed: $?") if $exit_code;
+ foreach my $c (@colors) {
+ $color = $c->[1] if m/^$c->[0]/;
+ last if defined $color;
+ }
+ if ($status eq 'check') {
+ if (($archives_ready and m/^($archives_ready\.tar\.(gz|bz2))$/)
+ or m/^(.*\.tar\.(gz|bz2)) is ready for distribution$/) {
+ push @{$pkg->{'archives'}}, $1;
+ system("/bin/cp \"$1\" \"$report_dir/$pkg->{'name'}\"")
+ and die "$0: unable to cp `$1' to `$report_dir/$pkg->{'name'}': $!\n"
;
+ }
+ $archives_ready = $1 if m/^(.*) archives ready for distribution: $/;
+ }
+ print "<font color=\"$color\">" if $color;
+ print;
+ print "</font>" if $color;
+ }
+
+ print " </pre>\n";
+ &xclose($LOG);
+ &footer($REPORT);
+ return undef if $exit_code;
return 1;
}
-sub get_revision {
+sub check_revision {
my $pkg = shift;
+ my $revfile = "$inst_dir/$pkg->{'name'}/.rev";
+ my $rev;
if ($pkg->{'url'} =~ m|^svn:(.*/([^/]+))$|) {
- my $rev = `svn log -q \"https:$1\" 2>/dev/null | grep '^r' | head -n 1`;
- chomp($rev);
+ chomp($rev = `svn log -q \"https:$1\" 2>/dev/null | grep '^r' | head -n 1`)
;
$rev =~ s/^r(\d+).*$/$1/;
+ } elsif ($pkg->{'url'} =~ m/^((ht|f)tp:.*)$/) {
+ chomp($rev = `wget -qnv -O - \"$1\" | md5sum`);
+ }
$pkg->{'rev'} = $rev;
+
+ if (-f $revfile) {
+ chomp($rev = `cat \"$revfile\"`);
+ unlink $revfile if $pkg->{'rev'} ne $rev;
+ }
+ if (-f $revfile) {
+ chomp($pkg->{'time'} = `cat \"$inst_dir/$pkg->{'name'}/.time\"`);
+ &set_status($pkg, 'succeeded');
+ return 1;
}
+ return undef;
}
sub get_package {
@@ -398,7 +489,8 @@
my @steps;
$_ = $pkg->{'url'};
- if (m|^http://.*/([^/]+)/?$|) {
+ if (m|^http://.*/([^/]+)/?$|
+ or m|^ftp://.*/([^/]+)/?$|) {
$_ = "file://$1";
push @steps, {
'name' => 'download',
@@ -415,30 +507,39 @@
$pkg->{'dir'} = $file;
if (defined $c) {
- my $dir = `tar -t${c}f $file | head -n 1 | cut -d '/' -f 0-1`;
- chomp($pkg->{'dir'} = $dir);
- &delete_dir($pkg->{'dir'});
-
push @steps, {
'name' => 'unpack',
'cmd' => "tar -x${c}vf \"$file\""
}, {
- 'dir' => "$work_dir/src/$pkg->{'dir'}"
+ 'dir' => "tar -t${c}f \"$file\" | head -n 1 | cut -d '/' -f 0-1",
};
}
} elsif (m|^svn://(.*/([^/]+))/?$|) {
my $repository = "https://$1";
$pkg->{'dir'} = $2;
- &delete_dir($pkg->{'dir'});
+
push @steps, {
'name' => 'checkout',
- 'cmd' => "svn checkout $repository"
+ 'cmd' => "svn checkout \"$repository\""
}, {
- 'dir' => "$work_dir/src/$pkg->{'dir'}",
+ 'dir' => "echo \"$pkg->{'dir'}\"",
'name' => 'bootstrap',
- 'cmd' => "./bootstrap"
+ 'cmd' => '(./bootstrap || ./bootstrap.sh || autoreconf -fvi)'
};
+
+ } elsif (m|^prcs://(.*)$|) {
+ $pkg->{'dir'} = $1;
+
+ push @steps, {
+ 'dir' => "echo \"$1\"",
+ 'name' => 'checkout',
+ 'cmd' => "prcs checkout \"$1\""
+ }, {
+ 'name' => 'bootstrap',
+ 'cmd' => '(./bootstrap || ./bootstrap.sh || autoreconf -fvi)'
+ };
+
} else {
die "$0: invalid URL `$_': unknown protocol\n";
}
@@ -449,7 +550,8 @@
sub prepare_pkgs {
foreach my $pkg (@packages) {
my @steps = &get_package($pkg);
- &create_dir("$report_dir/$pkg->{'name'}");
+ my $dir = "$report_dir/$pkg->{'name'}";
+ &create_dir($dir);
push @steps, {
'name' => 'patch',
@@ -457,15 +559,25 @@
} if defined $pkg->{'dif'};
push @steps, {
'name' => 'configure',
- 'cmd' => "./configure --prefix=$work_dir/usr/$pkg->{'name'} $pkg->{'cfg'}
"
+ 'cmd' => "./configure --prefix=$inst_dir/$pkg->{'name'} $pkg->{'cfg'}"
}, {
'name' => 'build', 'cmd' => 'make'
- }, {
+ };
+ my $dcf = '';
+ defined $pkg->{'cfg'} and $pkg->{'cfg'} ne ''
+ and $dcf = "DISTCHECK_CONFIGURE_FLAGS=\"$pkg->{'cfg'}\" ";
+ push @steps, {
'name' => 'check',
- 'cmd' => "make DISTCHECK_CONFIGURE_FLAGS=\"$pkg->{'cfg'}\" distcheck"
+ 'cmd' => "make ${dcf}distcheck"
} unless $pkg->{'opt'} =~ m/\bno-check\b/;
- push @steps, { 'name' => 'install', 'cmd' => 'make install' };
+ push @steps, {
+ 'rm' => "$inst_dir/$pkg->{'name'}"
+ },{
+ 'name' => 'install', 'cmd' => 'make install'
+ };
$pkg->{'steps'} = \@steps;
+ next if &check_revision($pkg);
+ &gen_pkg_report($pkg) unless -f "$dir/$pkg->{'name'}.html";
}
}
@@ -484,15 +596,22 @@
}
my $st;
- &ch_dir("$work_dir/src");
- &delete_dir($pkg->{'dir'});
- $pkg->{'time_started'} = localtime;
+ my $dir = "$build_dir/$pkg->{'name'}";
+ &delete_dir($dir);
+ &create_dir($dir);
+ &ch_dir($dir);
+ $pkg->{'time_started'} = time;
foreach my $step (@{$pkg->{'steps'}}) {
$step->{'status'} = "running";
&gen_pkg_report($pkg);
- &ch_dir($step->{'dir'}) if defined $step->{'dir'};
+ &delete_dir($step->{'rm'}) if defined $step->{'rm'};
+ if (defined $step->{'dir'}) {
+ chomp($pkg->{'dir'} = `$step->{'dir'}`);
+ &create_dir($pkg->{'dir'});
+ &ch_dir($pkg->{'dir'});
+ }
if (not defined $step->{'cmd'}
- or &run($pkg, $step->{'name'}, $step->{'cmd'})) {
+ or &run($pkg, $step)) {
$step->{'status'} = $st = "succeeded";
next;
}
@@ -500,19 +619,21 @@
last;
}
+ $pkg->{'time_finished'} = time;
+ $pkg->{'time'} = $pkg->{'time_finished'} - $pkg->{'time_started'};
%ENV = %env;
- $pkg->{'time_finished'} = localtime;
&gen_pkg_report($pkg);
- &ch_dir("$work_dir/src");
+ &ch_dir($build_dir);
&set_status($pkg, $st);
if ($st eq "succeeded") {
- system("echo \"$pkg->{'rev'}\" > \"$work_dir/usr/$pkg->{'name'}/.rev\"");
- &delete_dir($pkg->{'dir'});
+ system("echo \"$pkg->{'rev'}\" > \"$inst_dir/$pkg->{'name'}/.rev\"");
+ system("echo \"$pkg->{'time'}\" > \"$inst_dir/$pkg->{'name'}/.time\"");
+ &delete_dir($pkg->{'name'});
}
}
sub version {
- print "auto_build.pl (Auto Build System) $VERSION\n",
+ print "auto-build (Auto Build System) $VERSION\n",
"Written by Clement Vasseur and Nicolas Pouillard.\n\n",
"Copyright (C) 2004 LRDE - EPITA Research and Development Laboratory.\n",
"This is free software; see the source for copying conditions. ",
Index: auto_build/packages.list
--- auto_build/packages.list (revision 76)
+++ auto_build/packages.list (working copy)
@@ -1,50 +1,83 @@
### Auto Build System #########################################################
-# work directory
-/tmp/auto_build
-
# report directory
-/mnt/ghost/stud/vasseu_c/www
+/mnt/ghost/stud/vasseu_c/www/build
+
+# build directory
+/work/nitro/auto-build/src
+
+# inst directory
+/work/nitro/auto-build/usr
### Color highlighting ########################################################
-color 808080 "make.*?:.*"
-color FF0000 "warning:.*"
-color FF0000 "SdfChecker:warning:.*"
+color red "make.*: \*\*\* "
+color red "SdfChecker:error: "
+color maroon "warning:"
+color maroon "SdfChecker:warning: "
+color gray "make.*:"
+
+### Tiger #####################################################################
+
+section "Tiger"
+
+#------------------------------------------------------------------------------
+
+havm
+
+ url: svn://svn.lrde.epita.fr/svn/havm/trunk
+ dif: /home/lrde/lrde-2005/vasseu_c/havm.diff
+
+#------------------------------------------------------------------------------
+
+nolimips
+
+ url: svn://svn.lrde.epita.fr/svn/nolimips/trunk
### StrategoXT ################################################################
-aterm = /mnt/daily/usr/Aterm
-sdf = /mnt/daily/usr/Sdf
-strategoxt = /mnt/daily/usr/StrategoXT
-# stratego-shell = /mnt/daily/usr/stratego-shell
+section "StrategoXT"
#------------------------------------------------------------------------------
-# aterm
-#
-# url: http://www.cwi.nl/projects/MetaEnv/daily-dist/aterm-2.2.tar.gz
-# cfg: --with-gcc
+aterm
+
+ url: http://www.cwi.nl/projects/MetaEnv/aterm/aterm-2.2.tar.gz
+ cfg: --with-gcc
#------------------------------------------------------------------------------
-# sdf
-#
-# url: http://losser.st-lab.cs.uu.nl/~mbravenb/dailydist/sdf2-bundle-dailydist
/src/sdf2-bundle-dailydist-head.tar.gz
-# cfg: --with-aterm=${aterm}
-# opt: no-check
+sdf
+
+ url: ftp://ftp.stratego-language.org/pub/stratego/sdf2/sdf2-bundle-2.2.tar.gz
+ cfg: --with-aterm=${aterm}
+ opt: no-check
#------------------------------------------------------------------------------
-# strategoxt
-#
-# url: http://losser.st-lab.cs.uu.nl/~mbravenb/dailydist/strategoxt/src/strata
egoxt-head.tar.gz
-# cfg: --with-aterm=${aterm}\
-# --with-sdf=${sdf}
-# opt: no-check
+strategoxt
+
+ url: http://losser.st-lab.cs.uu.nl/~mbravenb/dailydist/strategoxt/src/stratego
xt-head.tar.gz
+ cfg: --with-aterm=${aterm}\
+ --with-sdf=${sdf}
+ opt: no-check
+
+#------------------------------------------------------------------------------
+
+stratego-shell
+
+ url: svn://svn.cs.uu.nl:12443/repos/StrategoXT/trunk/experimental/stratego-she
ll
+ cfg: --with-aterm=${aterm}\
+ --with-sdf=${sdf}\
+ --with-strategoxt=${strategoxt}
+ env: PATH="${strategoxt}/bin:$PATH"
### Transformers ##############################################################
+section "Transformers"
+
+#------------------------------------------------------------------------------
+
sdf-option
url: svn://svn.lrde.epita.fr/svn/transformers/trunk/sdf-option
@@ -99,8 +132,7 @@
sdf-attribute
-#url: svn://svn.lrde.epita.fr/svn/transformers/experimental/sdf-attribute
- url: file:///mnt/daily/dists/sdf-attribute-20040629.tar.bz2
+ url: svn://svn.lrde.epita.fr/svn/transformers/experimental/sdf-attribute
cfg: --with-aterm=${aterm}\
--with-sdf=${sdf}\
--with-strategoxt=${strategoxt}\
@@ -110,19 +142,19 @@
#------------------------------------------------------------------------------
-# c-grammar
-#
-# url: svn://svn.lrde.epita.fr/svn/transformers/branches/c-grammar
-# cfg: --with-aterm=${aterm}\
-# --with-sdf=${sdf}\
-# --with-strategoxt=${strategoxt}\
-# --with-boxedsdf=${boxedsdf}\
-# --with-sdf-option=${sdf-option}\
-# --with-sdf-detgen=${sdf-detgen}\
-# --with-sdf-astgen=${sdf-astgen}\
-# --with-sdf-attribute=${sdf-attribute}\
-# --with-esdf=${esdf}
-# env: PATH="${sdf-detgen}/bin:${stratego-shell}/bin:${strategoxt}/bin:$PATH"
+c-grammar
+
+ url: svn://svn.lrde.epita.fr/svn/transformers/branches/c-grammar
+ cfg: --with-aterm=${aterm}\
+ --with-sdf=${sdf}\
+ --with-strategoxt=${strategoxt}\
+ --with-boxedsdf=${boxedsdf}\
+ --with-sdf-option=${sdf-option}\
+ --with-sdf-detgen=${sdf-detgen}\
+ --with-sdf-astgen=${sdf-astgen}\
+ --with-sdf-attribute=${sdf-attribute}\
+ --with-esdf=${esdf}
+ env: PATH="${sdf-detgen}/bin:${stratego-shell}/bin:${strategoxt}/bin:$PATH"
#------------------------------------------------------------------------------
@@ -152,17 +184,17 @@
#------------------------------------------------------------------------------
-# cxx-typecheck
-#
-# url: svn://svn.lrde.epita.fr/svn/transformers/trunk/cxx-typecheck
-# cfg: --with-aterm=${aterm}\
-# --with-sdf=${sdf}\
-# --with-strategoxt=${strategoxt}\
-# --with-boxedsdf=${boxedsdf}\
-# --with-sdf-option=${sdf-option}\
-# --with-cxx-grammar=${cxx-grammar}\
-# --with-esdf=${esdf}
-# env: PATH="${strategoxt}/bin:$PATH"
+cxx-typecheck
+
+ url: svn://svn.lrde.epita.fr/svn/transformers/trunk/cxx-typecheck
+ cfg: --with-aterm=${aterm}\
+ --with-sdf=${sdf}\
+ --with-strategoxt=${strategoxt}\
+ --with-boxedsdf=${boxedsdf}\
+ --with-sdf-option=${sdf-option}\
+ --with-cxx-grammar=${cxx-grammar}\
+ --with-esdf=${esdf}
+ env: PATH="${strategoxt}/bin:$PATH"
#------------------------------------------------------------------------------
@@ -180,4 +212,27 @@
--with-sdf-astgen=${sdf-astgen}
env: PATH="${strategoxt}/bin:$PATH"
+### Olena #####################################################################
+
+section "Olena"
+
+#------------------------------------------------------------------------------
+
+olena
+
+ url: prcs://oln
+ env: PRCS_REPOSITORY="/home/lrde/admin/prcs/repository"
+
+### Vaucanson #################################################################
+
+section "Vaucanson"
+
+#------------------------------------------------------------------------------
+
+vaucanson
+
+ url: svn://svn.lrde.epita.fr/svn/vaucanson/trunk
+ cfg: --with-xml
+ env: PATH="/home/lrde/lrde-2005/vasseu_c/usr/bin/old:$PATH"
+
#------------------------------------------------------------------------------
2
2

*****SPAM***** The best prlces from Projects's Softw@re on Demand Outlet, 9O% off XP + more
by Gustavo Berliner 13 Jul '04
by Gustavo Berliner 13 Jul '04
13 Jul '04
Spam detection software, running on the system "kualalumpur.lrde.epita.fr", has
identified this incoming email as possible spam. The original message
has been attached to this so you can view it (if it isn't spam) or block
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: military hutchinson ammo sc holocaust crave cutlet
slurry nut professional birdlike *Opt-in Em@il Specials for July 2004*
[...]
Content analysis details: (8.7 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-0.0 BAYES_44 BODY: Bayesian spam probability is 44 to 50%
[score: 0.4407]
0.1 HTML_FONTCOLOR_BLUE BODY: HTML font color is blue
0.2 HTML_TAG_BALANCE_A BODY: HTML has excess "a" close tags
0.1 HTML_MESSAGE BODY: HTML included in message
0.1 HTML_FONTCOLOR_UNSAFE BODY: HTML font color not in safe 6x6x6 palette
0.3 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
0.6 HTML_FONT_INVISIBLE BODY: HTML font color is same as background
0.1 HTML_FONTCOLOR_RED BODY: HTML font color is red
0.1 BIZ_TLD URI: Contains a URL in the BIZ top-level domain
0.7 RCVD_IN_DSBL RBL: Received via a relay in list.dsbl.org
[<http://dsbl.org/listing?ip=64.231.101.118>]
3.5 RCVD_IN_NJABL_DIALUP RBL: NJABL: dialup sender did non-local SMTP
[64.231.101.118 listed in dnsbl.njabl.org]
2.6 RCVD_IN_DYNABLOCK RBL: Sent directly from dynamic IP address
[64.231.101.118 listed in dnsbl.sorbs.net]
0.1 RCVD_IN_NJABL RBL: Received via a relay in dnsbl.njabl.org
[64.231.101.118 listed in dnsbl.njabl.org]
0.1 RCVD_IN_SORBS RBL: SORBS: sender is listed in SORBS
[64.231.101.118 listed in dnsbl.sorbs.net]
The original message was not completely plain text, and may be unsafe to
open with some email clients; in particular, it may contain a virus,
or confirm that your address can receive spam. If you wish to view
it, it may be safer to save it to a file and open it with an editor.
1
0
/tmp % prcs2svn.py -f -t debug -c --copy-svn --svn-root=file:///tmp --svn-project=$TO $WHAT |& tee log
> Copy prcs repository
os.system("prcs package -f lrde-maintain lrde-maintain.pkg")
os.system("prcs unpackage -f ./lrde-maintain.pkg")
prcs: Unpackage project `lrde-maintain'.
> Copy svn repository to /tmp/prcs2svnrDBvw-.svn
os.system("svnadmin hotcopy /tmp/lrde-admin.lrde /tmp/prcs2svnrDBvw-.svn/lrde-admin.lrde")
> Test date coherency of projects
> Create working directory: /tmp/prcs2svn_VYnUW.migrate
> Checkout subversion repository
os.system("svn checkout file:///tmp/prcs2svnrDBvw-.svn/lrde-admin.lrde "/tmp/prcs2svn_VYnUW.migrate"")
A /tmp/prcs2svn_VYnUW.migrate/trunk
A /tmp/prcs2svn_VYnUW.migrate/trunk/net
A /tmp/prcs2svn_VYnUW.migrate/trunk/net/materiel_prete.txt
A /tmp/prcs2svn_VYnUW.migrate/trunk/net/description.txt
A /tmp/prcs2svn_VYnUW.migrate/trunk/net/dns_lrde.signed
A /tmp/prcs2svn_VYnUW.migrate/trunk/net/prises_bocal
A /tmp/prcs2svn_VYnUW.migrate/trunk/net/ChangeLog
A /tmp/prcs2svn_VYnUW.migrate/trunk/net/architecture-réseau.tex
A /tmp/prcs2svn_VYnUW.migrate/trunk/net/README
A /tmp/prcs2svn_VYnUW.migrate/trunk/ChangeLog
A /tmp/prcs2svn_VYnUW.migrate/branches
A /tmp/prcs2svn_VYnUW.migrate/tags
Checked out revision 15.
> Create subversion repository tree
os.system("svn mkdir branches trunk tags")
svn: Try 'svn add' or 'svn add --non-recursive' instead?
svn: Can't create directory 'branches': File exists
Traceback (most recent call last):
File "/usr/local/bin/prcs2svn.py", line 1236, in ?
Main().main()
File "/usr/local/bin/prcs2svn.py", line 1059, in main
prcs2svn.convert()
File "/usr/local/bin/prcs2svn.py", line 813, in convert
self.convert_init()
File "/usr/local/bin/prcs2svn.py", line 803, in convert_init
self.svn.repository_init(self.topdir)
File "/usr/local/bin/prcs2svn.py", line 462, in repository_init
os.path.join(infos.subdir, "tags"), False)
File "/usr/local/bin/prcs2svn.py", line 100, in xsystem
assert(os.system(cmd) == 0)
AssertionError
2
1
Task #156 has been updated.
Project: LrdeTools
Subproject: prcs2svn
Summary: Writing documentation
Complete: 5%
Status: Open
Description: (no comments)
-------------------------------------------------------
For more info, visit:
http://gforge.lrde.epita.fr/pm/task.php?func=detailtask&project_task_id=156…
1
0
Task #155 has been updated.
Project: LrdeTools
Subproject: prcs2svn
Summary: tmp files
Complete: 0%
Status: Open
Description: From: Akim Demaille <akim(a)epita.fr>
Subject: prcs2svn: tmp files
Newsgroups: lrde.proj
Date: Mon, 12 Jul 2004 16:50:59 +0200
Organization: EPITA / LRDE http://www.lrde.epita.fr
Err... It would be nice if prcs2svn did clean its temp files.
By the way, I would suggest a complete change of temp dir scheme.
Instead of putting everybody directly in /tmp, I would create
/tmp/prcs2svn-PROJECT-XXXXX
and inside I would create
prcs/
migrate/
svn/
etc.
That would avoid the clutter, and would make cleaning easier (both
automatically, and by hand).
-------------------------------------------------------
For more info, visit:
http://gforge.lrde.epita.fr/pm/task.php?func=detailtask&project_task_id=155…
1
0