build-tool 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +3 -0
- data/History.txt +7 -0
- data/Manifest.txt +51 -0
- data/PostInstall.txt +3 -0
- data/README.rdoc +55 -0
- data/Rakefile +30 -0
- data/TODO +2 -0
- data/bin/kde-build.rb +21 -0
- data/config/website.yml +2 -0
- data/config/website.yml.sample +2 -0
- data/lib/kde-build.rb +18 -0
- data/lib/kde-build/application.rb +258 -0
- data/lib/kde-build/build_system.rb +26 -0
- data/lib/kde-build/build_system/autoconf.rb +109 -0
- data/lib/kde-build/build_system/base.rb +132 -0
- data/lib/kde-build/build_system/cmake.rb +82 -0
- data/lib/kde-build/build_system/qtcopy.rb +125 -0
- data/lib/kde-build/command.rb +30 -0
- data/lib/kde-build/command/build.rb +119 -0
- data/lib/kde-build/command/fetch.rb +28 -0
- data/lib/kde-build/command/help.rb +71 -0
- data/lib/kde-build/command/info.rb +42 -0
- data/lib/kde-build/command/version.rb +43 -0
- data/lib/kde-build/configuration.rb +186 -0
- data/lib/kde-build/exception.rb +6 -0
- data/lib/kde-build/metaaid.rb +18 -0
- data/lib/kde-build/module.rb +203 -0
- data/lib/kde-build/module_configuration.rb +107 -0
- data/lib/kde-build/moduleregistry.rb +85 -0
- data/lib/kde-build/subprocess.rb +82 -0
- data/lib/kde-build/tools/ctags.rb +34 -0
- data/lib/kde-build/tools/logging.rb +49 -0
- data/lib/kde-build/tools/make.rb +58 -0
- data/lib/kde-build/tools/ssh.rb +47 -0
- data/lib/kde-build/vcs.rb +26 -0
- data/lib/kde-build/vcs/base.rb +81 -0
- data/lib/kde-build/vcs/git-svn.rb +133 -0
- data/lib/kde-build/vcs/git.rb +96 -0
- data/lib/kde-build/vcs/svn.rb +105 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +71 -0
- data/test.yaml.tmpl +552 -0
- data/test/test_helper.rb +12 -0
- data/test/test_kde-build.rb +11 -0
- data/test/test_vcs_svn.rb +44 -0
- data/website/index.html +84 -0
- data/website/index.txt +59 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +159 -0
- data/website/template.html.erb +50 -0
- metadata +171 -0
- metadata.gz.sig +0 -0
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'kde-build/configuration'
|
2
|
+
require 'kde-build/subprocess'
|
3
|
+
|
4
|
+
require 'singleton'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
module BuildTool
|
8
|
+
|
9
|
+
class CTagsConfiguration
|
10
|
+
|
11
|
+
include MJ::Configuration::Configurable
|
12
|
+
|
13
|
+
include Singleton
|
14
|
+
|
15
|
+
option( "executable", "Full path for to the executable" )
|
16
|
+
option( "options", "" )
|
17
|
+
|
18
|
+
def initialize
|
19
|
+
@executable = "ctags"
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
YAML.add_domain_type(
|
25
|
+
"michael-jansen.biz,2009", "CTagsConfiguration" ) {
|
26
|
+
|type, val|
|
27
|
+
cc = CTagsConfiguration.instance
|
28
|
+
MJ::Configuration::flatten_values val do
|
29
|
+
|k, v|
|
30
|
+
cc.set( k, v )
|
31
|
+
end
|
32
|
+
}
|
33
|
+
|
34
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
|
3
|
+
class Object
|
4
|
+
|
5
|
+
def while_logging_to( dir, fname, &block )
|
6
|
+
if logdir = BuildTool::Application::instance.log_directory
|
7
|
+
dirname = "#{logdir}/#{dir}"
|
8
|
+
FileUtils.mkdir_p( dirname )
|
9
|
+
with_warnings_suppressed do
|
10
|
+
$log.add( FileOutputter.new( fname, :filename => "#{dirname}/#{fname}", :level => DEBUG ) )
|
11
|
+
Outputter[fname].formatter = BuildTool::CmdFormatter.new
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
begin
|
16
|
+
yield
|
17
|
+
rescue Exception => e
|
18
|
+
$log.info("More information in #{dirname}/#{fname}")
|
19
|
+
raise e
|
20
|
+
ensure
|
21
|
+
if logdir
|
22
|
+
with_warnings_suppressed do
|
23
|
+
$log.remove( fname )
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
module BuildTool
|
32
|
+
|
33
|
+
class PlainFormatter < Log4r::Formatter
|
34
|
+
def format(event)
|
35
|
+
sprintf("%s\n", event.data)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class CmdFormatter < Log4r::Formatter
|
40
|
+
def format(event)
|
41
|
+
if event.level != CMDOUT
|
42
|
+
sprintf("%*s %s> %s\n", MaxLevelLength, LNAMES[event.level],
|
43
|
+
event.name, event.data)
|
44
|
+
else
|
45
|
+
sprintf("%s\n", event.data)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'kde-build/configuration.rb'
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
require 'singleton'
|
5
|
+
|
6
|
+
module BuildTool
|
7
|
+
|
8
|
+
class MakeConfiguration
|
9
|
+
|
10
|
+
include Singleton
|
11
|
+
|
12
|
+
include MJ::Configuration::Configurable
|
13
|
+
|
14
|
+
option( "executable", "Full path for to the executable" ).
|
15
|
+
required
|
16
|
+
option( "options", "TODO" )
|
17
|
+
option( "cxxflags", "TODO" )
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
self.executable = "make"
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
class Make
|
27
|
+
|
28
|
+
include MJ::Tools::SubProcess
|
29
|
+
|
30
|
+
def make( command, wd = build_directory )
|
31
|
+
self.class.execute "#{executable} #{cxxflags} #{options} #{command}", wd
|
32
|
+
end
|
33
|
+
|
34
|
+
def options
|
35
|
+
MakeConfiguration.instance.options
|
36
|
+
end
|
37
|
+
|
38
|
+
def cxxflags
|
39
|
+
MakeConfiguration.instance.cxxflags
|
40
|
+
end
|
41
|
+
|
42
|
+
def executable
|
43
|
+
MakeConfiguration.instance.executable
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
YAML.add_domain_type(
|
49
|
+
"michael-jansen.biz,2009", "MakeConfiguration" ) {
|
50
|
+
|type, val|
|
51
|
+
mc = MakeConfiguration.instance
|
52
|
+
MJ::Configuration::flatten_values val do
|
53
|
+
|k, v|
|
54
|
+
mc.set( k, v )
|
55
|
+
end
|
56
|
+
}
|
57
|
+
|
58
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'kde-build/subprocess'
|
2
|
+
|
3
|
+
module MJ; module Tools
|
4
|
+
|
5
|
+
class SSH
|
6
|
+
|
7
|
+
include MJ::Tools::SubProcess
|
8
|
+
|
9
|
+
def add_key( key_file )
|
10
|
+
ssh_add( "#{key_file}" )
|
11
|
+
end
|
12
|
+
|
13
|
+
def has_key?( key )
|
14
|
+
found = false
|
15
|
+
ssh_add '-l' do
|
16
|
+
|line|
|
17
|
+
if line.index(key) == 0
|
18
|
+
return found = true
|
19
|
+
end
|
20
|
+
end
|
21
|
+
return found
|
22
|
+
end
|
23
|
+
|
24
|
+
def remove_key( key_file )
|
25
|
+
ssh_add( "-d #{key_file}" )
|
26
|
+
end
|
27
|
+
|
28
|
+
def remove_all_keys
|
29
|
+
ssh_add( "-D" )
|
30
|
+
end
|
31
|
+
|
32
|
+
def list_keys
|
33
|
+
ssh_add( "-l" )
|
34
|
+
end
|
35
|
+
|
36
|
+
def ssh_add( command, &block )
|
37
|
+
if block_given?
|
38
|
+
self.class.execute "ssh-add #{command}", &block
|
39
|
+
else
|
40
|
+
self.class.execute "ssh-add #{command}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end; end
|
47
|
+
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'kde-build/vcs/git'
|
2
|
+
require 'kde-build/vcs/git-svn'
|
3
|
+
require 'kde-build/vcs/svn'
|
4
|
+
|
5
|
+
module BuildTool; module VCS
|
6
|
+
|
7
|
+
@mapping = {
|
8
|
+
'git-svn' => GitSVN,
|
9
|
+
'git' => Git,
|
10
|
+
'svn' => SVN
|
11
|
+
}
|
12
|
+
|
13
|
+
module_function
|
14
|
+
|
15
|
+
def available
|
16
|
+
@mapping.keys
|
17
|
+
end
|
18
|
+
|
19
|
+
def get( name )
|
20
|
+
if !available.include? name
|
21
|
+
throw :todo
|
22
|
+
end
|
23
|
+
@mapping[name]
|
24
|
+
end
|
25
|
+
|
26
|
+
end; end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'kde-build/configuration'
|
2
|
+
require 'kde-build/subprocess'
|
3
|
+
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module BuildTool; module VCS
|
7
|
+
|
8
|
+
class BuildToolError < Exception; end
|
9
|
+
|
10
|
+
|
11
|
+
class BaseConfiguration
|
12
|
+
|
13
|
+
include MJ::Configuration::Configurable
|
14
|
+
|
15
|
+
option( 'name', "Name" )
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
# Base class for all version control system implementations.
|
21
|
+
#
|
22
|
+
# This class is abstract. Most method just raise NotImplementedError
|
23
|
+
# exceptions.
|
24
|
+
class Base
|
25
|
+
|
26
|
+
include MJ::Tools::SubProcess
|
27
|
+
|
28
|
+
attr_accessor :repository, :path
|
29
|
+
attr_accessor :configuration
|
30
|
+
|
31
|
+
|
32
|
+
# Creates a new vcs module. Stores +repository+ and +path+
|
33
|
+
def initialize( repository, path = nil)
|
34
|
+
@repository = repository
|
35
|
+
@path = path
|
36
|
+
end
|
37
|
+
|
38
|
+
# Check if the local checkout exists.
|
39
|
+
#
|
40
|
+
# This method only checks it the local checkout path exists and is
|
41
|
+
# a directory
|
42
|
+
def checkedout?
|
43
|
+
return ( File.exist?( self.path ) and File.directory?( path ) )
|
44
|
+
end
|
45
|
+
|
46
|
+
# Fetch the changes from the remote repository without changing
|
47
|
+
# code locally
|
48
|
+
#
|
49
|
+
# raises NotImplementedError
|
50
|
+
def fetch
|
51
|
+
raise NotImplementedError, "Base::fetch in #{self.class}"
|
52
|
+
end
|
53
|
+
|
54
|
+
# Initialize the local checkout
|
55
|
+
#
|
56
|
+
# raises NotImplementedError
|
57
|
+
def init
|
58
|
+
raise NotImplementedError, "Base::init in #{self.class}"
|
59
|
+
end
|
60
|
+
|
61
|
+
# Return the name for this version control system
|
62
|
+
#
|
63
|
+
# raises NotImplementedError
|
64
|
+
def name
|
65
|
+
raise NotImplementedError, "Base::name in #{self.class}"
|
66
|
+
end
|
67
|
+
|
68
|
+
# Rebase the local branch with the remote changes
|
69
|
+
#
|
70
|
+
# raises NotImplementedError
|
71
|
+
def rebase
|
72
|
+
raise NotImplementedError, "Base::rebase in #{self.class}"
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.config
|
76
|
+
raise NotImplementedError, "Base::config in #{self}"
|
77
|
+
end
|
78
|
+
|
79
|
+
end
|
80
|
+
|
81
|
+
end; end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
require 'kde-build/vcs/base'
|
4
|
+
|
5
|
+
module BuildTool; module VCS
|
6
|
+
|
7
|
+
|
8
|
+
class GitSvnConfiguration < BaseConfiguration
|
9
|
+
|
10
|
+
option( "externals", "List of externals to fetch" ).
|
11
|
+
on_write {
|
12
|
+
|val|
|
13
|
+
if val.instance_of?( Array )
|
14
|
+
a = val.inject([]) {
|
15
|
+
|arr, v|
|
16
|
+
v.each_pair {
|
17
|
+
|val, key|
|
18
|
+
arr << val << key
|
19
|
+
}
|
20
|
+
arr
|
21
|
+
}
|
22
|
+
val = Hash[*a]
|
23
|
+
else
|
24
|
+
throw :todo
|
25
|
+
end
|
26
|
+
val
|
27
|
+
}
|
28
|
+
|
29
|
+
|
30
|
+
def initialize
|
31
|
+
super
|
32
|
+
self.name = "git-svn"
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
# Git-SVN Error
|
38
|
+
class GitSvnError < BuildToolError
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
# Implementation for the git-svn version control system
|
43
|
+
# (http://git-scm.org)
|
44
|
+
class GitSVN < Base
|
45
|
+
|
46
|
+
def initialize( repository, path )
|
47
|
+
super repository, path
|
48
|
+
end
|
49
|
+
|
50
|
+
# Check if the local checkout exists.
|
51
|
+
#
|
52
|
+
# calls VCS::Base::checkedout? and checks if there is a '.git'
|
53
|
+
# directory at +path+
|
54
|
+
def checkedout?
|
55
|
+
return false if !super
|
56
|
+
if !File.exists? "#{path}/.git"
|
57
|
+
$log.debug("Checkout path #{path} is not a git repo")
|
58
|
+
return false
|
59
|
+
end
|
60
|
+
return true
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.config
|
64
|
+
GitSvnConfiguration
|
65
|
+
end
|
66
|
+
|
67
|
+
# Execute a git command in the context of the local git repository
|
68
|
+
def git_svn( command, wd = path )
|
69
|
+
self.class.execute "git svn #{command}", wd
|
70
|
+
end
|
71
|
+
|
72
|
+
# Fetch from +repository+
|
73
|
+
#
|
74
|
+
# Initializes the local clone if it does not exist.
|
75
|
+
def fetch( revision = nil )
|
76
|
+
if !checkedout? and !$noop
|
77
|
+
init
|
78
|
+
end
|
79
|
+
if revision
|
80
|
+
cmd = "fetch -r#{revision}"
|
81
|
+
else
|
82
|
+
cmd = "fetch"
|
83
|
+
end
|
84
|
+
if ( rc = git_svn( cmd ) ) != 0
|
85
|
+
raise GitSvnError, "Error while fetching: #{rc}"
|
86
|
+
end
|
87
|
+
update_externals
|
88
|
+
end
|
89
|
+
|
90
|
+
# Initialize the local repository
|
91
|
+
def init( revision = nil )
|
92
|
+
# Check if path exists
|
93
|
+
if File.exists? path
|
94
|
+
raise GitSvnError, "Failed to create repository at '#{path}': Path exists"
|
95
|
+
end
|
96
|
+
# Make sure we have a revision
|
97
|
+
if !revision
|
98
|
+
revision = SVN.new( repository ).last_changed_rev
|
99
|
+
end
|
100
|
+
if !revision or revision == 0
|
101
|
+
raise GitSvnError, "Failed to retrieve revision to clone from '#{repository}'"
|
102
|
+
end
|
103
|
+
# Create the directory
|
104
|
+
FileUtils.mkdir_p( path ) if !$noop
|
105
|
+
# Init the repository
|
106
|
+
if !git_svn "init #{repository}"
|
107
|
+
raise GitSvnError, "Error while initializing the repo `git svn init '#{repository}'`: #{$?}"
|
108
|
+
end
|
109
|
+
fetch( revision )
|
110
|
+
update_externals
|
111
|
+
end
|
112
|
+
|
113
|
+
# Returns Git-SVN
|
114
|
+
def name
|
115
|
+
"Git-SVN"
|
116
|
+
end
|
117
|
+
|
118
|
+
def rebase
|
119
|
+
return git_svn "rebase -l master"
|
120
|
+
end
|
121
|
+
|
122
|
+
def update_externals
|
123
|
+
return if !configuration.externals
|
124
|
+
configuration.externals.each do |local, remote|
|
125
|
+
SVN::svn( "checkout #{remote}@HEAD #{local}", wd = path )
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
end
|
130
|
+
|
131
|
+
|
132
|
+
end; end
|
133
|
+
|
@@ -0,0 +1,96 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
#
|
3
|
+
# git-svn.rb - GIT-SVN VCS Implementation
|
4
|
+
#
|
5
|
+
#
|
6
|
+
# == Overview
|
7
|
+
#
|
8
|
+
# bla bla
|
9
|
+
#
|
10
|
+
require 'kde-build/vcs/base'
|
11
|
+
|
12
|
+
module BuildTool; module VCS
|
13
|
+
|
14
|
+
class GitConfiguration < BaseConfiguration
|
15
|
+
|
16
|
+
def initialize
|
17
|
+
super
|
18
|
+
self.name = "git"
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
# Implementation for the git-svn version control system
|
25
|
+
# (http://git-scm.org)
|
26
|
+
class Git < Base
|
27
|
+
|
28
|
+
def initialize( repository, path )
|
29
|
+
super
|
30
|
+
end
|
31
|
+
|
32
|
+
def name
|
33
|
+
"GIT"
|
34
|
+
end
|
35
|
+
|
36
|
+
def git( command, wd = path )
|
37
|
+
self.class.execute "git #{command}", wd
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.config
|
41
|
+
GitConfiguration
|
42
|
+
end
|
43
|
+
|
44
|
+
# Check if the local checkout exists.
|
45
|
+
#
|
46
|
+
# calls VCS::Base::checkedout? and checks if there is a '.git'
|
47
|
+
# directory at +path+
|
48
|
+
def checkedout?
|
49
|
+
return false if !super
|
50
|
+
if !File.exists? "#{path}/.git"
|
51
|
+
$log.debug("Checkout path #{path} is not a git repo")
|
52
|
+
return false
|
53
|
+
end
|
54
|
+
return true
|
55
|
+
end
|
56
|
+
|
57
|
+
# Fetch from +repository+
|
58
|
+
#
|
59
|
+
# Initializes the local clone if it does not exist.
|
60
|
+
def fetch()
|
61
|
+
if !checkedout? and !$noop
|
62
|
+
init
|
63
|
+
end
|
64
|
+
cmd = "fetch"
|
65
|
+
if ( rc = git( cmd ) ) != 0
|
66
|
+
raise GitError, "Error while fetching: #{rc}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
# Initialize the local repository
|
72
|
+
def init
|
73
|
+
# Check if path exists
|
74
|
+
if File.exists? path
|
75
|
+
raise GitSvnError, "Failed to create repository at '#{path}': Path exists"
|
76
|
+
end
|
77
|
+
|
78
|
+
# Create the directory
|
79
|
+
FileUtils.mkdir_p( File.split(path)[0] ) if !$noop
|
80
|
+
|
81
|
+
# Init the repository
|
82
|
+
if !git( "clone #{repository} #{path}", File.split(path)[0] )
|
83
|
+
raise GitError, "Error while initializing the repo `git clone '#{repository} #{path}'`: #{$?}"
|
84
|
+
end
|
85
|
+
fetch()
|
86
|
+
end
|
87
|
+
|
88
|
+
def rebase
|
89
|
+
return git "rebase origin"
|
90
|
+
end
|
91
|
+
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
end
|
96
|
+
end
|