Projects
Threads by month
- ----- 2025 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- 1049 discussions
Index: ChangeLog
from Nicolas Pouillard <ertai(a)lrde.epita.fr>
* vcs: Remove the ruby_ex external link, use the gem package instead.
* vcs/Rakefile: Use the core_ex common rakefile.
* vcs/SPEC.yml: New. Package meta data.
* vcs/SPEC.dyn.yml: New. Package generated meta data.
* vcs/AUTHORS: New.
* vcs/NEWS: New.
* vcs/src: Rename to ...
* vcs/lib/vcs: ... this.
* vcs/lib/vcs/ask.rb: Remove, because ask is present in ruby_ex.
* vcs/lib/vcs/edit.rb: New.
* vcs/bin/vcs: Update requires, load_path, version, and some
environement variables definition.
AUTHORS | 6 +
NEWS | 3
Rakefile | 79 +--------------
SPEC.dyn.yml | 9 +
SPEC.yml | 35 +++++++
bin/vcs | 27 ++---
lib/vcs/diffstat.rb | 2
lib/vcs/edit.rb | 15 +++
lib/vcs/vcs.rb | 65 ++++++-------
src/ask.rb | 101 --------------------
src/changelog.rb | 115 -----------------------
src/conflict.rb | 21 ----
src/cvs.rb | 21 ----
src/diff.rb | 18 ---
src/diffstat.rb | 30 ------
src/last_changed_date.rb | 16 ---
src/mail.rb | 51 ----------
src/message.rb | 69 -------------
src/mycommit.rb | 86 -----------------
src/news.rb | 118 -----------------------
src/prcs.rb | 21 ----
src/revision.rb | 18 ---
src/status.rb | 17 ---
src/svn.rb | 29 -----
src/tools.rb | 22 ----
src/vcs.rb | 234 -----------------------------------------------
26 files changed, 119 insertions(+), 1109 deletions(-)
Index: vcs/lib/vcs/diffstat.rb
--- vcs/lib/vcs/diffstat.rb (revision 206)
+++ vcs/lib/vcs/diffstat.rb (working copy)
@@ -14,7 +14,7 @@
check_diffstat
data_diff = diff(*a)
cmd = @@diffstat < data_diff.output.open > [@out_path, @err_path]
- cmd.sys
+ cmd.run(@runner)
end
alias_command :ds, :diffstat
Index: vcs/bin/vcs
--- vcs/bin/vcs (revision 206)
+++ vcs/bin/vcs (working copy)
@@ -16,18 +16,11 @@
require 'optparse'
require 'set'
-begin
- REV="$Rev$".sub(/LastChangedRevision:\s+/, '').to_i
-rescue
- REV=-1
-end
-
+VCS_VERSION = '0.2.148'
VCS_PATH = Pathname.new(__FILE__).expand_path
VCS_DIR, VCS = VCS_PATH.split
-SRC = VCS_DIR + '..' + 'src'
-RUBY_EX = VCS_DIR + '..' + 'ruby_ex'
-$: << SRC.to_s
-$: << RUBY_EX.to_s
+LIB = VCS_DIR + '..' + 'lib'
+$: << LIB.to_s
dir = Pathname.pwd
while not dir.root? and not (vcs_dir = dir + 'vcs').exist?
@@ -46,14 +39,14 @@
"#{VCS}: #{progname}#{severity.downcase}: #{msg}\n"
end
-Pathname.glob("{#{SRC}/**,#{vcs_dir}}/*.rb") do |file|
+Pathname.glob("{#{LIB}/**,#{vcs_dir}}/*.rb") do |file|
LOG.debug { file.basename.to_s }
begin
- require file.basename.to_s
- rescue LoadError => ex
+ require "vcs/#{file.basename}"
+ rescue LoadError
begin
require file.to_s
- rescue
+ rescue LoadError => ex
raise ex
end
end
@@ -115,7 +108,7 @@
end
opts.on_tail('--version', 'Show version') do
- STDOUT.puts "Vcs revision: #{REV}"
+ STDOUT.puts "Vcs version: #{VCS_VERSION}"
exit
end
@@ -130,7 +123,9 @@
end
env = %w[ EMAIL FULLNAME EDITOR PAGER ]
if env.all? { |s| ENV[s] }
- env.each { |s| Kernel.const_set(s, ENV[s]) }
+ EDITOR = ENV['EDITOR'].to_cmd
+ PAGER = ENV['PAGER'].to_cmd
+ EMAIL = ENV['EMAIL']
else
env.each { |s| LOG.error "Need #{s} in the environement" unless ENV[s] }
exit
Index: vcs/src/vcs.rb
--- vcs/src/vcs.rb (revision 206)
+++ vcs/src/vcs.rb (working copy)
@@ -1,234 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'set'
-require 'commands'
-
-# The abstract class for a Vcs wrapper.
-# Conventions:
-# example:
-# svn checkout http://foo.bar/proj # alias
-# vcs-svn checkout http://foo.bar/proj # wrapper
-# vcs --vcs Svn checkout http://foo.bar/proj # manual
-#
-# checkout
-# checkout_
-# checkout!
-# checkout_!
-#
-class Vcs
-
- class Failure < Exception
- end
-
- def initialize ( aCmd )
- @cmd = aCmd.to_cmd
- @handlers = Set.new
- @runner = Commands::Runners::System.new
- @runner.subscribe_hook(:failure) do |data|
- if data.status
- LOG.error { "exit(#{data.status.exitstatus})" }
- else
- LOG.fatal { 'no exit status' }
- end
- end
- @runner.subscribe_hook(:display_command) do |cmd|
- LOG.debug { "running: #{cmd.to_sh}" }
- end
- @out, @err = STDOUT, STDERR
- end
-
- def self.add_basic_method ( meth )
- class_eval <<-end_eval
- def #{meth}! ( *args )
- run!("#{meth}", *args)
- end
- def #{meth}_! ( *args )
- run!("#{meth}", *args)
- end
- end_eval
- end
-
- @@all_commands = {}
- @@all_aliases = Set.new
-
- def self.alias_command ( m1, m2 )
- m2 = m2.to_s
- @@all_commands[m2] ||= Set.new
- @@all_commands[m2] << m1.to_s
- @@all_aliases << m1
- class_eval <<-end_eval
- def #{m1} ( *args )
- #{m2}(*args)
- end
- def #{m1}_ ( *args )
- #{m2}_(*args)
- end
- def #{m1}! ( *args )
- #{m2}!(*args)
- end
- def #{m1}_! ( *args )
- #{m2}_!(*args)
- end
- end_eval
- end
-
- attr_accessor :out, :err, :out_path, :err_path
-
- @@checkers = Set.new
-
- def run! ( *args )
- cmd = @cmd + args
- if @out_path.nil?
- cmd = cmd > [@out, @err]
- else
- cmd = cmd > [@out_path, @err_path]
- end
- cmd.run(@runner)
- end
-
- def sub_vcs
- copy = dup
- copy.out_path = TempPath.new
- copy.err_path = TempPath.new
- copy.out = copy.out_path.open('w')
- copy.err = copy.err_path.open('w')
- copy
- end
-
- def run ( *args )
- sub_vcs.run!(*args)
- end
-
- %w[ checkout delete diff status log add update commit ].each do |m|
- add_basic_method(m)
- end
-
- def method_missing ( meth, *args )
- meth = meth.to_s
- if meth =~ /^(.*)!$/
- no_bang = $1
- if respond_to? no_bang
- LOG.warn { "Unefficient method call (#{no_bang}), " +
- "prefer define methods with a `!'" }
- send(no_bang, *args).each do |line|
- puts line
- end
- else
- LOG.warn { "unknown method #{meth}" }
- run!(no_bang.sub(/_$/, ''), *args)
- end
- else
- with_bang = meth + '!'
- if respond_to? with_bang
- copy = sub_vcs
- res = copy.send(with_bang, *args)
- if res.nil?
- copy.out.close
- copy.out_path
- else
- res
- end
- else
- LOG.warn { "unknown method #{meth}" }
- run!(meth.sub(/_$/, ''), *args)
- end
- end
- end
-
- def help! ( *args )
- return help_!(*args) unless args.empty?
- @out.puts "
- |usage: #{(a)cmd.command} <subcommand> [options] [args]
- |Type '#{(a)cmd.command} help <subcommand>' for help on a specific subcommand.
- |
- |Most subcommands take file and/or directory arguments, recursing
- |on the directories. If no arguments are supplied to such a
- |command, it recurses on the current directory (inclusive) by default.
- |
- |Available subcommands:".head_cut!
- cmds = []
- methods.each do |meth|
- next if meth =~ /_!?$/
- next unless meth =~ /^(.+)!$/
- cmd = $1
- next if cmd == 'run'
- next if @@all_aliases.include? cmd.to_sym
- cmds << cmd
- end
- cmds.sort!
- cmds.each do |cmd|
- if @@all_commands.has_key? cmd
- aliases = @@all_commands[cmd].sort.join(', ')
- @out.puts " - #{cmd} (alias #{aliases})"
- else
- @out.puts " - #{cmd}"
- end
- end
- end
-
- alias_command :ann, :blame
- alias_command :annotate, :blame
- alias_command :praise, :blame
- alias_command :co, :checkout
- alias_command :ci, :commit
- alias_command :cp, :copy
- alias_command :del, :delete
- alias_command :remove, :delete
- alias_command :rm, :delete
- alias_command :di, :diff
- alias_command :h, :help
- alias_command :ls, :list
- alias_command :mv, :move
- alias_command :rename, :move
- alias_command :ren, :move
- alias_command :pdel, :propdel
- alias_command :pd, :propdel
- alias_command :pedit, :propedit
- alias_command :pe, :propedit
- alias_command :pget, :propget
- alias_command :pg, :propget
- alias_command :plist, :proplist
- alias_command :pl, :proplist
- alias_command :pset, :propset
- alias_command :ps, :propset
- alias_command :st, :status
- alias_command :stat, :status
- alias_command :sw, :switch
- alias_command :up, :update
-
- # Cvs Alias
- alias_command :new, :add
- alias_command :rcs, :admin
- alias_command :get, :checkout
- alias_command :rlog, :log
- alias_command :patch, :rdiff
- alias_command :rfreeze, :rtag
- alias_command :freeze, :tag
-
- # Prcs Alias
- alias_command :checkin, :commit
- alias_command :populate, :add
-
- def error_handling ( meth )
- @handlers << meth
- end
-
- def call_handlers
- @handlers.each { |meth| send(meth) }
- end
-
- def self.add_conf_checker ( meth )
- @@checkers << meth
- end
-
- def call_conf_checkers
- @@checkers.each { |meth| send(meth) }
- end
-
-end # class Vcs
-
Index: vcs/src/message.rb
--- vcs/src/message.rb (revision 206)
+++ vcs/src/message.rb (working copy)
@@ -1,69 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-require 'vcs/changelog'
-
-class Vcs
- def diffw! ( *args )
- diff!(*args)
- end
-end
-
-class Svn
- def diffw! ( *args )
- diff! '--diff-cmd', 'diff', '-x', '-NPbuw', *args
- end
-end
-
-class Vcs
-
- @@message = Pathname.new(',message')
-
- def print_body ( file, options )
- LOG.warn "Creating a new `#{file}' file"
- file.open('w') do |f|
- f.puts options.to_yaml
- f.puts '---'
- f.puts
- f.print message.read
- end
- end
- private :print_body
-
- def message ( *args )
- error_handling :message_failed
-
- unless @@message.exist?
- cl = mkchangelog(*args)
- TempPath.new('message') do |tmp|
- tmp.open('w') do |f|
- f.puts 'Index: ChangeLog'
- f.print cl.read.sub(/^\d+-\d+-\d+/, 'from')
- f.puts
- f.print diffstat(*args).read
- f.puts
- diffw_from_status(*args).each_line do |line|
- f.print line if line !~ /^=+$/
- end
- end
- tmp.mv(@@message)
- end
- end
- @@message.open('r')
- end
-
- alias_command :msg, :message
-
- def message_failed
- if @@message.exist?
- LOG.info "#{@@message}: Contains the generated message"
- LOG.info ' (the ChangeLog entry, the diffstat, the diff)'
- end
- end
-
-end # class Vcs
Index: vcs/AUTHORS
--- vcs/AUTHORS (revision 0)
+++ vcs/AUTHORS (revision 0)
@@ -0,0 +1,6 @@
+---
+Vcs was written by and with the assistance of:
+
+ - Nicolas Pouillard <ertai(a)lrde.epita.fr>:
+ - Initial Design
+ - Maintenance
Index: vcs/src/tools.rb
--- vcs/src/tools.rb (revision 206)
+++ vcs/src/tools.rb (working copy)
@@ -1,22 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'yaml'
-module YAML
-
- def self.chop_header ( io )
- aStr = io.gets
- raise Exception, "First line is not valid: `#{aLine}'" unless aStr =~ /^---/
- io.each do |aLine|
- break if aLine =~ /^---/
- aStr += aLine
- end
- YAML::load(aStr)
- end
-
-end # module YAML
-
Index: vcs/src/ask.rb
--- vcs/src/ask.rb (revision 206)
+++ vcs/src/ask.rb (working copy)
@@ -1,101 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-ANSWERS = [ :y, :n ]
-ANSWER_NOT_VALID = 'Not a valid answer, please answer correctly'
-
-# `ask', ask the user to answer, to your question.
-#
-# Example:
-# ask('Commiting, are you sure', :n)
-#
-# produce => Commiting, are you sure (y/N):
-# and wait your answer.
-def ask ( aQuestion, theDefaultAnswer=:y, cin=STDIN, cout=STDOUT, cerr=STDERR )
-
- yn = case theDefaultAnswer
- when :y then ' [Y/n]: '
- when :n then ' [y/N]: '
- else raise ArgumentError, "not valid default answer #{theDefaultAnswer}"
- end
-
- loop do
- cout.print aQuestion, yn
- cout.flush
-
- answer = cin.readline.chomp.downcase
-
- return theDefaultAnswer if answer.empty?
-
- answer = answer.to_sym
-
- return answer if ANSWERS.include? answer
-
- cerr.puts ANSWER_NOT_VALID
- cout.puts
- end
-
-end
-
-if defined? TEST_MODE or $0 == __FILE__
-
-require 'test/unit'
-class AskTest < Test::Unit::TestCase
-
- def ask_checker ( question, default, answer, ref, out, err )
- require 'stringio'
- cin, cout, cerr = StringIO.new, StringIO.new, StringIO.new
- cin.puts answer
- cin.rewind
- res = ask(question, default, cin, cout, cerr)
- cout.rewind
- cerr.rewind
- assert_equal(res, ref, 'bad return value')
- assert_equal(cout.readlines.join, out, 'bad standard output')
- assert_equal(cerr.readlines.join, err, 'bad error output')
- end
-
- def test_bad_default
- assert_raise(ArgumentError) { ask_checker('Q', :foo, '', :y, [], []) }
- assert_nothing_raised do
- ask_checker('Q', :y, 'y', :y, 'Q [Y/n]: ', '')
- end
- assert_nothing_raised do
- ask_checker('Q', :n, 'y', :y, 'Q [y/N]: ', '')
- end
- end
-
- def test_valid_default_yes
- ask_checker('Q', :y, 'y', :y, 'Q [Y/n]: ', '')
- ask_checker('Q', :y, 'Y', :y, 'Q [Y/n]: ', '')
- ask_checker('Q', :y, 'n', :n, 'Q [Y/n]: ', '')
- ask_checker('Q', :y, 'N', :n, 'Q [Y/n]: ', '')
- ask_checker('Q', :y, '', :y, 'Q [Y/n]: ', '')
- end
-
- def test_valid_default_no
- ask_checker('Q', :n, 'y', :y, 'Q [y/N]: ', '')
- ask_checker('Q', :n, 'Y', :y, 'Q [y/N]: ', '')
- ask_checker('Q', :n, 'n', :n, 'Q [y/N]: ', '')
- ask_checker('Q', :n, 'N', :n, 'Q [y/N]: ', '')
- ask_checker('Q', :n, '', :n, 'Q [y/N]: ', '')
- end
-
- def test_invalid_answer
- ask_checker('Q', :n, "bad\ny", :y,
- "Q [y/N]: \nQ [y/N]: ", ANSWER_NOT_VALID + "\n")
- ask_checker('Q', :y, "ad\n\n", :y,
- "Q [Y/n]: \nQ [Y/n]: ", ANSWER_NOT_VALID + "\n")
- end
-
- def test_ask1
- ask_checker('Q', :y, 'y', :y, 'Q [Y/n]: ', '')
- end
-
-end # class AskTest
-
-end
Index: vcs/SPEC.dyn.yml
--- vcs/SPEC.dyn.yml (revision 0)
+++ vcs/SPEC.dyn.yml (revision 0)
@@ -0,0 +1,9 @@
+--- !ruby/object:OpenStruct
+table:
+ :url: https://svn.lrde.epita.fr/svn/lrdetools/trunk/vcs
+ :date: "Fri, 01 Jul 2005"
+ :version: !ruby/object:Version
+ build: 148
+ major: 0
+ minor: 2
+ revision: 206
Index: vcs/src/prcs.rb
--- vcs/src/prcs.rb (revision 206)
+++ vcs/src/prcs.rb (working copy)
@@ -1,21 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-
-class Prcs < Vcs
-
- def initialize ( aCmd='prcs' )
- super
- end
-
- %w[ admin ].each do |m|
- add_basic_method(m)
- end
-
-end # class Prcs
-
Index: vcs/src/conflict.rb
--- vcs/src/conflict.rb (revision 206)
+++ vcs/src/conflict.rb (working copy)
@@ -1,21 +0,0 @@
-class Vcs
-
- def mk_conflicts_list
- ls = status.output.readlines.grep(/^C/).map! { |s| s[/^C\s+(.*)/, 1] }
- raise "no conflicts" if ls.empty?
- ls
- end
-
- def edit_conflicts!
- edit! mk_conflicts_list
- end
-
- def resolve_conflicts!
- conflicts = mk_conflicts_list
- question = "Resolve these conflicts: \n - #{conflicts.join("\n - ")}\n"
- if ask(question, :n, STDIN, @out, @err) == :y
- return resolved(conflicts)
- end
- end
-
-end # class Vcs
Index: vcs/SPEC.yml
--- vcs/SPEC.yml (revision 0)
+++ vcs/SPEC.yml (revision 0)
@@ -0,0 +1,35 @@
+---
+Author: Nicolas Pouillard
+License: GNU General Public License (GPL)
+Revision: '$Id$'
+
+name: vcs
+
+title: Vcs -- A wrapper over any version control system
+summary: A wrapper over any version control system
+description: |
+ Version control systems (Subversion, CVS, PRCS...), however useful, are not
+ very extensible: adding new features can be cumbersome, especially if you
+ want them for different such systems at once. Vcs provide a simple dynamic
+ hierarchy for Version Control Systems.
+homepage: http://rubyforge.org/projects/vcs
+
+rdoc_dir: doc/html
+tags_url: https://svn.lrde.epita.fr/svn/lrdetools/tags
+
+commit_command: ltci
+
+rdoc_files: !filelist
+ - README
+ - AUTHORS
+ - lib/vcs/**/*.rb
+
+pkg_files: !filelist
+ - lib/vcs/**/*.rb
+ - bin/**/*
+ - '[A-Z]*'
+
+executables: [ vcs, vcs-svn, vcs-cvs, vcs-prcs ]
+
+dependencies:
+ ruby_ex: ~> 0.1.3
Index: vcs/src/news.rb
--- vcs/src/news.rb (revision 206)
+++ vcs/src/news.rb (working copy)
@@ -1,118 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/tools'
-require 'vcs/message'
-
-class Vcs
-
- NEWS = Pathname.new(',news')
-
- def parse_news_options ( *args )
- require 'optparse'
- result =
- {
- :from => FULL_EMAIL,
- :groups => [],
- :server => ENV['NNTPSERVER'],
- }
- if !args.nil? and !args.empty? and args[0].is_a?(Hash)
- return result.merge!(args[0])
- end
- OptionParser.new do |opts|
- opts.separator ''
- opts.on('-g', '--group NAME', 'Choose a news group') do |aString|
- result[:groups] << aString
- end
- opts.on('-s', '--server NAME', 'Choose a news server') do |aString|
- result[:server] = aString
- end
- opts.on('-S', '--subject NAME', 'Choose your news subject') do |aString|
- result[:subject] = aString.sub(/\.?$/, '.')
- end
- opts.on_tail('-h', '--help', 'Show this message') do
- puts opts
- exit
- end
- end.parse!(args)
- raise Failure, 'No news group' if result[:groups].empty?
- raise Failure, 'No news server' if result[:server].nil?
- raise Failure, 'No news subject' if result[:subject].nil?
- result
- end
- protected :parse_news_options
-
- def check_line ( anIO, aRegex )
- line = anIO.readline.chomp!
- LOG.debug('news') { "Server: #{line}" }
- unless line =~ aRegex
- LOG.error('news') { "Bad answer: #{line}" }
- @news_status = 'Error.'
- end
- end
- private :check_line
-
- #
- # Post the news.
- #
- def news! ( *args )
- error_handling :news_failed
-
- print_body(NEWS, parse_news_options(*args)) unless NEWS.exist?
-
- @news_status = 'Sent.'
- NEWS.open('r') do |file|
- opt = YAML::chop_header(file)
- server, port = opt[:server].split(/:/)
- port ||= 119
- LOG.info('news') { "Nntp Server: #{server}:#{port}" }
- if ask("Post a news, with this subject: #{opt[:subject]}\n" +
- " to #{opt[:groups].join(', ')}\n from #{opt[:from]}\n" +
- 'Are you sure?', :y) == :n
- LOG.error('news') { 'Aborting' }
- exit
- end
- require 'socket'
- TCPSocket.open(server, port) do |f|
- check_line(f, /^200/)
- f.puts 'post'
- check_line(f, /^340/)
- f.puts "Newsgroups: #{opt[:groups].join(', ')}"
- f.puts "From: #{opt[:from]}"
- f.puts "Subject: #{opt[:subject]}"
- f.puts
- file.each do |line|
- f.print line.gsub(/^\./, ' .')
- end
- f.puts '.'
- check_line(f, /^240/)
- f.puts 'quit'
- check_line(f, /^205/)
- end
- end
- NEWS.delete
- @out.puts @news_status
- end
-
- def news_failed
- if defined? NEWS and NEWS.exist?
- LOG.info "#{NEWS}: Contains the generated news" +
- "(generated from #{@@message})"
- end
- end
-
- def news_conf_checker
- %w[ NNTPSERVER ].each do |var|
- if ENV[var].nil? or ENV[var].empty?
- LOG.error "environment variable `#{var}' not set"
- end
- end
- end
-
- add_conf_checker :news_conf_checker
-
-end # class Vcs
Index: vcs/Rakefile
--- vcs/Rakefile (revision 206)
+++ vcs/Rakefile (working copy)
@@ -1,73 +1,8 @@
-require 'rubygems'
-require 'rake'
-require 'rake/testtask'
-require 'rake/packagetask'
-require 'rake/rdoctask'
-require 'rake/gempackagetask'
-require 'rake/contrib/rubyforgepublisher'
-
-PKG_VERSION = "0.2.#{`vcs-svn rev`.chomp}"
-
-PKG_FILES = FileList[*%w"
- src/**/*.rb
- ruby_ex/**/*.rb
- bin/**/*
- doc/**/*
- [A-Z]*
-"].exclude(/\b\.svn\b|\..*\.sw[op]$|~$|README/)
-
-desc 'Default Task'
-task :default => :package
-
-desc 'Publish to RubyForge'
-task :rubyforge do
- Rake::RubyForgePublisher.new('vcs', 'ertai').upload
-end
-
-
-Rake::RDocTask.new('doc') do |rdoc|
- rdoc.title = 'Vcs -- A wrapper over any version control system'
- rdoc.template = 'kilmer'
- #rdoc.template = 'doc/jamis'
- rdoc.options << '--line-numbers' << '--inline-source'
- #rdoc.rdoc_files.add('src/vcs.rb', 'src/**/*.rb')
- rdoc.rdoc_files.add('src/**/*.rb')
- #rdoc.main =
-end
-
-
-# The Gem specification
-spec = Gem::Specification.new do |s|
- s.platform = Gem::Platform::RUBY
- s.name = 'vcs'
- s.version = PKG_VERSION
- s.summary = 'A wrapper over any version control system'
- s.description = '
- Version control systems (Subversion, CVS, PRCS...), however useful,
- are not very extensible: adding new features can be cumbersome, especially
- if you want them for different such systems at once.
- Vcs provide a simple dynamic hierarchy for Version Control Systems.
- '
-
- s.bindir = 'bin'
- s.executables = %w[ vcs vcs-svn vcs-cvs vcs-prcs ]
- s.default_executable = 'vcs'
- s.files = PKG_FILES.to_a
- s.require_path = 'src'
- s.autorequire = 'vcs'
-
- s.has_rdoc = true
- s.author = 'Nicolas Pouillard'
- s.email = 'ertai(a)lrde.epita.fr'
- s.homepage = 'https://svn.lrde.epita.fr/svn/lrdetools/trunk/vcs/'
- s.rubyforge_project = s.name
-end
-
-# Create compressed packages
-Rake::GemPackageTask.new(spec) do |p|
- p.gem_spec = spec
- # p.need_tar = true
- # p.need_zip = true
-end
-
+# Author:: The TTK Team. -*- ruby -*-
+# Copyright:: Copyright (c) 2005 TTK team. All rights reserved.
+# License:: Ruby License
+# Revision:: $Id$
+require 'rubygems'
+require_gem 'core_ex'
+load 'core_ex/rakefile_base.rf'
Index: vcs/src/diffstat.rb
--- vcs/src/diffstat.rb (revision 206)
+++ vcs/src/diffstat.rb (working copy)
@@ -1,30 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# Revision:: $Id$
-
-require 'vcs/vcs'
-
-class Vcs
- @@diffstat = 'diffstat'.to_cmd
-
- # Use the diffstat command to
- # display statitics on your patch.
- def diffstat! ( *a )
- check_diffstat
- data_diff = diff(*a)
- cmd = @@diffstat < data_diff.output.open > [@out_path, @err_path]
- cmd.sys
- end
- alias_command :ds, :diffstat
-
- def check_diffstat
- unless `diffstat -V` =~ /diffstat version/
- raise ArgumentError, 'The `diffstat\' tool is needed by Vcs.diffstat'
- end
- end
-
- add_conf_checker :check_diffstat
-
-end # class Vcs
-
Index: vcs/lib/vcs/edit.rb
--- vcs/lib/vcs/edit.rb (revision 0)
+++ vcs/lib/vcs/edit.rb (revision 0)
@@ -0,0 +1,15 @@
+# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
+# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
+# License:: GNU General Public License (GPL).
+# Revision:: $Id$
+
+require 'vcs/vcs'
+
+class Vcs
+
+ def edit! ( *files )
+ cmd = EDITOR + files.flatten.map { |x| x.to_s } > [STDOUT, STDERR]
+ cmd.run(@runner)
+ end
+
+end # class Vcs
Property changes on: vcs/lib/vcs/edit.rb
___________________________________________________________________
Name: svn:keywords
+ Id
Index: vcs/src/svn.rb
--- vcs/src/svn.rb (revision 206)
+++ vcs/src/svn.rb (working copy)
@@ -1,29 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-require 'vcs/tools'
-
-CL = Pathname.new('ChangeLog')
-ADD_CL = Pathname.new(',ChangeLog')
-TMP_CL = Pathname.new(',,ChangeLog')
-
-class Svn < Vcs
-
- class Failure < Vcs::Failure
- end
-
- def initialize ( aCmd='svn' )
- super
- end
-
- %w[ blame cat cleanup copy export import list log merge mkdir move propedit
- switch resolved revert info propdel propget proplist propset ].each do |m|
- add_basic_method(m)
- end
-
-end # class Svn
Index: vcs/NEWS
--- vcs/NEWS (revision 0)
+++ vcs/NEWS (revision 0)
@@ -0,0 +1,3 @@
+New in 0.3 ...:
+ * help
+ * full stream based
Index: vcs/src/revision.rb
--- vcs/src/revision.rb (revision 206)
+++ vcs/src/revision.rb (working copy)
@@ -1,18 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/svn'
-
-class Svn
-
- def revision! ( *args )
- @out.puts info.read[/^Revision:\s+(\d+)/, 1]
- end
-
- alias_command :rev, :revision
-
-end # class Svn
Index: vcs/src/changelog.rb
--- vcs/src/changelog.rb (revision 206)
+++ vcs/src/changelog.rb (working copy)
@@ -1,115 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# Revision:: $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-require 'vcs/svn'
-
-class Svn
-
- @@file_st =
- {
- 'A' => 'New',
- 'D' => 'Remove',
- }
- @@file_st.default = ''
-
- @@prop_st =
- {
- 'M' => 'Changed property'
- }
-
- def mkchangelog_from_status ( *args )
- result = []
- from_status(*args) do |line, file_st, prop_st, copy_st, file|
- next if file_st =~ /[?X]/
- next if file == 'ChangeLog'
- ls = []
- ls << @@file_st[file_st] if @@file_st.has_key? file_st
- ls << @@prop_st[prop_st].downcase if @@prop_st.has_key? prop_st
- result << [file, ls.join(', ')]
- end
- raise Failure, 'No changes, so no ChangeLog entry.' if result.empty?
- result
- end
- private :mkchangelog_from_status
-
-end # class Svn
-
-
-class Vcs
-
- class MustBeFilled < Exception
- attr_reader :file
- def initialize ( file )
- @file = file
- super("You must fill this file: `#{file.to_s}'")
- end
- end
-
- def mkchangelog! ( *args )
- error_handling :changelog_failed
-
- cl = ADD_CL
-
- if cl.exist?
- f = cl.open('r')
- if f.readline !~ /^===/
- f.rewind
- return f
- end
- f.close
- else
- cl_add = mkchangelog_from_status(*args)
- LOG.warn "Creating a new `#{cl}' file"
- cl.open('w') do |f|
- f.puts '=== Fill this file correctly and remove this line ==='
- f.puts Time.now.strftime("%Y-%m-%d #{FULL_EMAIL}")
- f.puts
- cl_add.each do |file, str|
- f.puts "\t* #{file}: #{str}."
- end
- end
- end
-
- raise MustBeFilled, cl
- end
-
- def concat_changelog! ( *args )
- error_handling :changelog_failed
-
- unless CL.exist?
- raise Failure, "No `#{CL}', you are probably not in a valid directory."
- end
-
- if cl = mkchangelog(*args)
-
- unless TMP_CL.exist?
- LOG.info "Moving `#{CL}' to `#{TMP_CL}' ..."
- CL.rename(TMP_CL)
- end
-
- CL.open('w') do |file|
- LOG.info "Prepending `#{ADD_CL}' to `#{CL}' ..."
- file.print cl.read
- file.puts
- file.print TMP_CL.read
- end
-
- end
- end
-
- def changelog_failed
- if TMP_CL.exist?
- LOG.info "Restoring `#{CL}' from `#{TMP_CL}' ..."
- TMP_CL.rename(CL)
- end
- LOG.info "#{ADD_CL}: Contains your ChangeLog entry" if ADD_CL.exist?
- end
-
- alias_command :mkcl, :mkchangelog
- alias_command :ctcl, :concat_changelog
-
-end # class Vcs
-
Index: vcs/src/status.rb
--- vcs/src/status.rb (revision 206)
+++ vcs/src/status.rb (working copy)
@@ -1,17 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# Revision:: $Id$
-
-class Svn
-
- def from_status ( *args, &block )
- status(*args).output.each_line do |line|
- next unless line =~ /^.{5} /
- m = /^(.)(.).(.).\s*(.*)$/.match(line)
- block[*m.to_a]
- end
- end
- protected :from_status
-
-end # class Svn
Index: vcs/src/last_changed_date.rb
--- vcs/src/last_changed_date.rb (revision 206)
+++ vcs/src/last_changed_date.rb (working copy)
@@ -1,16 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# $Id$
-
-require 'vcs/svn'
-
-class Svn
-
- def last_changed_date! ( *args )
- @out.puts info.read[/^Last Changed Date:.*?\(([^)]*)\).*$/, 1]
- end
-
- alias_command :date, :last_changed_date
-
-end # class Svn
Index: vcs/src/diff.rb
--- vcs/src/diff.rb (revision 206)
+++ vcs/src/diff.rb (working copy)
@@ -1,18 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# Revision:: $Id$
-
-class Svn
-
- def diffw_from_status! ( *args )
- files = Set.new
- from_status(*args) do |line, file_st, prop_st, cpy, file|
- next if file_st =~ /[?X]/
- next if file == 'ChangeLog'
- files << Pathname.new(file)
- end
- diffw!(*files.delete_if { |f| f.directory? })
- end
-
-end # class Svn
Index: vcs/src/mycommit.rb
--- vcs/src/mycommit.rb (revision 206)
+++ vcs/src/mycommit.rb (working copy)
@@ -1,86 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-require 'ask'
-
-class Vcs
-
- COMMITED = Pathname.new(',commited')
-
- def common_commit! ( *args, &block )
-
- opts, args = args.partition { |a| a =~ /^-/ }
-
- update!
-
- unless COMMITED.exist?
-
- begin
- mkchangelog(*args)
- rescue MustBeFilled => ex
- edit! ex.file
- end
-
- message(*args)
-
- edit! @@message
-
- if ask('Committing, are you sure?', :y) == :n
- commit_failed
- end
-
- concat_changelog!(*args)
-
- #pager! diff
- #pager! status
-
- args << 'ChangeLog' unless args.grep(/^[^-]/).empty?
-
- if commit!('-F', ADD_CL, *(opts + args))
- ADD_CL.rename(COMMITED)
- TMP_CL.delete if TMP_CL.exist?
- else
- commit_failed
- end
-
- update!
-
- else
-
- message(*args)
- edit! @@message
-
- end
-
-
- rev = revision.read.to_i
-
- block.call(rev) if block_given?
-
- LOG.info 'Deleting junk files...'
- TMP_CL.delete if TMP_CL.exist?
- ADD_CL.delete if ADD_CL.exist?
- COMMITED.delete if COMMITED.exist?
- messages = Pathname.new(',messages')
- messages.mkpath unless messages.directory?
- message_rev = messages + "#{@@message}.#{rev}"
- LOG.info "Moving `#{@@message}' to `#{message_rev}'..."
- @@message.rename(message_rev)
- LOG.info "You can remove `#{message_rev}' if everything is ok."
-
- end
- alias_command :cci, :common_commit
-
- def commit_failed
- LOG.info "#{COMMITED}: Contains your ChangeLog entry" if COMMITED.exist?
- LOG.error 'Aborting'
- LOG.info 'You can rerun the same command to continue the commit'
- raise 'Commit failed'
- end
-
-end # class Vcs
Index: vcs/src/cvs.rb
--- vcs/src/cvs.rb (revision 206)
+++ vcs/src/cvs.rb (working copy)
@@ -1,21 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-
-class Cvs < Vcs
-
- def initialize ( aCmd='cvs' )
- super
- end
-
- %w[ rdiff rtag tag ].each do |m|
- add_basic_method(m)
- end
-
-end # class Cvs
-
Index: vcs/lib/vcs/vcs.rb
--- vcs/lib/vcs/vcs.rb (revision 206)
+++ vcs/lib/vcs/vcs.rb (working copy)
@@ -29,16 +29,16 @@
@cmd = aCmd.to_cmd
@handlers = Set.new
@runner = Commands::Runners::System.new
+ @strict_runner = Commands::Runners::System.new.raise_on_failures
+
+ display_hook = lambda { |cmd| LOG.debug { "running: #{cmd.to_sh}" } }
+
@runner.subscribe_hook(:failure) do |data|
- if data.status
- LOG.error { "exit(#{data.status.exitstatus})" }
- else
- LOG.fatal { 'no exit status' }
- end
- end
- @runner.subscribe_hook(:display_command) do |cmd|
- LOG.debug { "running: #{cmd.to_sh}" }
+ exit((data.status)? data.status.exitstatus : 1)
end
+ @runner.subscribe_hook(:display_command, &display_hook)
+ @strict_runner.subscribe_hook(:display_command, &display_hook)
+
@out, @err = STDOUT, STDERR
end
@@ -85,10 +85,15 @@
cmd = @cmd + args
if @out_path.nil?
cmd = cmd > [@out, @err]
+ if @out == STDOUT
+ cmd.run(@runner)
+ else
+ cmd.run(@strict_runner)
+ end
else
cmd = cmd > [@out_path, @err_path]
+ cmd.run(@strict_runner)
end
- cmd.run(@runner)
end
def sub_vcs
@@ -104,7 +109,16 @@
sub_vcs.run!(*args)
end
- %w[ checkout delete diff status log add update commit ].each do |m|
+ def run_missing! ( name, orig, *args )
+ if name =~ /^(.*)_$/
+ run!($1, *args)
+ else
+ LOG.warn { "unknown method #{orig}" }
+ run!(name, *args)
+ end
+ end
+
+ %w[ checkout help delete diff status log add update commit ].each do |m|
add_basic_method(m)
end
@@ -112,31 +126,16 @@
meth = meth.to_s
if meth =~ /^(.*)!$/
no_bang = $1
- if respond_to? no_bang
- LOG.warn { "Unefficient method call (#{no_bang}), " +
- "prefer define methods with a `!'" }
- send(no_bang, *args).each do |line|
- puts line
- end
- else
- LOG.warn { "unknown method #{meth}" }
- run!(no_bang.sub(/_$/, ''), *args)
- end
+ super unless respond_to? no_bang
+ run_missing!(no_bang, meth, *args)
else
with_bang = meth + '!'
- if respond_to? with_bang
+ return run_missing!(meth, meth, *args) unless respond_to? with_bang
copy = sub_vcs
res = copy.send(with_bang, *args)
- if res.nil?
+ return res unless res.nil?
copy.out.close
copy.out_path
- else
- res
- end
- else
- LOG.warn { "unknown method #{meth}" }
- run!(meth.sub(/_$/, ''), *args)
- end
end
end
Index: vcs/src/mail.rb
--- vcs/src/mail.rb (revision 206)
+++ vcs/src/mail.rb (working copy)
@@ -1,51 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# Revision:: $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-require 'sendmail'
-
-class Vcs
-
- MAIL = Sendmail::MAIL_FILE
- MAILER = Sendmail.new
- DEFAULT_OPTIONS = %w[ --ask --sign --mime ]
-
- #
- # Mail.
- #
- def mail! ( *args )
- error_handling :mail_failed
- unless MAIL.exist?
- print_body(MAIL, MAILER.parse_mail_options(*(DEFAULT_OPTIONS + args)))
- end
- MAILER.sendmail
- MAIL.delete
- @out.puts 'Mail: Sent.'
- end
-
- def mail_failed
- if defined? MAIL and MAIL.exist?
- LOG.info "#{MAIL}: Contains the generated mail " +
- "(generated from #{@@message})"
- end
- end
-
- def mail_conf_checker
- %w[ EMAIL FULLNAME SMTPSERVER ].each do |var|
- if ENV[var].nil? or ENV[var].empty?
- LOG.error "environment variable `#{var}' not set"
- end
- end
- unless `gpg --version` =~ /^gpg \(GnuPG\)/
- LOG.error 'command not found: gpg'
- end
- unless File.exist?("#{ENV['HOME']}/.gnupg/secring.gpg")
- LOG.error 'no private key: in your ~/.gnupg'
- end
- end
-
- add_conf_checker :mail_conf_checker
-
-end # class Vcs
1
0
https://svn.lrde.epita.fr/svn/nolimips
ChangeLog | 7 +++++++
dev/inst-solver-gen.py | 13 ++++++++++++-
src/inst-tasks.cc | 1 +
src/inst-tasks.hh | 4 ++++
4 files changed, 24 insertions(+), 1 deletion(-)
Index: trunk/ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
Limit access to argument registers.
* dev/inst-solver-gen.py: Check use of argument registers.
* src/inst-tasks.hh, src/inst-tasks.cc: Add corresponding task.
Index: trunk/src/inst-tasks.cc
--- trunk/src/inst-tasks.cc (revision 181)
+++ trunk/src/inst-tasks.cc (revision 182)
@@ -42,6 +42,7 @@
inst::ProgramSolver program_solver;
program_solver.set_max_callee_save(max_callee_save);
program_solver.set_max_caller_save(max_caller_save);
+ program_solver.set_max_args(max_args);
program_solver.solve(* parse::tasks::program);
if (exit_status != exit_success)
exit (exit_status);
Index: trunk/src/inst-tasks.hh
--- trunk/src/inst-tasks.hh (revision 181)
+++ trunk/src/inst-tasks.hh (revision 182)
@@ -45,6 +45,10 @@
"Set max number of caller-save registers",
max_caller_save, 10, 0, 10,
"");
+ INT_TASK_DECLARE ("args",
+ "Set max number of argument registers",
+ max_args, 4, 0, 4,
+ "");
} // namespace tasks
} // namespace inst
Index: trunk/dev/inst-solver-gen.py
--- trunk/dev/inst-solver-gen.py (revision 181)
+++ trunk/dev/inst-solver-gen.py (revision 182)
@@ -67,7 +67,7 @@
public:
ProgramSolver():
program_(0),
- max_callee_save_(8), max_caller_save_(10)
+ max_callee_save_(8), max_caller_save_(10), max_args_(4)
{}
virtual ~ProgramSolver()
{}
@@ -81,6 +81,10 @@
{
max_caller_save_ = max_caller_save;
}
+ void set_max_args(int max_args)
+ {
+ max_args_ = max_args;
+ }
public:
void solve(Program &program)
@@ -123,6 +127,7 @@
int max_callee_save_;
int max_caller_save_;
+ int max_args_;
};
} // namespace inst
@@ -221,6 +226,12 @@
std::cerr << \"Callee-save register limited.\" << std::endl;
exit_set(exit_solve);
}
+ else if (vm::Cpu::a0 + max_args_ - 1 < reg.get_index() &&
+ reg.get_index() <= vm::Cpu::a3)
+ {
+ std::cerr << \"Argument register limited.\" << std::endl;
+ exit_set(exit_solve);
+ }
break;
case Register::unlimited:
if (!parse::unlimited_regs_p)
1
0
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 label
similar future email. If you have any questions, see
the administrator of that system for details.
Content preview: Fast erection Prolonged effect No prescription
required 2 popular medicines: CIALIS - http://www.get-a-pill.com/sv/
VIAGRA - http://www.get-a-pill.com/vt/ Discreet packaging [...]
Content analysis details: (15.5 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
1.2 RCVD_NUMERIC_HELO Received: contains an IP address used for HELO
0.2 DRUG_ED_CAPS BODY: Mentions an E.D. drug
0.0 HTML_MESSAGE BODY: HTML included in message
0.1 HTML_TAG_EXIST_TBODY BODY: HTML has "tbody" tag
0.1 RAZOR2_CF_RANGE_51_100 BODY: Razor2 gives confidence level above 50%
[cf: 100]
3.5 BAYES_99 BODY: Bayesian spam probability is 99 to 100%
[score: 1.0000]
0.1 HTML_50_60 BODY: Message is 50% to 60% HTML
1.5 RAZOR2_CHECK Listed in Razor2 (http://razor.sf.net/)
1.0 URIBL_SBL Contains an URL listed in the SBL blocklist
[URIs: get-a-pill.com]
3.2 URIBL_OB_SURBL Contains an URL listed in the OB SURBL blocklist
[URIs: get-a-pill.com]
4.3 URIBL_SC_SURBL Contains an URL listed in the SC SURBL blocklist
[URIs: get-a-pill.com]
0.2 DRUGS_ERECTILE Refers to an erectile drug
0.1 FORGED_OUTLOOK_TAGS Outlook can't send HTML in this format
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
Index: ChangeLog
from Nicolas Pouillard <ertai(a)lrde.epita.fr>
* vcs: Remove the ruby_ex external link, use the gem package instead.
* vcs/Rakefile: Use the core_ex common rakefile.
* vcs/SPEC.yml: New. Package meta data.
* vcs/SPEC.dyn.yml: New. Package generated meta data.
* vcs/AUTHORS: New.
* vcs/NEWS: New.
* vcs/src: Rename to ...
* vcs/lib/vcs: ... this.
* vcs/lib/vcs/ask.rb: Remove, because ask is present in ruby_ex.
* vcs/lib/vcs/edit.rb: New.
* vcs/bin/vcs: Update requires, load_path, version, and some
environement variables definition.
AUTHORS | 6 +
NEWS | 3
Rakefile | 79 +--------------
SPEC.dyn.yml | 9 +
SPEC.yml | 35 +++++++
bin/vcs | 27 ++---
lib/vcs/diffstat.rb | 2
lib/vcs/edit.rb | 15 +++
lib/vcs/vcs.rb | 65 ++++++-------
src/ask.rb | 101 --------------------
src/changelog.rb | 115 -----------------------
src/conflict.rb | 21 ----
src/cvs.rb | 21 ----
src/diff.rb | 18 ---
src/diffstat.rb | 30 ------
src/last_changed_date.rb | 16 ---
src/mail.rb | 51 ----------
src/message.rb | 69 -------------
src/mycommit.rb | 86 -----------------
src/news.rb | 118 -----------------------
src/prcs.rb | 21 ----
src/revision.rb | 18 ---
src/status.rb | 17 ---
src/svn.rb | 29 -----
src/tools.rb | 22 ----
src/vcs.rb | 234 -----------------------------------------------
26 files changed, 119 insertions(+), 1109 deletions(-)
Index: vcs/lib/vcs/diffstat.rb
--- vcs/lib/vcs/diffstat.rb (revision 206)
+++ vcs/lib/vcs/diffstat.rb (working copy)
@@ -14,7 +14,7 @@
check_diffstat
data_diff = diff(*a)
cmd = @@diffstat < data_diff.output.open > [@out_path, @err_path]
- cmd.sys
+ cmd.run(@runner)
end
alias_command :ds, :diffstat
Index: vcs/bin/vcs
--- vcs/bin/vcs (revision 206)
+++ vcs/bin/vcs (working copy)
@@ -16,18 +16,11 @@
require 'optparse'
require 'set'
-begin
- REV="$Rev$".sub(/LastChangedRevision:\s+/, '').to_i
-rescue
- REV=-1
-end
-
+VCS_VERSION = '0.2.148'
VCS_PATH = Pathname.new(__FILE__).expand_path
VCS_DIR, VCS = VCS_PATH.split
-SRC = VCS_DIR + '..' + 'src'
-RUBY_EX = VCS_DIR + '..' + 'ruby_ex'
-$: << SRC.to_s
-$: << RUBY_EX.to_s
+LIB = VCS_DIR + '..' + 'lib'
+$: << LIB.to_s
dir = Pathname.pwd
while not dir.root? and not (vcs_dir = dir + 'vcs').exist?
@@ -46,14 +39,14 @@
"#{VCS}: #{progname}#{severity.downcase}: #{msg}\n"
end
-Pathname.glob("{#{SRC}/**,#{vcs_dir}}/*.rb") do |file|
+Pathname.glob("{#{LIB}/**,#{vcs_dir}}/*.rb") do |file|
LOG.debug { file.basename.to_s }
begin
- require file.basename.to_s
- rescue LoadError => ex
+ require "vcs/#{file.basename}"
+ rescue LoadError
begin
require file.to_s
- rescue
+ rescue LoadError => ex
raise ex
end
end
@@ -115,7 +108,7 @@
end
opts.on_tail('--version', 'Show version') do
- STDOUT.puts "Vcs revision: #{REV}"
+ STDOUT.puts "Vcs version: #{VCS_VERSION}"
exit
end
@@ -130,7 +123,9 @@
end
env = %w[ EMAIL FULLNAME EDITOR PAGER ]
if env.all? { |s| ENV[s] }
- env.each { |s| Kernel.const_set(s, ENV[s]) }
+ EDITOR = ENV['EDITOR'].to_cmd
+ PAGER = ENV['PAGER'].to_cmd
+ EMAIL = ENV['EMAIL']
else
env.each { |s| LOG.error "Need #{s} in the environement" unless ENV[s] }
exit
Index: vcs/src/vcs.rb
--- vcs/src/vcs.rb (revision 206)
+++ vcs/src/vcs.rb (working copy)
@@ -1,234 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'set'
-require 'commands'
-
-# The abstract class for a Vcs wrapper.
-# Conventions:
-# example:
-# svn checkout http://foo.bar/proj # alias
-# vcs-svn checkout http://foo.bar/proj # wrapper
-# vcs --vcs Svn checkout http://foo.bar/proj # manual
-#
-# checkout
-# checkout_
-# checkout!
-# checkout_!
-#
-class Vcs
-
- class Failure < Exception
- end
-
- def initialize ( aCmd )
- @cmd = aCmd.to_cmd
- @handlers = Set.new
- @runner = Commands::Runners::System.new
- @runner.subscribe_hook(:failure) do |data|
- if data.status
- LOG.error { "exit(#{data.status.exitstatus})" }
- else
- LOG.fatal { 'no exit status' }
- end
- end
- @runner.subscribe_hook(:display_command) do |cmd|
- LOG.debug { "running: #{cmd.to_sh}" }
- end
- @out, @err = STDOUT, STDERR
- end
-
- def self.add_basic_method ( meth )
- class_eval <<-end_eval
- def #{meth}! ( *args )
- run!("#{meth}", *args)
- end
- def #{meth}_! ( *args )
- run!("#{meth}", *args)
- end
- end_eval
- end
-
- @@all_commands = {}
- @@all_aliases = Set.new
-
- def self.alias_command ( m1, m2 )
- m2 = m2.to_s
- @@all_commands[m2] ||= Set.new
- @@all_commands[m2] << m1.to_s
- @@all_aliases << m1
- class_eval <<-end_eval
- def #{m1} ( *args )
- #{m2}(*args)
- end
- def #{m1}_ ( *args )
- #{m2}_(*args)
- end
- def #{m1}! ( *args )
- #{m2}!(*args)
- end
- def #{m1}_! ( *args )
- #{m2}_!(*args)
- end
- end_eval
- end
-
- attr_accessor :out, :err, :out_path, :err_path
-
- @@checkers = Set.new
-
- def run! ( *args )
- cmd = @cmd + args
- if @out_path.nil?
- cmd = cmd > [@out, @err]
- else
- cmd = cmd > [@out_path, @err_path]
- end
- cmd.run(@runner)
- end
-
- def sub_vcs
- copy = dup
- copy.out_path = TempPath.new
- copy.err_path = TempPath.new
- copy.out = copy.out_path.open('w')
- copy.err = copy.err_path.open('w')
- copy
- end
-
- def run ( *args )
- sub_vcs.run!(*args)
- end
-
- %w[ checkout delete diff status log add update commit ].each do |m|
- add_basic_method(m)
- end
-
- def method_missing ( meth, *args )
- meth = meth.to_s
- if meth =~ /^(.*)!$/
- no_bang = $1
- if respond_to? no_bang
- LOG.warn { "Unefficient method call (#{no_bang}), " +
- "prefer define methods with a `!'" }
- send(no_bang, *args).each do |line|
- puts line
- end
- else
- LOG.warn { "unknown method #{meth}" }
- run!(no_bang.sub(/_$/, ''), *args)
- end
- else
- with_bang = meth + '!'
- if respond_to? with_bang
- copy = sub_vcs
- res = copy.send(with_bang, *args)
- if res.nil?
- copy.out.close
- copy.out_path
- else
- res
- end
- else
- LOG.warn { "unknown method #{meth}" }
- run!(meth.sub(/_$/, ''), *args)
- end
- end
- end
-
- def help! ( *args )
- return help_!(*args) unless args.empty?
- @out.puts "
- |usage: #{(a)cmd.command} <subcommand> [options] [args]
- |Type '#{(a)cmd.command} help <subcommand>' for help on a specific subcommand.
- |
- |Most subcommands take file and/or directory arguments, recursing
- |on the directories. If no arguments are supplied to such a
- |command, it recurses on the current directory (inclusive) by default.
- |
- |Available subcommands:".head_cut!
- cmds = []
- methods.each do |meth|
- next if meth =~ /_!?$/
- next unless meth =~ /^(.+)!$/
- cmd = $1
- next if cmd == 'run'
- next if @@all_aliases.include? cmd.to_sym
- cmds << cmd
- end
- cmds.sort!
- cmds.each do |cmd|
- if @@all_commands.has_key? cmd
- aliases = @@all_commands[cmd].sort.join(', ')
- @out.puts " - #{cmd} (alias #{aliases})"
- else
- @out.puts " - #{cmd}"
- end
- end
- end
-
- alias_command :ann, :blame
- alias_command :annotate, :blame
- alias_command :praise, :blame
- alias_command :co, :checkout
- alias_command :ci, :commit
- alias_command :cp, :copy
- alias_command :del, :delete
- alias_command :remove, :delete
- alias_command :rm, :delete
- alias_command :di, :diff
- alias_command :h, :help
- alias_command :ls, :list
- alias_command :mv, :move
- alias_command :rename, :move
- alias_command :ren, :move
- alias_command :pdel, :propdel
- alias_command :pd, :propdel
- alias_command :pedit, :propedit
- alias_command :pe, :propedit
- alias_command :pget, :propget
- alias_command :pg, :propget
- alias_command :plist, :proplist
- alias_command :pl, :proplist
- alias_command :pset, :propset
- alias_command :ps, :propset
- alias_command :st, :status
- alias_command :stat, :status
- alias_command :sw, :switch
- alias_command :up, :update
-
- # Cvs Alias
- alias_command :new, :add
- alias_command :rcs, :admin
- alias_command :get, :checkout
- alias_command :rlog, :log
- alias_command :patch, :rdiff
- alias_command :rfreeze, :rtag
- alias_command :freeze, :tag
-
- # Prcs Alias
- alias_command :checkin, :commit
- alias_command :populate, :add
-
- def error_handling ( meth )
- @handlers << meth
- end
-
- def call_handlers
- @handlers.each { |meth| send(meth) }
- end
-
- def self.add_conf_checker ( meth )
- @@checkers << meth
- end
-
- def call_conf_checkers
- @@checkers.each { |meth| send(meth) }
- end
-
-end # class Vcs
-
Index: vcs/src/message.rb
--- vcs/src/message.rb (revision 206)
+++ vcs/src/message.rb (working copy)
@@ -1,69 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-require 'vcs/changelog'
-
-class Vcs
- def diffw! ( *args )
- diff!(*args)
- end
-end
-
-class Svn
- def diffw! ( *args )
- diff! '--diff-cmd', 'diff', '-x', '-NPbuw', *args
- end
-end
-
-class Vcs
-
- @@message = Pathname.new(',message')
-
- def print_body ( file, options )
- LOG.warn "Creating a new `#{file}' file"
- file.open('w') do |f|
- f.puts options.to_yaml
- f.puts '---'
- f.puts
- f.print message.read
- end
- end
- private :print_body
-
- def message ( *args )
- error_handling :message_failed
-
- unless @@message.exist?
- cl = mkchangelog(*args)
- TempPath.new('message') do |tmp|
- tmp.open('w') do |f|
- f.puts 'Index: ChangeLog'
- f.print cl.read.sub(/^\d+-\d+-\d+/, 'from')
- f.puts
- f.print diffstat(*args).read
- f.puts
- diffw_from_status(*args).each_line do |line|
- f.print line if line !~ /^=+$/
- end
- end
- tmp.mv(@@message)
- end
- end
- @@message.open('r')
- end
-
- alias_command :msg, :message
-
- def message_failed
- if @@message.exist?
- LOG.info "#{@@message}: Contains the generated message"
- LOG.info ' (the ChangeLog entry, the diffstat, the diff)'
- end
- end
-
-end # class Vcs
Index: vcs/AUTHORS
--- vcs/AUTHORS (revision 0)
+++ vcs/AUTHORS (revision 0)
@@ -0,0 +1,6 @@
+---
+Vcs was written by and with the assistance of:
+
+ - Nicolas Pouillard <ertai(a)lrde.epita.fr>:
+ - Initial Design
+ - Maintenance
Index: vcs/src/tools.rb
--- vcs/src/tools.rb (revision 206)
+++ vcs/src/tools.rb (working copy)
@@ -1,22 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'yaml'
-module YAML
-
- def self.chop_header ( io )
- aStr = io.gets
- raise Exception, "First line is not valid: `#{aLine}'" unless aStr =~ /^---/
- io.each do |aLine|
- break if aLine =~ /^---/
- aStr += aLine
- end
- YAML::load(aStr)
- end
-
-end # module YAML
-
Index: vcs/src/ask.rb
--- vcs/src/ask.rb (revision 206)
+++ vcs/src/ask.rb (working copy)
@@ -1,101 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-ANSWERS = [ :y, :n ]
-ANSWER_NOT_VALID = 'Not a valid answer, please answer correctly'
-
-# `ask', ask the user to answer, to your question.
-#
-# Example:
-# ask('Commiting, are you sure', :n)
-#
-# produce => Commiting, are you sure (y/N):
-# and wait your answer.
-def ask ( aQuestion, theDefaultAnswer=:y, cin=STDIN, cout=STDOUT, cerr=STDERR )
-
- yn = case theDefaultAnswer
- when :y then ' [Y/n]: '
- when :n then ' [y/N]: '
- else raise ArgumentError, "not valid default answer #{theDefaultAnswer}"
- end
-
- loop do
- cout.print aQuestion, yn
- cout.flush
-
- answer = cin.readline.chomp.downcase
-
- return theDefaultAnswer if answer.empty?
-
- answer = answer.to_sym
-
- return answer if ANSWERS.include? answer
-
- cerr.puts ANSWER_NOT_VALID
- cout.puts
- end
-
-end
-
-if defined? TEST_MODE or $0 == __FILE__
-
-require 'test/unit'
-class AskTest < Test::Unit::TestCase
-
- def ask_checker ( question, default, answer, ref, out, err )
- require 'stringio'
- cin, cout, cerr = StringIO.new, StringIO.new, StringIO.new
- cin.puts answer
- cin.rewind
- res = ask(question, default, cin, cout, cerr)
- cout.rewind
- cerr.rewind
- assert_equal(res, ref, 'bad return value')
- assert_equal(cout.readlines.join, out, 'bad standard output')
- assert_equal(cerr.readlines.join, err, 'bad error output')
- end
-
- def test_bad_default
- assert_raise(ArgumentError) { ask_checker('Q', :foo, '', :y, [], []) }
- assert_nothing_raised do
- ask_checker('Q', :y, 'y', :y, 'Q [Y/n]: ', '')
- end
- assert_nothing_raised do
- ask_checker('Q', :n, 'y', :y, 'Q [y/N]: ', '')
- end
- end
-
- def test_valid_default_yes
- ask_checker('Q', :y, 'y', :y, 'Q [Y/n]: ', '')
- ask_checker('Q', :y, 'Y', :y, 'Q [Y/n]: ', '')
- ask_checker('Q', :y, 'n', :n, 'Q [Y/n]: ', '')
- ask_checker('Q', :y, 'N', :n, 'Q [Y/n]: ', '')
- ask_checker('Q', :y, '', :y, 'Q [Y/n]: ', '')
- end
-
- def test_valid_default_no
- ask_checker('Q', :n, 'y', :y, 'Q [y/N]: ', '')
- ask_checker('Q', :n, 'Y', :y, 'Q [y/N]: ', '')
- ask_checker('Q', :n, 'n', :n, 'Q [y/N]: ', '')
- ask_checker('Q', :n, 'N', :n, 'Q [y/N]: ', '')
- ask_checker('Q', :n, '', :n, 'Q [y/N]: ', '')
- end
-
- def test_invalid_answer
- ask_checker('Q', :n, "bad\ny", :y,
- "Q [y/N]: \nQ [y/N]: ", ANSWER_NOT_VALID + "\n")
- ask_checker('Q', :y, "ad\n\n", :y,
- "Q [Y/n]: \nQ [Y/n]: ", ANSWER_NOT_VALID + "\n")
- end
-
- def test_ask1
- ask_checker('Q', :y, 'y', :y, 'Q [Y/n]: ', '')
- end
-
-end # class AskTest
-
-end
Index: vcs/SPEC.dyn.yml
--- vcs/SPEC.dyn.yml (revision 0)
+++ vcs/SPEC.dyn.yml (revision 0)
@@ -0,0 +1,9 @@
+--- !ruby/object:OpenStruct
+table:
+ :url: https://svn.lrde.epita.fr/svn/lrdetools/trunk/vcs
+ :date: "Fri, 01 Jul 2005"
+ :version: !ruby/object:Version
+ build: 148
+ major: 0
+ minor: 2
+ revision: 206
Index: vcs/src/prcs.rb
--- vcs/src/prcs.rb (revision 206)
+++ vcs/src/prcs.rb (working copy)
@@ -1,21 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-
-class Prcs < Vcs
-
- def initialize ( aCmd='prcs' )
- super
- end
-
- %w[ admin ].each do |m|
- add_basic_method(m)
- end
-
-end # class Prcs
-
Index: vcs/src/conflict.rb
--- vcs/src/conflict.rb (revision 206)
+++ vcs/src/conflict.rb (working copy)
@@ -1,21 +0,0 @@
-class Vcs
-
- def mk_conflicts_list
- ls = status.output.readlines.grep(/^C/).map! { |s| s[/^C\s+(.*)/, 1] }
- raise "no conflicts" if ls.empty?
- ls
- end
-
- def edit_conflicts!
- edit! mk_conflicts_list
- end
-
- def resolve_conflicts!
- conflicts = mk_conflicts_list
- question = "Resolve these conflicts: \n - #{conflicts.join("\n - ")}\n"
- if ask(question, :n, STDIN, @out, @err) == :y
- return resolved(conflicts)
- end
- end
-
-end # class Vcs
Index: vcs/SPEC.yml
--- vcs/SPEC.yml (revision 0)
+++ vcs/SPEC.yml (revision 0)
@@ -0,0 +1,35 @@
+---
+Author: Nicolas Pouillard
+License: GNU General Public License (GPL)
+Revision: '$Id$'
+
+name: vcs
+
+title: Vcs -- A wrapper over any version control system
+summary: A wrapper over any version control system
+description: |
+ Version control systems (Subversion, CVS, PRCS...), however useful, are not
+ very extensible: adding new features can be cumbersome, especially if you
+ want them for different such systems at once. Vcs provide a simple dynamic
+ hierarchy for Version Control Systems.
+homepage: http://rubyforge.org/projects/vcs
+
+rdoc_dir: doc/html
+tags_url: https://svn.lrde.epita.fr/svn/lrdetools/tags
+
+commit_command: ltci
+
+rdoc_files: !filelist
+ - README
+ - AUTHORS
+ - lib/vcs/**/*.rb
+
+pkg_files: !filelist
+ - lib/vcs/**/*.rb
+ - bin/**/*
+ - '[A-Z]*'
+
+executables: [ vcs, vcs-svn, vcs-cvs, vcs-prcs ]
+
+dependencies:
+ ruby_ex: ~> 0.1.3
Index: vcs/src/news.rb
--- vcs/src/news.rb (revision 206)
+++ vcs/src/news.rb (working copy)
@@ -1,118 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/tools'
-require 'vcs/message'
-
-class Vcs
-
- NEWS = Pathname.new(',news')
-
- def parse_news_options ( *args )
- require 'optparse'
- result =
- {
- :from => FULL_EMAIL,
- :groups => [],
- :server => ENV['NNTPSERVER'],
- }
- if !args.nil? and !args.empty? and args[0].is_a?(Hash)
- return result.merge!(args[0])
- end
- OptionParser.new do |opts|
- opts.separator ''
- opts.on('-g', '--group NAME', 'Choose a news group') do |aString|
- result[:groups] << aString
- end
- opts.on('-s', '--server NAME', 'Choose a news server') do |aString|
- result[:server] = aString
- end
- opts.on('-S', '--subject NAME', 'Choose your news subject') do |aString|
- result[:subject] = aString.sub(/\.?$/, '.')
- end
- opts.on_tail('-h', '--help', 'Show this message') do
- puts opts
- exit
- end
- end.parse!(args)
- raise Failure, 'No news group' if result[:groups].empty?
- raise Failure, 'No news server' if result[:server].nil?
- raise Failure, 'No news subject' if result[:subject].nil?
- result
- end
- protected :parse_news_options
-
- def check_line ( anIO, aRegex )
- line = anIO.readline.chomp!
- LOG.debug('news') { "Server: #{line}" }
- unless line =~ aRegex
- LOG.error('news') { "Bad answer: #{line}" }
- @news_status = 'Error.'
- end
- end
- private :check_line
-
- #
- # Post the news.
- #
- def news! ( *args )
- error_handling :news_failed
-
- print_body(NEWS, parse_news_options(*args)) unless NEWS.exist?
-
- @news_status = 'Sent.'
- NEWS.open('r') do |file|
- opt = YAML::chop_header(file)
- server, port = opt[:server].split(/:/)
- port ||= 119
- LOG.info('news') { "Nntp Server: #{server}:#{port}" }
- if ask("Post a news, with this subject: #{opt[:subject]}\n" +
- " to #{opt[:groups].join(', ')}\n from #{opt[:from]}\n" +
- 'Are you sure?', :y) == :n
- LOG.error('news') { 'Aborting' }
- exit
- end
- require 'socket'
- TCPSocket.open(server, port) do |f|
- check_line(f, /^200/)
- f.puts 'post'
- check_line(f, /^340/)
- f.puts "Newsgroups: #{opt[:groups].join(', ')}"
- f.puts "From: #{opt[:from]}"
- f.puts "Subject: #{opt[:subject]}"
- f.puts
- file.each do |line|
- f.print line.gsub(/^\./, ' .')
- end
- f.puts '.'
- check_line(f, /^240/)
- f.puts 'quit'
- check_line(f, /^205/)
- end
- end
- NEWS.delete
- @out.puts @news_status
- end
-
- def news_failed
- if defined? NEWS and NEWS.exist?
- LOG.info "#{NEWS}: Contains the generated news" +
- "(generated from #{@@message})"
- end
- end
-
- def news_conf_checker
- %w[ NNTPSERVER ].each do |var|
- if ENV[var].nil? or ENV[var].empty?
- LOG.error "environment variable `#{var}' not set"
- end
- end
- end
-
- add_conf_checker :news_conf_checker
-
-end # class Vcs
Index: vcs/Rakefile
--- vcs/Rakefile (revision 206)
+++ vcs/Rakefile (working copy)
@@ -1,73 +1,8 @@
-require 'rubygems'
-require 'rake'
-require 'rake/testtask'
-require 'rake/packagetask'
-require 'rake/rdoctask'
-require 'rake/gempackagetask'
-require 'rake/contrib/rubyforgepublisher'
-
-PKG_VERSION = "0.2.#{`vcs-svn rev`.chomp}"
-
-PKG_FILES = FileList[*%w"
- src/**/*.rb
- ruby_ex/**/*.rb
- bin/**/*
- doc/**/*
- [A-Z]*
-"].exclude(/\b\.svn\b|\..*\.sw[op]$|~$|README/)
-
-desc 'Default Task'
-task :default => :package
-
-desc 'Publish to RubyForge'
-task :rubyforge do
- Rake::RubyForgePublisher.new('vcs', 'ertai').upload
-end
-
-
-Rake::RDocTask.new('doc') do |rdoc|
- rdoc.title = 'Vcs -- A wrapper over any version control system'
- rdoc.template = 'kilmer'
- #rdoc.template = 'doc/jamis'
- rdoc.options << '--line-numbers' << '--inline-source'
- #rdoc.rdoc_files.add('src/vcs.rb', 'src/**/*.rb')
- rdoc.rdoc_files.add('src/**/*.rb')
- #rdoc.main =
-end
-
-
-# The Gem specification
-spec = Gem::Specification.new do |s|
- s.platform = Gem::Platform::RUBY
- s.name = 'vcs'
- s.version = PKG_VERSION
- s.summary = 'A wrapper over any version control system'
- s.description = '
- Version control systems (Subversion, CVS, PRCS...), however useful,
- are not very extensible: adding new features can be cumbersome, especially
- if you want them for different such systems at once.
- Vcs provide a simple dynamic hierarchy for Version Control Systems.
- '
-
- s.bindir = 'bin'
- s.executables = %w[ vcs vcs-svn vcs-cvs vcs-prcs ]
- s.default_executable = 'vcs'
- s.files = PKG_FILES.to_a
- s.require_path = 'src'
- s.autorequire = 'vcs'
-
- s.has_rdoc = true
- s.author = 'Nicolas Pouillard'
- s.email = 'ertai(a)lrde.epita.fr'
- s.homepage = 'https://svn.lrde.epita.fr/svn/lrdetools/trunk/vcs/'
- s.rubyforge_project = s.name
-end
-
-# Create compressed packages
-Rake::GemPackageTask.new(spec) do |p|
- p.gem_spec = spec
- # p.need_tar = true
- # p.need_zip = true
-end
-
+# Author:: The TTK Team. -*- ruby -*-
+# Copyright:: Copyright (c) 2005 TTK team. All rights reserved.
+# License:: Ruby License
+# Revision:: $Id$
+require 'rubygems'
+require_gem 'core_ex'
+load 'core_ex/rakefile_base.rf'
Index: vcs/src/diffstat.rb
--- vcs/src/diffstat.rb (revision 206)
+++ vcs/src/diffstat.rb (working copy)
@@ -1,30 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# Revision:: $Id$
-
-require 'vcs/vcs'
-
-class Vcs
- @@diffstat = 'diffstat'.to_cmd
-
- # Use the diffstat command to
- # display statitics on your patch.
- def diffstat! ( *a )
- check_diffstat
- data_diff = diff(*a)
- cmd = @@diffstat < data_diff.output.open > [@out_path, @err_path]
- cmd.sys
- end
- alias_command :ds, :diffstat
-
- def check_diffstat
- unless `diffstat -V` =~ /diffstat version/
- raise ArgumentError, 'The `diffstat\' tool is needed by Vcs.diffstat'
- end
- end
-
- add_conf_checker :check_diffstat
-
-end # class Vcs
-
Index: vcs/lib/vcs/edit.rb
--- vcs/lib/vcs/edit.rb (revision 0)
+++ vcs/lib/vcs/edit.rb (revision 0)
@@ -0,0 +1,15 @@
+# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
+# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
+# License:: GNU General Public License (GPL).
+# Revision:: $Id$
+
+require 'vcs/vcs'
+
+class Vcs
+
+ def edit! ( *files )
+ cmd = EDITOR + files.flatten.map { |x| x.to_s } > [STDOUT, STDERR]
+ cmd.run(@runner)
+ end
+
+end # class Vcs
Property changes on: vcs/lib/vcs/edit.rb
___________________________________________________________________
Name: svn:keywords
+ Id
Index: vcs/src/svn.rb
--- vcs/src/svn.rb (revision 206)
+++ vcs/src/svn.rb (working copy)
@@ -1,29 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-require 'vcs/tools'
-
-CL = Pathname.new('ChangeLog')
-ADD_CL = Pathname.new(',ChangeLog')
-TMP_CL = Pathname.new(',,ChangeLog')
-
-class Svn < Vcs
-
- class Failure < Vcs::Failure
- end
-
- def initialize ( aCmd='svn' )
- super
- end
-
- %w[ blame cat cleanup copy export import list log merge mkdir move propedit
- switch resolved revert info propdel propget proplist propset ].each do |m|
- add_basic_method(m)
- end
-
-end # class Svn
Index: vcs/NEWS
--- vcs/NEWS (revision 0)
+++ vcs/NEWS (revision 0)
@@ -0,0 +1,3 @@
+New in 0.3 ...:
+ * help
+ * full stream based
Index: vcs/src/revision.rb
--- vcs/src/revision.rb (revision 206)
+++ vcs/src/revision.rb (working copy)
@@ -1,18 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/svn'
-
-class Svn
-
- def revision! ( *args )
- @out.puts info.read[/^Revision:\s+(\d+)/, 1]
- end
-
- alias_command :rev, :revision
-
-end # class Svn
Index: vcs/src/changelog.rb
--- vcs/src/changelog.rb (revision 206)
+++ vcs/src/changelog.rb (working copy)
@@ -1,115 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# Revision:: $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-require 'vcs/svn'
-
-class Svn
-
- @@file_st =
- {
- 'A' => 'New',
- 'D' => 'Remove',
- }
- @@file_st.default = ''
-
- @@prop_st =
- {
- 'M' => 'Changed property'
- }
-
- def mkchangelog_from_status ( *args )
- result = []
- from_status(*args) do |line, file_st, prop_st, copy_st, file|
- next if file_st =~ /[?X]/
- next if file == 'ChangeLog'
- ls = []
- ls << @@file_st[file_st] if @@file_st.has_key? file_st
- ls << @@prop_st[prop_st].downcase if @@prop_st.has_key? prop_st
- result << [file, ls.join(', ')]
- end
- raise Failure, 'No changes, so no ChangeLog entry.' if result.empty?
- result
- end
- private :mkchangelog_from_status
-
-end # class Svn
-
-
-class Vcs
-
- class MustBeFilled < Exception
- attr_reader :file
- def initialize ( file )
- @file = file
- super("You must fill this file: `#{file.to_s}'")
- end
- end
-
- def mkchangelog! ( *args )
- error_handling :changelog_failed
-
- cl = ADD_CL
-
- if cl.exist?
- f = cl.open('r')
- if f.readline !~ /^===/
- f.rewind
- return f
- end
- f.close
- else
- cl_add = mkchangelog_from_status(*args)
- LOG.warn "Creating a new `#{cl}' file"
- cl.open('w') do |f|
- f.puts '=== Fill this file correctly and remove this line ==='
- f.puts Time.now.strftime("%Y-%m-%d #{FULL_EMAIL}")
- f.puts
- cl_add.each do |file, str|
- f.puts "\t* #{file}: #{str}."
- end
- end
- end
-
- raise MustBeFilled, cl
- end
-
- def concat_changelog! ( *args )
- error_handling :changelog_failed
-
- unless CL.exist?
- raise Failure, "No `#{CL}', you are probably not in a valid directory."
- end
-
- if cl = mkchangelog(*args)
-
- unless TMP_CL.exist?
- LOG.info "Moving `#{CL}' to `#{TMP_CL}' ..."
- CL.rename(TMP_CL)
- end
-
- CL.open('w') do |file|
- LOG.info "Prepending `#{ADD_CL}' to `#{CL}' ..."
- file.print cl.read
- file.puts
- file.print TMP_CL.read
- end
-
- end
- end
-
- def changelog_failed
- if TMP_CL.exist?
- LOG.info "Restoring `#{CL}' from `#{TMP_CL}' ..."
- TMP_CL.rename(CL)
- end
- LOG.info "#{ADD_CL}: Contains your ChangeLog entry" if ADD_CL.exist?
- end
-
- alias_command :mkcl, :mkchangelog
- alias_command :ctcl, :concat_changelog
-
-end # class Vcs
-
Index: vcs/src/status.rb
--- vcs/src/status.rb (revision 206)
+++ vcs/src/status.rb (working copy)
@@ -1,17 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# Revision:: $Id$
-
-class Svn
-
- def from_status ( *args, &block )
- status(*args).output.each_line do |line|
- next unless line =~ /^.{5} /
- m = /^(.)(.).(.).\s*(.*)$/.match(line)
- block[*m.to_a]
- end
- end
- protected :from_status
-
-end # class Svn
Index: vcs/src/last_changed_date.rb
--- vcs/src/last_changed_date.rb (revision 206)
+++ vcs/src/last_changed_date.rb (working copy)
@@ -1,16 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# $Id$
-
-require 'vcs/svn'
-
-class Svn
-
- def last_changed_date! ( *args )
- @out.puts info.read[/^Last Changed Date:.*?\(([^)]*)\).*$/, 1]
- end
-
- alias_command :date, :last_changed_date
-
-end # class Svn
Index: vcs/src/diff.rb
--- vcs/src/diff.rb (revision 206)
+++ vcs/src/diff.rb (working copy)
@@ -1,18 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# Revision:: $Id$
-
-class Svn
-
- def diffw_from_status! ( *args )
- files = Set.new
- from_status(*args) do |line, file_st, prop_st, cpy, file|
- next if file_st =~ /[?X]/
- next if file == 'ChangeLog'
- files << Pathname.new(file)
- end
- diffw!(*files.delete_if { |f| f.directory? })
- end
-
-end # class Svn
Index: vcs/src/mycommit.rb
--- vcs/src/mycommit.rb (revision 206)
+++ vcs/src/mycommit.rb (working copy)
@@ -1,86 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-require 'ask'
-
-class Vcs
-
- COMMITED = Pathname.new(',commited')
-
- def common_commit! ( *args, &block )
-
- opts, args = args.partition { |a| a =~ /^-/ }
-
- update!
-
- unless COMMITED.exist?
-
- begin
- mkchangelog(*args)
- rescue MustBeFilled => ex
- edit! ex.file
- end
-
- message(*args)
-
- edit! @@message
-
- if ask('Committing, are you sure?', :y) == :n
- commit_failed
- end
-
- concat_changelog!(*args)
-
- #pager! diff
- #pager! status
-
- args << 'ChangeLog' unless args.grep(/^[^-]/).empty?
-
- if commit!('-F', ADD_CL, *(opts + args))
- ADD_CL.rename(COMMITED)
- TMP_CL.delete if TMP_CL.exist?
- else
- commit_failed
- end
-
- update!
-
- else
-
- message(*args)
- edit! @@message
-
- end
-
-
- rev = revision.read.to_i
-
- block.call(rev) if block_given?
-
- LOG.info 'Deleting junk files...'
- TMP_CL.delete if TMP_CL.exist?
- ADD_CL.delete if ADD_CL.exist?
- COMMITED.delete if COMMITED.exist?
- messages = Pathname.new(',messages')
- messages.mkpath unless messages.directory?
- message_rev = messages + "#{@@message}.#{rev}"
- LOG.info "Moving `#{@@message}' to `#{message_rev}'..."
- @@message.rename(message_rev)
- LOG.info "You can remove `#{message_rev}' if everything is ok."
-
- end
- alias_command :cci, :common_commit
-
- def commit_failed
- LOG.info "#{COMMITED}: Contains your ChangeLog entry" if COMMITED.exist?
- LOG.error 'Aborting'
- LOG.info 'You can rerun the same command to continue the commit'
- raise 'Commit failed'
- end
-
-end # class Vcs
Index: vcs/src/cvs.rb
--- vcs/src/cvs.rb (revision 206)
+++ vcs/src/cvs.rb (working copy)
@@ -1,21 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-
-# $LastChangedBy: ertai $
-# $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-
-class Cvs < Vcs
-
- def initialize ( aCmd='cvs' )
- super
- end
-
- %w[ rdiff rtag tag ].each do |m|
- add_basic_method(m)
- end
-
-end # class Cvs
-
Index: vcs/lib/vcs/vcs.rb
--- vcs/lib/vcs/vcs.rb (revision 206)
+++ vcs/lib/vcs/vcs.rb (working copy)
@@ -29,16 +29,16 @@
@cmd = aCmd.to_cmd
@handlers = Set.new
@runner = Commands::Runners::System.new
+ @strict_runner = Commands::Runners::System.new.raise_on_failures
+
+ display_hook = lambda { |cmd| LOG.debug { "running: #{cmd.to_sh}" } }
+
@runner.subscribe_hook(:failure) do |data|
- if data.status
- LOG.error { "exit(#{data.status.exitstatus})" }
- else
- LOG.fatal { 'no exit status' }
- end
- end
- @runner.subscribe_hook(:display_command) do |cmd|
- LOG.debug { "running: #{cmd.to_sh}" }
+ exit((data.status)? data.status.exitstatus : 1)
end
+ @runner.subscribe_hook(:display_command, &display_hook)
+ @strict_runner.subscribe_hook(:display_command, &display_hook)
+
@out, @err = STDOUT, STDERR
end
@@ -85,10 +85,15 @@
cmd = @cmd + args
if @out_path.nil?
cmd = cmd > [@out, @err]
+ if @out == STDOUT
+ cmd.run(@runner)
+ else
+ cmd.run(@strict_runner)
+ end
else
cmd = cmd > [@out_path, @err_path]
+ cmd.run(@strict_runner)
end
- cmd.run(@runner)
end
def sub_vcs
@@ -104,7 +109,16 @@
sub_vcs.run!(*args)
end
- %w[ checkout delete diff status log add update commit ].each do |m|
+ def run_missing! ( name, orig, *args )
+ if name =~ /^(.*)_$/
+ run!($1, *args)
+ else
+ LOG.warn { "unknown method #{orig}" }
+ run!(name, *args)
+ end
+ end
+
+ %w[ checkout help delete diff status log add update commit ].each do |m|
add_basic_method(m)
end
@@ -112,31 +126,16 @@
meth = meth.to_s
if meth =~ /^(.*)!$/
no_bang = $1
- if respond_to? no_bang
- LOG.warn { "Unefficient method call (#{no_bang}), " +
- "prefer define methods with a `!'" }
- send(no_bang, *args).each do |line|
- puts line
- end
- else
- LOG.warn { "unknown method #{meth}" }
- run!(no_bang.sub(/_$/, ''), *args)
- end
+ super unless respond_to? no_bang
+ run_missing!(no_bang, meth, *args)
else
with_bang = meth + '!'
- if respond_to? with_bang
+ return run_missing!(meth, meth, *args) unless respond_to? with_bang
copy = sub_vcs
res = copy.send(with_bang, *args)
- if res.nil?
+ return res unless res.nil?
copy.out.close
copy.out_path
- else
- res
- end
- else
- LOG.warn { "unknown method #{meth}" }
- run!(meth.sub(/_$/, ''), *args)
- end
end
end
Index: vcs/src/mail.rb
--- vcs/src/mail.rb (revision 206)
+++ vcs/src/mail.rb (working copy)
@@ -1,51 +0,0 @@
-# Author:: Nicolas Pouillard <ertai(a)lrde.epita.fr>.
-# Copyright:: Copyright (c) 2004 LRDE. All rights reserved.
-# License:: GNU General Public License (GPL).
-# Revision:: $Id: header 98 2004-09-29 12:07:43Z ertai $
-
-require 'vcs/vcs'
-require 'sendmail'
-
-class Vcs
-
- MAIL = Sendmail::MAIL_FILE
- MAILER = Sendmail.new
- DEFAULT_OPTIONS = %w[ --ask --sign --mime ]
-
- #
- # Mail.
- #
- def mail! ( *args )
- error_handling :mail_failed
- unless MAIL.exist?
- print_body(MAIL, MAILER.parse_mail_options(*(DEFAULT_OPTIONS + args)))
- end
- MAILER.sendmail
- MAIL.delete
- @out.puts 'Mail: Sent.'
- end
-
- def mail_failed
- if defined? MAIL and MAIL.exist?
- LOG.info "#{MAIL}: Contains the generated mail " +
- "(generated from #{@@message})"
- end
- end
-
- def mail_conf_checker
- %w[ EMAIL FULLNAME SMTPSERVER ].each do |var|
- if ENV[var].nil? or ENV[var].empty?
- LOG.error "environment variable `#{var}' not set"
- end
- end
- unless `gpg --version` =~ /^gpg \(GnuPG\)/
- LOG.error 'command not found: gpg'
- end
- unless File.exist?("#{ENV['HOME']}/.gnupg/secring.gpg")
- LOG.error 'no private key: in your ~/.gnupg'
- end
- end
-
- add_conf_checker :mail_conf_checker
-
-end # class Vcs
1
0
I am not sure this is the good way to do this, but...
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* bootstrap: Update the time stamp of reference output files to
avoid them to be illegitimately regenerated when checked out from
the repository.
2004-10-31 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: bootstrap
--- bootstrap (revision 144)
+++ bootstrap (revision 145)
@@ -4,4 +4,7 @@
cd src/inst
../../dev/inst-nodes-mk-gen.py < ../../dev/nolimips.xml > nodes.mk
cd $here
+
+find tests -name '*.ref' -exec touch '{}' ';'
+
autoreconf -f -v -i -m
1
0
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* src/parse/libparse.cc: Use the up-to-date bison parser
constructor. make check failed on platforms that have bison1.875e,
which generates an error message when the deprecated parser
constructor is invoked.
2004-10-31 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: src/parse/libparse.cc
--- src/parse/libparse.cc (revision 145)
+++ src/parse/libparse.cc (revision 146)
@@ -39,7 +39,7 @@
::inst::Program*
parse (const std::string &fname)
{
- yy::Parser parser = yy::Parser (trace_parse_p, yy::Location ());
+ yy::Parser parser = yy::Parser (trace_parse_p);
yy::program_builder.reset(nop_after_branch_p);
1
0
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
2004-10-31 Benoît Perrot <benoit(a)lrde.epita.fr>
* configure.ac:
Check <sys/int_limits.h> presence.
* src/stdint_.h:
Use <sys/int_limits.h> when it is present to define limit macros.
A problem occured on our SunOS: <stdint_.h> includes <sys/int_limits.h>
through several files, leading to a macro definition clash.
2004-10-30 Benoît Perrot <benoit(a)lrde.epita.fr>
2004-10-30 Benoît Perrot <benoit(a)lrde.epita.fr>
2004-10-30 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: src/stdint_.h
--- src/stdint_.h (revision 143)
+++ src/stdint_.h (revision 144)
@@ -138,6 +138,10 @@
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
+#if defined(HAVE_SYS_INT_LIMITS_H)
+# include <sys/int_limits.h>
+#else
+
/* 7.18.2.1. Limits of exact-width integer types */
#define INT8_MIN -128
@@ -225,6 +229,8 @@
/* wchar_t limits already defined in <stddef.h>. */
/* wint_t limits already defined in <wchar.h>. */
+#endif /* !HAVE_SYS_INT_LIMITS_H */
+
#endif
/* 7.18.4. Macros for integer constants */
Index: configure.ac
--- configure.ac (revision 143)
+++ configure.ac (revision 144)
@@ -43,6 +43,8 @@
## Development environment -------------
CXXFLAGS="${CXXFLAGS} -ansi -Wall -W -D__STDC_LIMIT_MACROS"
+# Check presence of stdint.h
+AC_CHECK_HEADERS([sys/int_limits.h])
gl_STDINT_H
## Epilogue ----------------------------
1
0
Index: ChangeLog
from Clement Vasseur <clement.vasseur(a)lrde.epita.fr>
* auto-build/auto-build: Add support for building on several hosts.
* auto-build/packages.list: Add more hosts.
Index: auto-build/auto-build
--- auto-build/auto-build (revision 112)
+++ auto-build/auto-build (working copy)
@@ -32,16 +32,17 @@
=head1 NAME
-auto-build
+auto-build - Auto Build System
=head1 SYNOPSIS
-auto-build [options] packages.list [style.css]
+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
+ -c, --css=FILE use FILE for the style sheet
=head1 DESCRIPTION
@@ -50,81 +51,101 @@
use strict;
use Getopt::Long;
use Pod::Usage;
+use File::Copy;
my $report_dir;
-my $build_dir;
-my $inst_dir;
+my @hosts;
my @packages;
-
-my %variables;
my @colors;
-my %deps;
+my @info;
+my %variables;
-my $packages;
-my $css;
-my $man = 0;
-my $help = 0;
+my $man;
+my $help;
my $delay = 0;
+my $css;
GetOptions(
'man|m' => \$man,
'help|h|?' => \$help,
'version|V' => \&version,
'delay|d=i' => \$delay,
+ 'css|c=s' => \$css
) or pod2usage(-verbose => 0);
pod2usage(-verbose => 1) if $help;
pod2usage(-exitstatus => 0, -verbose => 2) if $man;
+pod2usage(-verbose => 0) unless @ARGV;
-($packages, $css) = @ARGV;
-pod2usage(-verbose => 0) unless defined $packages;
-
-&read_pkg_list($packages);
-&create_dir($report_dir);
-&create_dir($build_dir);
-&create_dir($inst_dir);
-
-if (defined $css) {
- system("/bin/cp \"$css\" \"$report_dir/style.css\"")
- and die "$0: unable to cp `$css' to `$report_dir/style.css'";
-} else {
- &print_css;
-}
-
+&read_pkg_list($ARGV[0]);
+&prepare_hosts;
&prepare_pkgs;
+&gen_css;
+&gen_info;
+&gen_report;
+&gen_pkg_report($_) foreach @packages;
while (1) {
- &auto_build;
- last if $delay == 0;
- sleep $delay * 60;
+ foreach my $host (@hosts) {
+ my $pid = fork;
+ defined $pid or die "$0: unable to fork: $!\n";
+ unless ($pid) {
+ $_->{'do_build'} = 1 foreach @packages;
+ foreach my $pkg (@packages) {
+ $pkg->{'host'} = $host;
+ if (defined $pkg->{'hosts'}) {
+ my $na = 1;
+ foreach (split /\s+/, $pkg->{'hosts'}) {
+ if ($_ eq $host->{'name'}) {
+ $na = 0;
+ last;
+ }
+ }
+ if ($na) {
+ &set_status($pkg, 'na');
+ next;
+ }
+ }
+ $pkg->{'env'} .= " $host->{'env'}" if defined $host->{'env'};
+ delete $pkg->{'env'} unless $pkg->{'env'};
+ &set_status($pkg, 'skipped') unless $pkg->{'do_build'};
+ next if $pkg->{'do_build'} and &build_pkg($pkg, $host) eq 'succeeded';
+ undef $_->{'do_build'} foreach @{$pkg->{'used_by'}};
+ }
+ exit 0;
+ }
+ $host->{'pid'} = $pid;
}
-sub auto_build {
- &gen_summary;
-
+ for (my $i = 0; $i < @hosts; ) {
+ sleep 1;
+ foreach my $host (@hosts) {
foreach my $pkg (@packages) {
- print "$pkg->{'name'}:\n";
-
- &ch_dir($build_dir);
- next if &check_revision($pkg);
+ my $file = "$report_dir/$pkg->{'name'}/$host->{'name'}/status";
+ my $st = `cat "$file" 2>/dev/null`;
+ chomp($st);
+ $pkg->{'status'}->{$host->{'name'}} = '' unless
+ defined $pkg->{'status'}->{$host->{'name'}};
+ if ($st ne $pkg->{'status'}->{$host->{'name'}}) {
+ if ($pkg->{'name'} eq $packages[-1]->{'name'}
+ and ($st eq 'succeeded' or $st eq 'failed' or $st eq 'na')) {
+ waitpid($host->{'pid'}, 0);
+ $i++;
+ }
+ $pkg->{'status'}->{$host->{'name'}} = $st;
&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');
+ &gen_report;
}
- unless ($ok) {
- &set_status($pkg, 'skipped');
- last;
}
}
-
- &build_pkg($pkg) if $ok;
}
+
+ last if $delay == 0;
+ sleep $delay * 60;
}
+&gen_report;
+
sub xopen {
my $filename = shift;
my $name = $filename;
@@ -141,40 +162,6 @@
close $FILE or die "$0: unable to close `$FILE': $!\n";
}
-sub header {
- my ($filename, $title, $css) = @_;
- my $FILE = &xopen(">$filename");
- select $FILE;
-
- $css = ("../" x $css) . 'style.css';
-
- print <<HTML;
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
-"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
- <title>$title</title>
- <link rel="stylesheet" type="text/css" href="$css"/>
- </head>
- <body>
-HTML
-
- return $FILE;
-}
-
-sub footer {
- print <<HTML;
- <h4>Generated by <em>auto-build</em> version $VERSION</h4>
- </body>
-</html>
-HTML
-
- select STDOUT;
- my $FILE = shift;
- &xclose($FILE);
-}
-
sub read_pkg_list {
my $filename = shift;
my $LIST = &xopen($filename);
@@ -198,19 +185,15 @@
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*info\s+(.*?)\s*$/) {
+ push @info, split(/\s+/, $1);
+
+ } elsif (m/^\s*host\s+\"(.*)\"\s*$/) {
+ push @hosts, { 'name' => $1 };
+
} elsif (m/^\s*section\s+\"(.*)\"\s*$/) {
$section = $1;
@@ -221,276 +204,306 @@
push @packages, {
'name' => $1,
'section' => $section,
+ 'wd' => '/',
'opt' => '',
- 'cfg' => '',
- 'rev' => '0'
+ 'env' => '',
+ 'cfg' => ''
};
- } elsif (m/^\s*(\w\w\w)\s*:\s*(.*?)\s*$/) {
+ } elsif (m/^\s*(\w+)\s*:\s*(.*?)\s*$/) {
my $field = $1;
my $value = $2;
- my $err = 1;
- foreach ('url', 'cfg', 'opt', 'env', 'dif', 'cpu') {
- if ($field eq $_) {
- $err = 0;
- last;
- }
- }
-
- die "$filename:$.: invalid field `$field'\n" if $err;
+ if (defined $section) {
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;
+ $value =~ s/\$\{([\w\-]+)\}/\$DIR\/usr\/$1/;
+ foreach (@packages) {
+ push @{$_->{'used_by'}}, $packages[-1] if $_->{'name'} eq $1;
}
}
+ }
+
+ $field =~ m/^(url|cfg|opt|env|diff|hosts)$/
+ or die "$filename:$.: invalid field `$field'\n";
$packages[-1]->{$field} = $value;
} else {
+ $field =~ m/^(addr|dir|user|proc|env|make)$/
+ or die "$filename:$.: invalid field `$field'\n";
+ $hosts[-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";
+ die "$0: the report directory must be defined\n" unless defined $report_dir;
}
-sub create_dir {
- my $dir = shift;
- return if -d $dir;
- system("/bin/mkdir -p \"$dir\"")
- and die "$0: unable to mkdir `$dir'\n";
-}
+sub set_status {
+ my ($pkg, $status, $step) = @_;
+ my $file = "$report_dir/$pkg->{'name'}/$pkg->{'host'}->{'name'}/status";
-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";
+ if (defined $step) {
+ return unless defined $step->{'name'};
+ $file =~ s/status$/$step->{'name'}.status/;
+ } else {
+ $pkg->{'status'} = $status;
+ print "$pkg->{'host'}->{'name'}:$pkg->{'name'}:$status\n";
}
-sub ch_dir {
- my $dir = shift;
- chdir $dir or die "$0: unable to chdir `$dir': $!\n";
+ system("echo \"$status\" > \"$file\"")
+ and die "$0: unable to create `$file'\n";
}
-sub time_to_str {
- $_ = shift;
- my $t = '';
+sub header {
+ my ($filename, $title, $css) = @_;
+ my $FILE = &xopen(">$filename");
+ select $FILE;
+
+ $css = ("../" x $css) . 'style.css';
+
+ print <<HTML;
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html>
+ <head>
+ <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+ <title>$title</title>
+ <link rel="stylesheet" type="text/css" href="$css"/>
+ </head>
+ <body>
+HTML
- if (defined $_ and $_ ne '') {
- $t = ($_ % 60) . "s";
- $t = (($_/60) % 60) . "m$t" if $_ >= 60;
- $t = (($_/(60 * 60)) % 60) . "h$t" if $_ >= 60 * 60;
+ return $FILE;
}
- return $t;
+sub footer {
+ print <<HTML;
+ <h4>Generated by <em>auto-build</em> version $VERSION</h4>
+ </body>
+</html>
+HTML
+
+ select STDOUT;
+ my $FILE = shift;
+ &xclose($FILE);
}
-sub gen_summary {
+sub gen_report {
my $SUMMARY = &header("$report_dir/index.html", "Auto Build System", 0);
my $section = '';
print <<HTML;
<h1>Auto Build System</h1>
<table>
+ <tr>
+ <td class="left"></td>
+HTML
+
+ foreach (@hosts) {
+ print <<HTML;
+ <td style="width:7em">
+ <a href="info/$_->{'name'}.html">$_->{'name'}</a><br/>
+ <span class="mach">$_->{'type'}</span>
+ </td>
HTML
+ }
+
+ print " </tr>\n";
foreach my $pkg (@packages) {
if ($pkg->{'section'} ne $section) {
- $section = $pkg->{'section'};
print <<HTML;
<tr>
- <td colspan="3">
- <h3>$section</h3>
- </td>
+ <td class="left"><h3>$pkg->{'section'}</h3></td>
</tr>
HTML
+ $section = $pkg->{'section'};
}
- $pkg->{'status'} = '' unless defined $pkg->{'status'};
-
- my $time = &time_to_str($pkg->{'time'});
-
print <<HTML;
<tr class="body">
- <td class="left" style="width:10em">
+ <td class="left">
<a href=\"$pkg->{'name'}/index.html\">$pkg->{'name'}</a>
</td>
- <td style="width:7em" class="st_$pkg->{'status'}">$pkg->{'status'}</td>
- <td style="width:7em" class="time">$time</td>
- </tr>
HTML
+ foreach my $host (@hosts) {
+ my $status = $pkg->{'status'}->{$host->{'name'}};
+ $status = '' unless defined $status;
+ my $sn = $status;
+ $sn = 'n/a' if $sn eq 'na';
+ print " <td class=\"st_$status\">$sn</td>\n";
+ }
+ print " </tr>\n";
}
- print <<HTML;
- </table>
-HTML
+ print " </table>\n";
&footer($SUMMARY);
}
sub gen_pkg_report {
my $pkg = shift;
my $filename = "$report_dir/$pkg->{'name'}/index.html";
- my $REPORT = &header("$filename", "$pkg->{'name'} report", 1);
+ my $REPORT = &header("$filename", "$pkg->{'name'} build report", 1);
- my ($ts, $tf) = ('', '');
- $ts = localtime $pkg->{'time_started'} if defined $pkg->{'time_started'};
- $tf = localtime $pkg->{'time_finished'} if defined $pkg->{'time_finished'};
-
- print " <h1>$pkg->{'name'}</h1>\n";
-
- if (defined $pkg->{'archives'}) {
- foreach (@{$pkg->{'archives'}}) {
- print " <a href=\"$_\">$_</a><br/>\n" if -f $_;
- }
+ print <<HTML;
+ <h1>$pkg->{'name'}</h1>
+ <table>
+ <tr>
+ <td style="width:6em"></td>
+HTML
+ foreach (@hosts) {
+ print <<HTML;
+ <td style="width:7em">
+ $_->{'name'}<br/>
+ <span class="mach">$_->{'type'}</span>
+ </td>
+HTML
}
-
- print " <h5>Build started: $ts</h5>\n" if $ts;
- print " <table cellpadding=\"8\">\n";
+ print " </tr>\n";
foreach my $step (@{$pkg->{'steps'}}) {
next unless defined $step->{'name'};
- if (defined $step->{'status'}) {
- my $time = &time_to_str($step->{'time'});
-
print <<HTML;
<tr class="body">
- <td class="left" style="width:8em">
- <a href=\"$step->{'name'}.html\">$step->{'name'}</a>
- </td>
- <td style="width:7em" class="st_$step->{'status'}">$step->{'status'}</td>
- <td style="width:7em" class="time">$time</td>
- </tr>
+ <td class="left">$step->{'name'}</td>
HTML
- } else {
+ foreach (@hosts) {
+ my $file = "$report_dir/$pkg->{'name'}/$_->{'name'}/$step->{'name'}";
+ chomp(my $status = `cat \"$file.status\" 2>/dev/null`);
+ if ($status) {
print <<HTML;
- <tr class="body">
- <td class="left" style="width:8em">$step->{'name'}</td>
- <td style="width:6em" />
- <td style="width:6em" />
- </tr>
+ <td>
+ <a href="$_->{'name'}/$step->{'name'}.html">
+ <span class="st_$status">$status</span>
+ </a>
+ </td>
HTML
+ } else {
+ print " <td></td>\n";
+ }
}
+ print " </tr>\n";
}
print " </table>\n";
- print " <h5>Build finished: $tf</h5>\n" if $tf;
&footer($REPORT);
}
-sub set_status {
- $_[0]->{'status'} = $_[1];
- system("echo \"$_[1]\" > \"$build_dir/$_[0]->{'name'}/.status\"")
- and die "$0: unable to create `$build_dir/$_[0]->{'name'}/.status'\n";
- print " - $_[1]\n";
- &gen_summary;
-}
-
sub gen_log_page {
- my ($pkg, $step) = @_;
- my $filename = "$report_dir/$pkg->{'name'}/$step->{'name'}.html";
- my $REPORT = &header("$filename", "$pkg->{'name'} - $step->{'name'}", 1);
-
- print <<HTML;
- <h1>$pkg->{'name'} - $step->{'name'}</h1>
- <h5>$step->{'cmd'}</h5>
- <a href="$step->{'name'}.log">View log</a>
-HTML
-
- &footer($REPORT);
-}
-
-sub run {
- my ($pkg, $step) = @_;
- 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", 1);
+ my ($pkg, $step, $log) = @_;
+ my $host = "$pkg->{'host'}->{'name'}";
+ my $filename = "$report_dir/$pkg->{'name'}/$host/$step->{'name'}.html";
+ my $title = "$pkg->{'name'} - $host - $step->{'name'}";
+ my $REPORT = &header($filename, $title, 2);
print <<HTML;
- <h1>$pkg->{'name'} - $step->{'name'}</h1>
+ <h1>$title</h1>
<h5>$step->{'cmd'}</h5>
- <pre>
HTML
- my $LOG = &xopen("$out.log");
- my $archives_ready;
+ if (defined $log) {
+ my $LOG = &xopen($log);
+ print " <pre>\n";
while (<$LOG>) {
- s/\</\</g;
- s/\>/\>/g;
+ s/\</\</g;
foreach my $c (@colors) {
- if (m/$c->[0]/) {
+ next unless m/$c->[0]/;
s/^(.*?)($c->[0])(.*)$/$1<span style=\"color:$c->[1]\">$2<\/span>$3/g;
last;
}
- }
- if ($status eq 'distcheck') {
- 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;
}
-
print "</pre>\n";
&xclose($LOG);
+
+ } else {
+ print " <a href=\"$step->{'name'}.log\">View log</a>\n";
+ }
+
&footer($REPORT);
- return undef if $exit_code;
- return 1;
}
-sub check_revision {
- my $pkg = shift;
- my $revfile = "$build_dir/$pkg->{'name'}/.rev";
- my $rev;
+sub gen_info {
+ my @uname = (
+ [ 'Operating system', 'sr' ], [ 'Processor', 'm' ]
+ );
- 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 -q -N -P \"$build_dir/$pkg->{'name'}\" \"$1\" &&
- md5sum \"$build_dir/$pkg->{'name'}/$3\"`);
- }
- $pkg->{'rev'} = $rev;
- $pkg->{'rev'} = '0' unless defined $pkg->{'rev'};
-
- if (-f $revfile) {
- chomp($rev = `cat \"$revfile\"`);
- unlink $revfile if $pkg->{'rev'} ne $rev;
- }
- if (-f $revfile) {
- chomp($pkg->{'time'} = `cat \"$build_dir/$pkg->{'name'}/.time\"`);
- chomp($pkg->{'status'} = `cat \"$build_dir/$pkg->{'name'}/.status\"`);
- &set_status($pkg, $pkg->{'status'});
- return 1;
+ foreach my $host (@hosts) {
+ print "generating info for $host->{'name'}\n";
+
+ my $INFO = &header("$report_dir/info/$host->{'name'}.html",
+ "$host->{'name'} info", 1);
+ print <<HTML;
+ <h1>$host->{'name'} info</h1>
+ <div class="left">
+ <b>Host:</b> $host->{'addr'}<br/>
+HTML
+ foreach my $i (@uname) {
+ &execute($host, "uname -$i->[1]", ".$$.out");
+ print " <b>$i->[0]:</b> ", `cat .$$.out`, "<br/>\n";
+ }
+ print " <b>Environment:</b> $host->{'env'}<br/>\n"
+ if defined $host->{'env'};
+ print " </div>\n";
+
+ foreach my $prog (sort @info) {
+ if (&execute($host, "$prog --version", ".$$.out") == 0
+ or &execute($host, "$prog -V", ".$$.out") == 0) {
+ print " <h4>$prog</h4>\n<pre>", `sed 's/</\\</g' < .$$.out`,
+ "</pre>\n";
+ }
+ }
+ unlink ".$$.out";
+ &footer($INFO);
}
- return undef;
}
-sub get_package {
- my $pkg = shift;
+sub prepare_hosts {
+ foreach my $host (@hosts) {
+ my $cmd = "uname -mo 2>/dev/null || uname -ps |
+ sed \"s/\\(.*\\) \\(.*\\)/\\2 \\1/\"";
+ &execute($host, $cmd, ".$$.out");
+ chomp($host->{'type'} = `cat .$$.out; rm -f .$$.out`);
+ $host->{'make'} = 'make' unless defined $host->{'make'};
+ $host->{'make'} .= ' -k';
+ $host->{'make'} .= " -j $host->{'proc'}" if defined $host->{'proc'};
+ }
+}
+
+sub prepare_pkgs {
+ my $bootstrap = 'if [ -x bootstrap ]; then ./bootstrap; else if ' .
+ '[ -x ./bootstrap.sh ]; then ./bootstrap.sh; else autoreconf -fvi; fi; fi';
+
+ system("/bin/mkdir -p \"$report_dir/info\"")
+ and die "$0: unable to mkdir `$report_dir/info'\n";
+
+ foreach my $pkg (@packages) {
my @steps;
+
+ $_ = "\"\$DIR/src/$pkg->{'name'}\"";
+ push @steps, {
+ 'cmd' => "( /bin/chmod -fR u+w $_; /bin/rm -rf $_; ) 2> /dev/null; " .
+ "/bin/mkdir -p $_",
+ 'dir' => "echo $_"
+ };
+
+ foreach (@hosts) {
+ my $dir = "$report_dir/$pkg->{'name'}/$_->{'name'}";
+ system("/bin/mkdir -p \"$dir\"")
+ and die "$0: unable to mkdir `$dir'\n";
+ }
+
$_ = $pkg->{'url'};
- if (m|^http://.*/([^/]+)/?$|
- or m|^ftp://.*/([^/]+)/?$|) {
+ if (m|^http://.*/([^/]+)/?$| or m|^ftp://.*/([^/]+)/?$|) {
$_ = "file://$1";
push @steps, {
'name' => 'download',
@@ -498,17 +511,14 @@
};
}
- if (m|^file://(.*)$| and -d $1 and /^([^\/]*)\/(.*)$/) {
- my $dir = $1;
- $pkg->{'dir'} = $2;
-
+ if (m|^file://(.*)$| and -d $1 and m/^([^\/]*)\/(.*)$/) {
push @steps, {
'name' => 'copy',
- 'cmd' => "cp -r \"$dir\" ."
+ 'cmd' => "scp -r \"$1\" .",
+ 'dir' => "echo \"$2\""
}, {
- 'dir' => "echo \"$pkg->{'dir'}\"",
'name' => 'bootstrap',
- 'cmd' => "./bootstrap"
+ 'cmd' => $bootstrap
};
} elsif (m|^file://(.*)$|) {
@@ -517,169 +527,183 @@
$c = "z" if m/\.tar\.gz$/;
$c = "j" if m/\.tar\.bz2$/;
- $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",
+ 'cmd' => "tar -x${c}vf \"$file\"",
+ 'dir' => "echo \"\$DIR/src/$pkg->{'name'}/`tar -t${c}f \"$file\" | " .
+ "head -n 1 | cut -d '/' -f 1`\""
};
}
} elsif (m|^svn://(.*/([^/]+))/?$|) {
- my $repository = "https://$1";
- $pkg->{'dir'} = $2;
-
push @steps, {
'name' => 'checkout',
- 'cmd' => "svn checkout \"$repository\""
+ 'cmd' => "svn checkout \"https://$1\"",
+ 'dir' => "echo \"\$DIR/src/$pkg->{'name'}/$2\""
}, {
- 'dir' => "echo \"$pkg->{'dir'}\"",
'name' => 'bootstrap',
- 'cmd' => '(./bootstrap || ./bootstrap.sh || autoreconf -fvi)'
+ 'cmd' => $bootstrap
};
} elsif (m|^prcs://(.*)$|) {
- $pkg->{'dir'} = $1;
-
push @steps, {
- 'dir' => "echo \"$1\"",
+ 'cmd' => "/bin/mkdir \"\$DIR/src/$pkg->{'name'}/$1\"",
+ 'dir' => "echo \"\$DIR/src/$pkg->{'name'}/$1\""
+ }, {
'name' => 'checkout',
- 'cmd' => "prcs checkout \"$1\""
+ 'cmd' => "prcs checkout -f \"$1\""
}, {
'name' => 'bootstrap',
- 'cmd' => '(./bootstrap || ./bootstrap.sh || autoreconf -fvi)'
+ 'cmd' => $bootstrap
};
} 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("$build_dir/$pkg->{'name'}");
- &create_dir($dir);
-
- if (defined $pkg->{'dif'}) {
+ if (defined $pkg->{'diff'}) {
my $bootstrap;
$bootstrap = pop @steps if $steps[-1]->{'name'} eq 'bootstrap';
push @steps, {
'name' => 'patch',
- 'cmd' => "patch -p0 -t -i \"$pkg->{'dif'}\""
+ 'cmd' => "patch -p0 -t -i \"$pkg->{'diff'}\""
};
- if (defined $bootstrap) {
- if (defined $bootstrap->{'dir'}) {
- $steps[-1]->{'dir'} = $bootstrap->{'dir'};
- undef $bootstrap->{'dir'};
- }
- push @steps, $bootstrap;
- }
+ push @steps, $bootstrap if defined $bootstrap;
}
- my $cpu = '';
- $cpu = " -j $pkg->{'cpu'}" if defined $pkg->{'cpu'};
+ my $prefix = "\"\$DIR/usr/$pkg->{'name'}\"";
push @steps, {
'name' => 'configure',
- 'cmd' => "./configure --prefix=$inst_dir/$pkg->{'name'} $pkg->{'cfg'}"
+ 'cmd' => "./configure --prefix=$prefix $pkg->{'cfg'}"
}, {
- 'name' => 'build', 'cmd' => "make$cpu"
+ 'name' => 'build',
+ 'cmd' => '$MAKE'
};
+ push @steps, {
+ 'name' => 'check',
+ 'cmd' => '$MAKE check'
+ } unless $pkg->{'opt'} =~ m/\bno-check\b/;
+
my $dcf = '';
defined $pkg->{'cfg'} and $pkg->{'cfg'} ne ''
and $dcf = "DISTCHECK_CONFIGURE_FLAGS=\"$pkg->{'cfg'}\" ";
push @steps, {
- 'name' => 'check',
- 'cmd' => "make$cpu -k check"
- }, {
'name' => 'distcheck',
- 'cmd' => "make$cpu -k ${dcf}distcheck"
+ 'cmd' => "\$MAKE ${dcf}distcheck"
} unless $pkg->{'opt'} =~ m/\bno-check\b/;
push @steps, {
- 'rm' => "$inst_dir/$pkg->{'name'}",
+ 'cmd' => "( /bin/chmod -fR u+w $prefix; /bin/rm -rf $prefix; ) " .
+ "2>/dev/null; :"
+ }, {
'name' => 'install',
- 'cmd' => 'make install'
+ 'cmd' => '$MAKE install'
+ };
+
+ $_ = "\"\$DIR/src/$pkg->{'name'}\"";
+ push @steps, {
+ 'cmd' => "/bin/chmod -fR u+w $_; cd / && /bin/rm -rf $_"
};
$pkg->{'steps'} = \@steps;
- next if &check_revision($pkg);
- &gen_pkg_report($pkg) unless -f "$dir/index.html";
}
}
sub build_pkg {
- my $pkg = shift;
- my %env = %ENV;
+ my ($pkg, $host) = @_;
+ my $st;
- 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;
+ foreach my $step (@{$pkg->{'steps'}}) {
+ &set_status($pkg, "running", $step);
+ unless (&run($pkg, $step)) {
+ &set_status($pkg, $st = "failed", $step);
+ last;
+ }
+ if (defined $step->{'dir'}) {
+ my $cmd = "cd \"$pkg->{'wd'}\" && ( $step->{'dir'}; )";
+ $cmd =~ s/\$DIR/$pkg->{'host'}->{'dir'}/g;
+ &execute($pkg->{'host'}, $cmd, ".$$.out");
+ chomp($pkg->{'wd'} = `cat .$$.out; rm -f .$$.out`);
}
+ &set_status($pkg, $st = "succeeded", $step);
}
+ &set_status($pkg, $st);
+ return $st;
}
- my $st;
- my $dir = "$build_dir/$pkg->{'name'}";
- &delete_dir($dir);
- &create_dir($dir);
- &ch_dir($dir);
- $pkg->{'time_started'} = time;
+sub run {
+ my ($pkg, $step) = @_;
- 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;
+ my $env = '';
+ if (defined $pkg->{'env'}) {
+ $pkg->{'env'} =~ s/^\s*(.*?)\s*$/$1/;
+ foreach (split /\s+/, $pkg->{'env'}) {
+ $env .= "$1 " if m/^(\w+)=/;
}
- $step->{'status'} = $st = "failed";
- last;
+ $env = "$pkg->{'env'} && export $env && ";
}
- $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);
- foreach ('rev', 'time', 'status') {
- system("echo \"$pkg->{$_}\" > \"$build_dir/$pkg->{'name'}/.$_\"");
+ my $cmd = "${env}cd \"$pkg->{'wd'}\" && ( $step->{'cmd'}; )";
+
+ foreach ('dir', 'make') {
+ $cmd =~ s/\$\U$_/$pkg->{'host'}->{$_}/g;
+ $step->{'cmd'} =~ s/\$\U$_/$pkg->{'host'}->{$_}/g;
+ }
+
+ unless (defined $step->{'name'}) {
+ &execute($pkg->{'host'}, $cmd, ".$$.out")
+ and die "$0: unable to execute `$cmd' on $pkg->{'host'}->{'name'}\n";
+ unlink ".$$.out";
+ return 1;
+ }
+
+ my $status = $step->{'name'};
+ my $out = "$report_dir/$pkg->{'name'}/$pkg->{'host'}->{'name'}/$status";
+ &set_status($pkg, $status) unless $status eq 'unnamed';
+ &gen_log_page($pkg, $step);
+ my $r = &execute($pkg->{'host'}, $cmd, "$out.log");
+ &gen_log_page($pkg, $step, "$out.log");
+ return undef if $r;
+ return 1;
}
- &delete_dir("$pkg->{'name'}/$pkg->{'dir'}") if ($st eq "succeeded")
- and ($pkg->{'opt'} =~ m/\brm-build-dir\b/);
+
+sub execute {
+ my ($host, $cmd, $out) = @_;
+
+ unlink $out;
+ my $h = $host->{'addr'};
+ $h = "$host->{'user'}\@$h" if defined $host->{'user'};
+ my $c = &xopen(">.$$");
+ print $c "rm -f \$0\n$cmd\n";
+ &xclose($c);
+ return system("scp -q .$$ $h:.$host->{'name'}.cmd && rm -f .$$ &&
+ ssh $h sh .$host->{'name'}.cmd > $out 2>&1");
}
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";
+ print <<EOF;
+auto-build (Auto Build System) $VERSION
+Written by Clement Vasseur and Nicolas Pouillard.
+
+Copyright (C) 2004 LRDE - EPITA Research and Development Laboratory.
+This is free software; see the source for copying conditions. There is NO
+warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+EOF
exit 0;
}
-sub print_css {
+sub gen_css {
+ if (defined $css) {
+ ©($css, "$report_dir/style.css")
+ or die "$0: unable to copy `$css' to `$report_dir/style.css': $!\n";
+ return;
+ }
+
my $CSS = &xopen(">$report_dir/style.css");
print $CSS <<CSS;
body {
@@ -687,13 +711,12 @@
background-color: #EEEEEE;
font-family: Verdana, Helvetica, sans-serif;
}
-
h1,h2,h3,h4,h5,h6 {
font-family: Verdana, Helvetica, sans-serif;
color: #003377;
}
-
.left { text-align: left; }
+.mach { font-size: xx-small; color: #003377; font-weight: bold; }
table { margin-left:auto; margin-right:auto; }
h1,h4 { text-align: center; background-color: #CCCCFF; }
h3 { text-align: left; text-indent: 1em }
@@ -702,11 +725,11 @@
pre { text-align: left; font-family: Courier, monospace; }
tr { text-indent: 0em; text-align: center; }
td { text-indent: 0em; font-family: Verdana, Helvetica, sans-serif; }
-tr.body { background-color: #E5E5E5; }
-td.time { color: gray }
-td.st_succeeded { color: green }
-td.st_failed { color: red }
-td.st_skipped { color: gray }
+tr.body { background-color: #E5E5E5 }
+.st_succeeded { color: green }
+.st_failed { color: red }
+.st_skipped { color: gray }
+.st_na { color: gray }
CSS
&xclose($CSS);
}
Index: auto-build/packages.list
--- auto-build/packages.list (revision 112)
+++ auto-build/packages.list (working copy)
@@ -1,27 +1,72 @@
### Auto Build System #########################################################
# report directory
-/mnt/ghost/stud/vasseu_c/www/build
-
-# build directory
-/work/auto-build/src
-
-# inst directory
-/work/auto-build/usr
+/mnt/ghost/lrde-2005/vasseu_c/www/build/current
### Color highlighting ########################################################
-color red "^make.*: \*\*\* .*$"
+color red "^g?make.*: \*\*\* .*$"
color red "^SdfChecker:error:.*$"
+color red "^ERROR:.*$"
color maroon "^warning:.*$"
color maroon "^SdfChecker:warning:.*$"
-color maroon "^[\w\/\.]+:\d+: [Ww]arning:.*$"
-color red "^[\w\/\.]+: In .*$"
-color gray "^make.*:.*$"
+color maroon "^[\w\/\.-]+:\d+: [Ww]arning:.*$"
+color red "^[\w\/\.-]+:\d+: error:.*$"
+color red "^/bin/bash:.*$"
+color gray "^g?make.*:.*$"
color green "^PASS:"
color blue "^XPASS:"
color red "^FAIL:"
+### Hosts #####################################################################
+
+host "caracas"
+
+ addr: caracas.lrde.epita.fr
+ dir: /work/auto-build
+
+#------------------------------------------------------------------------------
+
+host "ustaritz"
+
+ addr: ustaritz.lrde.epita.fr
+ dir: /tmp/auto-build
+ make: gmake
+ env: CXX=g++34
+
+#------------------------------------------------------------------------------
+
+host "woods-hole"
+
+ addr: woods-hole.lrde.epita.fr
+ dir: /tmp/auto-build
+ env: CPPFLAGS="-I$HOME/darwin/include" LDFLAGS="-L$HOME/darwin/lib"
+
+#------------------------------------------------------------------------------
+
+host "jussieu"
+
+ addr: jussieu.epita.fr
+ user: vasseu_c
+ dir: /goinfre/lrde-auto-build
+ make: gmake
+ env: CPPFLAGS="-I$HOME/usr/include" LDFLAGS="-L$HOME/usr/lib"
+
+#------------------------------------------------------------------------------
+
+host "maya"
+
+ addr: maya.epita.fr
+ user: vasseu_c
+ dir: /goinfre/lrde-auto-build
+ make: gmake
+ env: CPPFLAGS="-I$HOME/sun/include" LDFLAGS="-L$HOME/sun/lib"
+
+### Information about software versions #######################################
+
+info make gcc g++ bison python automake autoconf libtool \
+ doxygen gmake g++34 tar awk icpc
+
### Tiger #####################################################################
section "Tiger"
@@ -31,7 +76,6 @@
havm
url: svn://svn.lrde.epita.fr/svn/havm/trunk
- dif: /home/lrde/lrde-2005/vasseu_c/havm.diff
#------------------------------------------------------------------------------
@@ -39,11 +83,40 @@
url: svn://svn.lrde.epita.fr/svn/nolimips/trunk
+#------------------------------------------------------------------------------
+
+tc
+
+ url: svn://svn.lrde.epita.fr/svn-lrde/tc/trunk
+ hosts: caracas ustaritz woods-hole
+
### StrategoXT ################################################################
-aterm = /home/lrde/lrde/usr/Aterm
-sdf = /home/lrde/lrde/usr/Sdf
-strategoxt = /home/lrde/lrde/usr/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: ftp://ftp.stratego-language.org/pub/stratego/StrategoXT/strategoxt-0.12.tar…
+ cfg: --with-aterm=${aterm}\
+ --with-sdf=${sdf}
+ opt: no-check
### Transformers ##############################################################
@@ -127,14 +200,14 @@
--with-sdf-astgen=${sdf-astgen}\
--with-sdf-attribute=${sdf-attribute}\
--with-esdf=${esdf}
- env: PATH="/mnt/daily/usr/stratego-shell/bin:${strategoxt}/bin:$PATH"
+ env: PATH="${strategoxt}/bin:$PATH"
+ hosts: caracas ustaritz jussieu maya
#------------------------------------------------------------------------------
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}\
@@ -180,9 +253,16 @@
olena
url: prcs://oln
- cpu: 2
- env: PRCS_REPOSITORY="/home/lrde/admin/prcs/repository",\
- CXX="g++-3.4"
+ env: PRCS_REPOSITORY="/home/lrde/admin/prcs/repository"
+ hosts: caracas ustaritz woods-hole
+
+#------------------------------------------------------------------------------
+
+olena-icc
+
+ url: prcs://oln
+ env: PRCS_REPOSITORY="/home/lrde/admin/prcs/repository" CXX="icpc"
+ hosts: caracas
### Vaucanson #################################################################
@@ -193,8 +273,13 @@
vaucanson
url: svn://svn.lrde.epita.fr/svn/vaucanson/trunk
- cpu: 2
- env: PATH="/home/lrde/lrde-2005/vasseu_c/usr/bin/old:$PATH",\
- CXX="g++-3.3"
+
+#------------------------------------------------------------------------------
+
+vaucanson-icc
+
+ url: svn://svn.lrde.epita.fr/svn/vaucanson/trunk
+ env: CXX="icpc"
+ hosts: caracas
#------------------------------------------------------------------------------
1
0
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* configure.ac:
Check isblank presence.
* src/shell/shell.hh, src/shell/shell.cc:
Provide isblank when the platform lack it.
2004-10-25 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: src/shell/shell.hh
--- src/shell/shell.hh (revision 142)
+++ src/shell/shell.hh (revision 143)
@@ -23,6 +23,8 @@
#ifndef SHELL_SHELL_HH
# define SHELL_SHELL_HH
+# include "config.h"
+
# include <ctype.h>
# include <list>
@@ -41,6 +43,10 @@
# include "vm/virtual_machine.hh"
# include "shell/cmd.hh"
+# ifndef HAVE_ISBLANK
+bool isblank(int c);
+# endif // !HAVE_ISBLANK
+
namespace shell
{
/// Token word value.
Index: src/shell/shell.cc
--- src/shell/shell.cc (revision 142)
+++ src/shell/shell.cc (revision 143)
@@ -26,6 +26,14 @@
#include "shell/shell.hh"
#include "shell/cmd.hh"
+#ifndef HAVE_ISBLANK
+bool
+isblank(int c)
+{
+ return (c == ' ' || c == '\t');
+}
+#endif // !HAVE_ISBLANK
+
namespace shell
{
Index: configure.ac
--- configure.ac (revision 142)
+++ configure.ac (revision 143)
@@ -36,6 +36,10 @@
# Look for readline library.
AC_CHECK_READLINE
+# Check presence of isblank
+AC_CHECK_FUNCS(isblank)
+
+
## Development environment -------------
CXXFLAGS="${CXXFLAGS} -ansi -Wall -W -D__STDC_LIMIT_MACROS"
1
0
Index: ChangeLog
from Benoît Perrot <benoit(a)lrde.epita.fr>
* src/vm/cpu.cc:
Effectively use Cpu::register_type, and not system's register_t.
cpu.cc did not compile on SunOS, where register_t is not defined.
2004-10-25 Benoît Perrot <benoit(a)lrde.epita.fr>
Index: src/vm/cpu.cc
--- src/vm/cpu.cc (revision 141)
+++ src/vm/cpu.cc (revision 142)
@@ -127,10 +127,10 @@
void
Cpu::visit(const inst::Add& add)
{
- register_t a = get_register(add.get_src1 ());
- register_t b = get_register(add.get_src2 ());
+ register_type a = get_register(add.get_src1 ());
+ register_type b = get_register(add.get_src2 ());
- register_t c = a + b;
+ register_type c = a + b;
set_register(add.get_dest (), c);
// FIXME: might be accelerated by testing only the sign bit.
@@ -141,10 +141,10 @@
void
Cpu::visit(const inst::Addi& addi)
{
- register_t a = get_register(addi.get_src ());
+ register_type a = get_register(addi.get_src ());
int b = addi.get_imm ();
- register_t c = a + b;
+ register_type c = a + b;
set_register(addi.get_dest (), c);
// FIXME: might be accelerated by testing only the sign bit.
@@ -169,10 +169,10 @@
void
Cpu::visit(const inst::Sub& sub)
{
- register_t a = get_register(sub.get_src1 ());
- register_t b = get_register(sub.get_src2 ());
+ register_type a = get_register(sub.get_src1 ());
+ register_type b = get_register(sub.get_src2 ());
- register_t c = a - b;
+ register_type c = a - b;
set_register(sub.get_dest (), c);
if ((a < b && c > 0) || (a > b && c < 0))
1
0