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
July 2004
- 15 participants
- 42 discussions
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* src/vm/memory.hh, src/vm/mmu.hh, src/vm/virtual_machine.cc:
Make the MMU responsible of address translation and exception
raising.
* src/vm/cp0.hh (raise_addr_load, raise_addr_store): Add address
load and store exception.
* src/vm/virtual_machine.hh (execute): Stop execution on fatal
exceptions.
Index: src/vm/cp0.hh
--- src/vm/cp0.hh (revision 109)
+++ src/vm/cp0.hh (working copy)
@@ -106,6 +106,8 @@
// Initialize registers to 0.
for (unsigned i = 0; i < 32; ++i)
registers[i] = 0;
+
+ fatal_exception_ = false;
}
/** \name Explicit register accessors
@@ -143,6 +145,30 @@
std::cerr << "Runtime Exception: Overflow" << std::endl;
exit_set(exit_runtime);
}
+
+ /// Raise an address error on load exception
+ void raise_addr_load()
+ {
+ registers[cause] = addr_load;
+ std::cerr << "Runtime Exception: Address error on load" << std::endl;
+ fatal_exception_ = true;
+ exit_set(exit_runtime);
+ }
+ /// Raise an address error on load exception
+ void raise_addr_store()
+ {
+ registers[cause] = addr_store;
+ std::cerr << "Runtime Exception: Address error on store" << std::endl;
+ fatal_exception_ = true;
+ exit_set(exit_runtime);
+ }
+
+ bool fatal_exception() const
+ {
+ return fatal_exception_;
+ }
+ protected:
+ bool fatal_exception_;
/** \} */
protected:
Index: src/vm/memory.hh
--- src/vm/memory.hh (revision 113)
+++ src/vm/memory.hh (working copy)
@@ -42,14 +42,21 @@
static const int stack_bottom = INT32_MAX - 3;
static const int default_stack_size = 512 * 1024;
+ enum segment_kind
+ {
+ heap = 0,
+ stack = 1
+ };
+
/** \name Constructor and destructor
\{ */
public:
/// Construct a Memory.
Memory(int stack_size = default_stack_size):
- heap_(0), stack_(stack_size), stack_top_(stack_bottom - stack_size + 4)
+ stack_top_(stack_bottom - stack_size + 4)
{
assertion(stack_size > 0);
+ segments_[stack].resize(stack_size);
}
/** \} */
@@ -59,33 +66,29 @@
// DO NOT zero-ify the memory
}
- protected:
- int translate(int offset) const
- {
- precondition(offset >= stack_top_);
- // Stack grows down
- return offset - stack_top_;
- }
-
public:
int sbrk(int size)
{
precondition(size >= 0);
- int ptr = heap_.size();
+ int ptr = segments_[heap].size();
if (size)
// FIXME: check collision with stack
- heap_.resize(size + heap_.size());
+ segments_[heap].resize(size + segments_[heap].size());
return ptr;
}
public:
int heap_size() const
{
- return heap_.size ();
+ return segments_[heap].size();
}
int stack_size() const
{
- return stack_.size ();
+ return segments_[stack].size();
+ }
+ int get_stack_top() const
+ {
+ return stack_top_;
}
/** \name Store instructions.
@@ -93,28 +96,20 @@
public:
void store(const inst::DataSection& data_section)
{
- heap_.resize(data_section.size());
+ segments_[heap].resize(data_section.size());
for (int i = 0; i < data_section.size(); ++i)
- heap_.store_byte(i, data_section.load_byte(i));
+ segments_[heap].store_byte(i, data_section.load_byte(i));
}
/// Store a byte in memory.
- void store_byte(int offset, int b)
+ void store_byte(segment_kind k, int offset, int b)
{
- precondition(offset >= 0);
- if (offset < heap_.size())
- heap_.store_byte(offset, b);
- else
- stack_.store_byte(translate(offset), b);
+ segments_[k].store_byte(offset, b);
}
/// Store a word in memory.
- void store_word(int offset, int w)
+ void store_word(segment_kind k, int offset, int w)
{
- precondition(offset >= 0);
- if (offset < heap_.size())
- heap_.store_word(offset, w);
- else
- stack_.store_word(translate(offset), w);
+ segments_[k].store_word(offset, w);
}
/** \} */
@@ -122,26 +117,19 @@
\{ */
public:
/// Load a byte from memory.
- int load_byte(int offset) const
+ int load_byte(segment_kind k, int offset) const
{
- precondition(offset >= 0);
- if (offset < heap_.size())
- return heap_.load_byte(offset);
- return stack_.load_byte(translate(offset));
+ return segments_[k].load_byte(offset);
}
/// Load a word from memory.
- int load_word(int offset) const
+ int load_word(segment_kind k, int offset) const
{
- precondition(offset >= 0);
- if (offset < heap_.size())
- return heap_.load_word(offset);
- return stack_.load_word(translate(offset));
+ return segments_[k].load_word(offset);
}
/** \} */
protected:
- Segment heap_;
- Segment stack_;
+ Segment segments_[2];
const int stack_top_;
};
Index: src/vm/virtual_machine.hh
--- src/vm/virtual_machine.hh (revision 114)
+++ src/vm/virtual_machine.hh (working copy)
@@ -65,7 +65,7 @@
std::ostream& ostr = std::cout):
mode_(mode),
status_(stop),
- mmu_(memory_),
+ mmu_(cp0_, memory_),
cpu_(mmu_, cp0_, istr, ostr, check_callee_save_p, trace_exec_p)
{
}
Index: src/vm/mmu.hh
--- src/vm/mmu.hh (revision 114)
+++ src/vm/mmu.hh (working copy)
@@ -23,6 +23,7 @@
# include "inst/text_section.hh"
+# include "vm/cp0.hh"
# include "vm/memory.hh"
namespace vm
@@ -34,7 +35,8 @@
/** \name Constructor and destructor
\{ */
public:
- Mmu(Memory& memory):
+ Mmu(Cp0 &cp0, Memory &memory):
+ cp0_(cp0),
memory_(memory),
text_section_(0)
{}
@@ -48,6 +50,27 @@
/** \name Proxy for memory data access.
\{ */
+ protected:
+ bool translate(int &offset, Memory::segment_kind &k) const
+ {
+ if (0 <= offset)
+ {
+ if (offset < memory_.heap_size())
+ {
+ k = Memory::heap;
+ return true;
+ }
+ if (memory_.get_stack_top() <= offset)
+ {
+ k = Memory::stack;
+ // Stack grows down
+ offset = offset - memory_.get_stack_top();
+ return true;
+ }
+ }
+ return false;
+ }
+
public:
void data_store(const inst::DataSection& data_section)
{
@@ -57,23 +80,41 @@
/// Store a byte in memory.
void data_store_byte(int offset, int b)
{
- memory_.store_byte(offset, b);
+ Memory::segment_kind k;
+ if (translate(offset, k))
+ memory_.store_byte(k, offset, b);
+ else
+ cp0_.raise_addr_store();
}
/// Store a word in memory.
void data_store_word(int offset, int w)
{
- memory_.store_word(offset, w);
+ Memory::segment_kind k;
+ if (translate(offset, k))
+ memory_.store_word(k, offset, w);
+ else
+ cp0_.raise_addr_store();
}
/// Load a byte from memory.
int data_load_byte(int offset) const
{
- return memory_.load_byte(offset);
+ Memory::segment_kind k;
+ if (translate(offset, k))
+ return memory_.load_byte(k, offset);
+
+ cp0_.raise_addr_load();
+ return 0;
}
/// Load a word from memory.
int data_load_word(int offset) const
{
- return memory_.load_word(offset);
+ Memory::segment_kind k;
+ if (translate(offset, k))
+ return memory_.load_word(k, offset);
+
+ cp0_.raise_addr_load();
+ return 0;
}
int data_sbrk(int size)
@@ -92,6 +133,14 @@
const inst::Inst & inst_load(int offset) const
{
+ // Precondition
+ if (offset < 0 || text_section_->size() <= offset)
+ {
+ std::cerr << "inst_load" << std::endl;
+ cp0_.raise_addr_load();
+ return (*text_section_)[0]; // FIXME: NO!
+ }
+
return (*text_section_)[offset];
}
@@ -106,9 +155,11 @@
/** \} */
protected:
+ /// Control coprocessor link
+ Cp0 &cp0_;
+
/// Memory link.
Memory& memory_;
-
const inst::TextSection* text_section_;
};
Index: src/vm/virtual_machine.cc
--- src/vm/virtual_machine.cc (revision 113)
+++ src/vm/virtual_machine.cc (working copy)
@@ -55,7 +55,7 @@
// FIXME: precondition on loaded program
cpu_.set_pc(main_offset_);
- while (!cpu_.get_halt())
+ while (! (cpu_.get_halt() || cp0_.fatal_exception()))
{
cpu_.step();
cp0_.set_count(cp0_.get_count() + 1);
@@ -78,7 +78,7 @@
{
cpu_.step();
cp0_.set_count(cp0_.get_count() + 1);
- if (cpu_.get_halt())
+ if (cpu_.get_halt() || cp0_.fatal_exception())
{
status_ = halt;
std::cerr << "Program exited." << std::endl;
1
0
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* src/vm/mmu.hh: Hide instructions' access behind MMU.
* src/vm/cpu.hh, src/vm/cpu.cc, src/vm/virtual_machine.hh:
Use the MMU to access instructions.
2004-07-14 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: src/vm/cpu.hh
--- src/vm/cpu.hh (revision 109)
+++ src/vm/cpu.hh (working copy)
@@ -318,7 +318,7 @@
pipeline_[e_stage] = pipeline_[r_stage];
pipeline_[r_stage] = pipeline_[d_stage];
pipeline_[d_stage] = pipeline_[i_stage];
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
pipeline_[e_stage]->accept(*this);
pc_ = pc_ + 4;
Index: src/vm/virtual_machine.hh
--- src/vm/virtual_machine.hh (revision 113)
+++ src/vm/virtual_machine.hh (working copy)
@@ -99,13 +99,13 @@
/// Check if a label exists
bool has_label(const std::string& label) const
{
- return mmu_.inst().has_label(inst::Label(label));
+ return mmu_.inst_has_label(label);
}
/// Return the offset of a label
int get_offset(const std::string& label) const
{
- return mmu_.inst().get_offset(inst::Label(label));
+ return mmu_.inst_get_offset(label);
}
public:
Index: src/vm/cpu.cc
--- src/vm/cpu.cc (revision 113)
+++ src/vm/cpu.cc (working copy)
@@ -463,7 +463,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
void
Cpu::visit(const inst::Jr& jr)
@@ -477,7 +477,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
void
@@ -491,7 +491,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
// Assume it is a call
call();
@@ -507,7 +507,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
// Assume it is a call
call();
@@ -526,7 +526,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
@@ -540,7 +540,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
@@ -556,7 +556,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
@@ -575,7 +575,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
@@ -589,7 +589,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
@@ -605,7 +605,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
@@ -619,7 +619,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
void
@@ -638,7 +638,7 @@
// Bubble in decode stage
pipeline_[d_stage] = bubble_;
// Speculatively fetched instruction
- pipeline_[i_stage] = & mmu_.inst()[pc_ / 4];
+ pipeline_[i_stage] = & mmu_.inst_load(pc_ / 4);
}
}
Index: src/vm/mmu.hh
--- src/vm/mmu.hh (revision 113)
+++ src/vm/mmu.hh (working copy)
@@ -85,14 +85,24 @@
/** \name Proxy for memory instruction access.
\{ */
public:
- const inst::TextSection& inst() const
- {
- return *text_section_;
- }
void inst_store(const inst::TextSection& text_section)
{
text_section_ = &text_section;
}
+
+ const inst::Inst & inst_load(int offset) const
+ {
+ return (*text_section_)[offset];
+ }
+
+ int inst_has_label(const std::string &label) const
+ {
+ return text_section_->has_label(inst::Label(label));
+ }
+ int inst_get_offset(const std::string &label) const
+ {
+ return text_section_->get_offset(inst::Label(label));
+ }
/** \} */
protected:
1
0
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* src/vm/memory.hh, src/vm/mmu.hh, src/vm/cpu.cc,
* src/vm/virtual_machine.cc:
Implement reset() method.
* src/vm/virtual_machine.hh, src/vm/virtual_machine.hh:
Keep and reload the main offset of loaded program.
2004-07-14 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: src/vm/memory.hh
--- src/vm/memory.hh (revision 109)
+++ src/vm/memory.hh (working copy)
@@ -53,6 +53,12 @@
}
/** \} */
+ /// Reset the memory
+ void reset()
+ {
+ // DO NOT zero-ify the memory
+ }
+
protected:
int translate(int offset) const
{
Index: src/vm/virtual_machine.hh
--- src/vm/virtual_machine.hh (revision 112)
+++ src/vm/virtual_machine.hh (working copy)
@@ -86,6 +86,8 @@
public:
/// Load a program into memory.
void load_program(const inst::Program& program);
+ protected:
+ int main_offset_; // FIXME: Must disappear!
public:
/// Execute a program.
Index: src/vm/cpu.cc
--- src/vm/cpu.cc (revision 109)
+++ src/vm/cpu.cc (working copy)
@@ -69,6 +69,7 @@
// Initialize special registers to 0.
lo_ = 0;
hi_ = 0;
+ pc_ = 0;
// Initialize pipeline with nops
for (unsigned i = 0; i < 6; ++i)
Index: src/vm/mmu.hh
--- src/vm/mmu.hh (revision 109)
+++ src/vm/mmu.hh (working copy)
@@ -40,6 +40,12 @@
{}
/** \} */
+ /// Reset the mmu
+ void reset()
+ {
+ // Nothing to do?
+ }
+
/** \name Proxy for memory data access.
\{ */
public:
Index: src/vm/virtual_machine.cc
--- src/vm/virtual_machine.cc (revision 112)
+++ src/vm/virtual_machine.cc (working copy)
@@ -24,27 +24,37 @@
void
VirtualMachine::reset()
{
+ memory_.reset();
+ mmu_.reset();
+ cp0_.reset();
+ cpu_.reset();
}
void
VirtualMachine::load_program(const inst::Program &program)
{
+ reset();
+
if (! program.text_section ().has_label(inst::Label("main")))
{
std::cerr << "No `main' label in assembly file." << std::endl;
exit_set(exit_runtime);
return;
}
+ main_offset_ = program.text_section().get_offset(inst::Label("main"));
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
+ // FIXME: VirtualMachine::reset()?
+ cp0_.reset();
+ cpu_.reset();
+ // FIXME: precondition on loaded program
+ cpu_.set_pc(main_offset_);
while (!cpu_.get_halt())
{
cpu_.step();
@@ -55,9 +65,14 @@
void
VirtualMachine::execute(bool trace_p)
{
+ // FIXME: VirtualMachine::reset()?
+ cp0_.reset();
+ cpu_.reset();
+
if (status_ == stop)
return;
+ cpu_.set_pc(main_offset_);
cpu_.set_trace(trace_p);
while (status_ == run)
{
1
0
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