build-tool 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. data.tar.gz.sig +0 -0
  2. data/History.txt +28 -1
  3. data/Manifest.txt +91 -52
  4. data/README.txt +63 -0
  5. data/Rakefile +20 -23
  6. data/bin/build-tool +53 -0
  7. data/lib/build-tool.rb +7 -0
  8. data/lib/build-tool/GUI.rb +360 -0
  9. data/lib/build-tool/application.rb +84 -0
  10. data/lib/build-tool/build-system/autoconf.rb +60 -0
  11. data/lib/build-tool/build-system/base.rb +142 -0
  12. data/lib/build-tool/build-system/cmake.rb +119 -0
  13. data/lib/build-tool/build-system/custom.rb +115 -0
  14. data/lib/build-tool/build-system/qt.rb +113 -0
  15. data/lib/build-tool/cfg/lexer.rb +558 -0
  16. data/lib/build-tool/cfg/lexer.rex +248 -0
  17. data/lib/build-tool/cfg/lexer_base.rb +82 -0
  18. data/lib/build-tool/cfg/node.rb +94 -0
  19. data/lib/build-tool/cfg/parser.rb +871 -0
  20. data/lib/build-tool/cfg/parser.y +279 -0
  21. data/lib/build-tool/cfg/visitor.rb +471 -0
  22. data/lib/build-tool/commands.rb +639 -0
  23. data/lib/build-tool/commands/build.rb +120 -0
  24. data/lib/build-tool/commands/configure.rb +73 -0
  25. data/lib/build-tool/commands/ctags.rb +46 -0
  26. data/lib/build-tool/commands/environments.rb +29 -0
  27. data/lib/build-tool/commands/environments/list.rb +37 -0
  28. data/lib/build-tool/commands/environments/set.rb +33 -0
  29. data/lib/build-tool/commands/fetch.rb +50 -0
  30. data/lib/build-tool/commands/files.rb +73 -0
  31. data/lib/build-tool/commands/help.rb +22 -0
  32. data/lib/build-tool/commands/info.rb +48 -0
  33. data/lib/build-tool/commands/install.rb +56 -0
  34. data/lib/build-tool/commands/modules.rb +29 -0
  35. data/lib/build-tool/commands/modules/info.rb +75 -0
  36. data/lib/build-tool/commands/modules/list.rb +49 -0
  37. data/lib/build-tool/commands/modules/shell.rb +40 -0
  38. data/lib/build-tool/commands/rebase.rb +46 -0
  39. data/lib/build-tool/commands/recipes.rb +32 -0
  40. data/lib/build-tool/commands/recipes/info.rb +46 -0
  41. data/lib/build-tool/commands/recipes/install.rb +184 -0
  42. data/lib/build-tool/commands/recipes/list.rb +33 -0
  43. data/lib/build-tool/configuration.rb +115 -0
  44. data/lib/build-tool/environment.rb +119 -0
  45. data/lib/build-tool/errors.rb +9 -0
  46. data/lib/build-tool/module.rb +366 -0
  47. data/lib/build-tool/pluginbase.rb +43 -0
  48. data/lib/build-tool/recipe.rb +180 -0
  49. data/lib/build-tool/repository.rb +59 -0
  50. data/lib/build-tool/server.rb +43 -0
  51. data/lib/build-tool/singleton.rb +50 -0
  52. data/lib/build-tool/sshkey.rb +22 -0
  53. data/lib/build-tool/vcs/base.rb +105 -0
  54. data/lib/build-tool/vcs/git-svn.rb +154 -0
  55. data/lib/build-tool/vcs/git.rb +187 -0
  56. data/lib/build-tool/vcs/svn.rb +136 -0
  57. data/lib/mj/logging.rb +31 -0
  58. data/lib/mj/tools/ssh.rb +64 -0
  59. data/lib/{kde-build → mj/tools}/subprocess.rb +21 -16
  60. data/lib/mj/visitor.rb +21 -0
  61. data/recipes/kde/files/finish_installation.sh +16 -0
  62. data/recipes/kde/files/kde4.desktop +22 -0
  63. data/recipes/kde/files/xsession +89 -0
  64. data/recipes/kde/info.yaml +10 -0
  65. data/recipes/kde/recipe +585 -0
  66. data/recipes/kde/recipe-local +90 -0
  67. data/recipes/kde/settings.yaml +52 -0
  68. data/recipes/kde43/info.yaml +10 -0
  69. data/recipes/kde43/recipe +256 -0
  70. data/recipes/kde43/recipe-local +90 -0
  71. data/recipes/kde43/settings.yaml +32 -0
  72. data/recipes/kdeqt4.6/custom/qt/qtscriptgenerator/compile.sh +77 -0
  73. data/recipes/kdeqt4.6/custom/qt/qtscriptgenerator/configure.sh +70 -0
  74. data/recipes/kdeqt4.6/custom/qt/qtscriptgenerator/install.sh +39 -0
  75. data/recipes/kdeqt4.6/info.yaml +7 -0
  76. data/recipes/kdeqt4.6/recipe +155 -0
  77. data/recipes/kdeqt4.6/recipe-local +30 -0
  78. data/recipes/kdeqt4.6/settings.yaml +27 -0
  79. data/tags +745 -0
  80. data/tasks/genfiles.rake +28 -0
  81. data/tasks/rdoc.rake +34 -0
  82. data/tasks/rspec.rake +21 -0
  83. data/test.rb +28 -0
  84. data/test/commands/test_build.rb +29 -0
  85. data/test/test_build_system.rb +98 -0
  86. data/test/test_cli.rb +61 -0
  87. data/test/test_command.rb +175 -0
  88. data/test/test_configuration_parser.rb +542 -0
  89. data/test/test_environment.rb +82 -0
  90. data/test/test_helper.rb +39 -7
  91. data/test/test_module.rb +158 -0
  92. data/test/test_repository.rb +75 -0
  93. data/test/test_singleton.rb +51 -0
  94. data/test/test_ssh_key.rb +14 -0
  95. data/test/test_svn_parser.rb +28 -0
  96. data/test/test_vcs.rb +33 -0
  97. metadata +139 -90
  98. metadata.gz.sig +0 -0
  99. data/PostInstall.txt +0 -3
  100. data/TODO +0 -2
  101. data/bin/kde-build.rb +0 -21
  102. data/config/website.yml +0 -2
  103. data/config/website.yml.sample +0 -2
  104. data/lib/kde-build.rb +0 -18
  105. data/lib/kde-build/application.rb +0 -270
  106. data/lib/kde-build/build_system.rb +0 -28
  107. data/lib/kde-build/build_system/autoconf.rb +0 -108
  108. data/lib/kde-build/build_system/base.rb +0 -139
  109. data/lib/kde-build/build_system/cmake.rb +0 -94
  110. data/lib/kde-build/build_system/qtcopy.rb +0 -127
  111. data/lib/kde-build/command.rb +0 -42
  112. data/lib/kde-build/command/build.rb +0 -106
  113. data/lib/kde-build/command/compile.rb +0 -39
  114. data/lib/kde-build/command/configure.rb +0 -48
  115. data/lib/kde-build/command/ctags.rb +0 -41
  116. data/lib/kde-build/command/fetch.rb +0 -33
  117. data/lib/kde-build/command/help.rb +0 -71
  118. data/lib/kde-build/command/info.rb +0 -45
  119. data/lib/kde-build/command/install.rb +0 -39
  120. data/lib/kde-build/command/module_based.rb +0 -44
  121. data/lib/kde-build/command/rebase.rb +0 -50
  122. data/lib/kde-build/command/version.rb +0 -43
  123. data/lib/kde-build/configuration.rb +0 -209
  124. data/lib/kde-build/exception.rb +0 -6
  125. data/lib/kde-build/metaaid.rb +0 -18
  126. data/lib/kde-build/module.rb +0 -227
  127. data/lib/kde-build/module_configuration.rb +0 -107
  128. data/lib/kde-build/moduleregistry.rb +0 -85
  129. data/lib/kde-build/tools/ctags.rb +0 -59
  130. data/lib/kde-build/tools/logging.rb +0 -49
  131. data/lib/kde-build/tools/make.rb +0 -58
  132. data/lib/kde-build/tools/ssh.rb +0 -47
  133. data/lib/kde-build/vcs.rb +0 -28
  134. data/lib/kde-build/vcs/base.rb +0 -85
  135. data/lib/kde-build/vcs/git-svn.rb +0 -139
  136. data/lib/kde-build/vcs/git.rb +0 -121
  137. data/lib/kde-build/vcs/svn.rb +0 -102
  138. data/script/console +0 -10
  139. data/script/destroy +0 -14
  140. data/script/generate +0 -14
  141. data/script/txt2html +0 -71
  142. data/test.yaml.tmpl +0 -632
  143. data/test/test_kde-build.rb +0 -11
  144. data/test/test_vcs_svn.rb +0 -44
  145. data/website/index.html +0 -84
  146. data/website/index.txt +0 -59
  147. data/website/javascripts/rounded_corners_lite.inc.js +0 -285
  148. data/website/stylesheets/screen.css +0 -159
  149. data/website/template.html.erb +0 -50
@@ -0,0 +1,136 @@
1
+ require 'build-tool/vcs/base'
2
+
3
+ module BuildTool; module VCS
4
+
5
+ class SvnConfiguration < BaseConfiguration
6
+
7
+ def name
8
+ "svn"
9
+ end
10
+
11
+ def vcs( mod )
12
+ @module = mod
13
+ Svn.new( self )
14
+ end
15
+
16
+ end
17
+
18
+ #
19
+ # Implementation for the subversion version control system.
20
+ #
21
+ class Svn < Base
22
+
23
+ class SvnError < BuildTool::Error; end
24
+
25
+ # def initialize( *args )
26
+ # super( *args )
27
+ # end
28
+
29
+ #
30
+ ### ATTRIBUTES
31
+ #
32
+ def name
33
+ "svn"
34
+ end
35
+
36
+ def fetching_supported?
37
+ false
38
+ end
39
+
40
+
41
+ #
42
+ ### METHODS
43
+ #
44
+
45
+ def checkedout?
46
+ return false if !local_path_exist?
47
+ if !File.exists? "#{local_path}/.svn"
48
+ $log.debug("Checkout path #{local_path} is not a svn repo")
49
+ return false
50
+ end
51
+ return true
52
+ end
53
+
54
+ # Initialize the local repository
55
+ def clone
56
+ # Check if local_path exists
57
+ if local_path_exist?
58
+ raise SvnError, "Failed to create repository at '#{local_path}': Path exists"
59
+ end
60
+
61
+ # Create the directories parent dir.
62
+ FileUtils.mkdir_p( File.dirname( local_path ) ) if !$noop
63
+
64
+ # Init the repository
65
+ svn "checkout --depth=infinity #{repository.url}/#{remote_path} #{local_path}", File.dirname(local_path)
66
+ end
67
+
68
+ def fetch()
69
+ if !checkedout?
70
+ clone
71
+ else
72
+ svn "update"
73
+ end
74
+ return true
75
+ end
76
+
77
+ # Returns the last changed revision on the remote repository.
78
+ # Return 0 if the last changed revision could not be determined.
79
+ def last_changed_rev
80
+ info = Hash.new
81
+ svn( "info #{repository.url}/#{remote_path}", nil ) {
82
+ |line|
83
+ key, value = line.chomp.split( ':', 2 )
84
+ info[key] = value
85
+ }
86
+ return 777777 if $noop
87
+ version = info["Last Changed Rev"];
88
+ raise SvnError, "Failed to determine revision for #{repository.url}/#{remote_path}" if version.nil?
89
+ return version
90
+ end
91
+
92
+ # Call svn with command
93
+ def svn( command, wd = local_path, &block )
94
+ self.class.svn( command, wd, &block )
95
+ end
96
+
97
+ def self.svn( command, wd, &block )
98
+ rc = self.execute( "svn " + command, wd, &block )
99
+ if rc != 0
100
+ raise SvnError, "Command 'svn #{command}' failed with error code #{rc}!"
101
+ end
102
+ rc
103
+ end
104
+
105
+ def rebase
106
+ # Rebasing is not supported
107
+ 0
108
+ end
109
+
110
+ def[]( var )
111
+ case var
112
+
113
+ when nil
114
+
115
+ else
116
+ # *TODO* raise correct exception
117
+ raise NotImplementedError, "#{var}"
118
+ end
119
+ end
120
+
121
+ def[]=( var, val )
122
+ case var
123
+
124
+ when nil
125
+
126
+ else
127
+ # *TODO* raise correct exception
128
+ raise NotImplementedError, "#{var}"
129
+ end
130
+ end
131
+ end # class Svn
132
+
133
+
134
+ end; end # module BuildTool::VCS
135
+
136
+
@@ -0,0 +1,31 @@
1
+ module MJ; module Logging;
2
+
3
+ #
4
+ # Basic Layout for the logging framework.
5
+ #
6
+ # Will prefix message according to the following list:
7
+ #
8
+ # WARNING => 'warning: '
9
+ # ERROR => 'error: '
10
+ # REST => ''
11
+ class BasicLayout < ::Logging::Layout
12
+
13
+ def format( event )
14
+ obj = format_obj(event.data)
15
+
16
+ return case event.level
17
+
18
+ when ::Logging::level_num(:ERROR)
19
+ sprintf("error: %s\n", obj)
20
+
21
+ when ::Logging::level_num(:WARN)
22
+ sprintf("warning: %s\n", obj)
23
+
24
+ else
25
+ obj + "\n"
26
+ end
27
+ end
28
+
29
+ end # class BasicLayout
30
+
31
+ end; end
@@ -0,0 +1,64 @@
1
+ require 'mj/tools/subprocess.rb'
2
+
3
+ module MJ; module Tools
4
+
5
+ class SSH
6
+
7
+ include MJ::Tools::SubProcess
8
+
9
+ @keys_added = []
10
+
11
+ def self.add_key( key_file )
12
+ if @keys_added.index( key_file )
13
+ return
14
+ end
15
+ if ssh_add( "#{key_file}" ) == 0
16
+ @keys_added << key_file
17
+ end
18
+ end
19
+
20
+ def self.cleanup
21
+ @keys_added.each do |file|
22
+ self.remove_key( file )
23
+ end
24
+ @keys_added = []
25
+ end
26
+
27
+ def self.has_key?( key_file )
28
+ if @keys_added.index( key_file )
29
+ return true
30
+ end
31
+ found = false
32
+ ssh_add '-l' do
33
+ |line|
34
+ if line.index(key_file)
35
+ return found = true
36
+ end
37
+ end
38
+ return found
39
+ end
40
+
41
+ def self.remove_key( key_file )
42
+ ssh_add( "-d #{key_file}" )
43
+ end
44
+
45
+ def self.remove_all_keys
46
+ ssh_add( "-D" )
47
+ end
48
+
49
+ def self.list_keys
50
+ ssh_add( "-l" )
51
+ end
52
+
53
+ def self.ssh_add( command, &block )
54
+ if block_given?
55
+ self.execute "ssh-add #{command}", &block
56
+ else
57
+ self.execute "ssh-add #{command}"
58
+ end
59
+ end
60
+
61
+ end
62
+
63
+ end; end
64
+
@@ -2,15 +2,17 @@ module MJ; module Tools
2
2
 
3
3
  module SubProcess
4
4
 
5
+ class CoreDumpError < StandardError; end
6
+
5
7
  module ClassMethods
6
8
 
7
9
  # Executes command
8
10
  #
9
11
  # Executes the given command and yields each line of output.
10
12
  # Returns +$?+ .
11
- def execute( command, wd = nil, env = nil )
13
+ def execute( command, wd = ENV["HOME"], env = nil )
12
14
  cwd ||= Dir.getwd
13
- $log.cmd( "(#{wd}) > #{command} 2>&1" )
15
+ logger.trace "(#{wd}) > #{command} 2>&1"
14
16
  if !$noop
15
17
  adjust_environment( wd, env ) {
16
18
  IO.popen( "#{command} 2>&1" ) {
@@ -18,30 +20,31 @@ module MJ; module Tools
18
20
  begin
19
21
  while
20
22
  line = f.readline
21
- $log.cmdout( line.chomp )
22
- yield line if block_given?
23
+ logger.verbose line.chomp
24
+ yield line.chomp if block_given?
23
25
  end
24
26
  rescue EOFError:
25
27
  # Expected. Do nothing
26
28
  end
27
29
  }
28
- $log.cmdout( "= #{$?}" )
29
- return $?
30
+ if $?.coredump? or $?.signaled?
31
+ raise CoreDumpError, "Command '#{command}' core dumped because of signal #{$?.termsig}!";
32
+ end
33
+ logger.trace "= #{$?.exitstatus}"
34
+ return $?.exitstatus
30
35
  }
31
36
  else
32
- $log.cmdout( "= 0 # noop" )
37
+ adjust_environment( wd, env ) {
38
+ logger.trace "= 0 # noop"
39
+ }
33
40
  return 0
34
41
  end
35
42
 
36
43
  end
37
44
 
38
- #########
39
- protected
40
- #########
41
-
42
45
  # Helper method to adjust LANG to "C"
43
46
  def adjust_environment( wd=nil, env=nil, lang="C" )
44
- if wd
47
+ if wd and !$noop
45
48
  cwd = Dir.getwd
46
49
  Dir.chdir(wd)
47
50
  end
@@ -50,7 +53,7 @@ module MJ; module Tools
50
53
  if env
51
54
  env.each do |var, value|
52
55
  oldenv[var] = ENV[var]
53
- $log.debug "#{var} = #{value}"
56
+ logger.verbose "#{var} = #{value}"
54
57
  ENV[var] = value
55
58
  end
56
59
  end
@@ -65,19 +68,21 @@ module MJ; module Tools
65
68
  ENV[var] = value
66
69
  end
67
70
  # Reset the current working directory
68
- if wd
71
+ if wd and !$noop
69
72
  Dir.chdir(cwd)
70
73
  end
71
74
  end
72
75
  end
73
76
 
77
+ #########
78
+ protected
79
+ #########
80
+
74
81
  def self.included( klass )
75
82
  klass.extend( ClassMethods )
76
83
  end
77
84
 
78
-
79
85
  end
80
86
 
81
-
82
87
  end; end
83
88
 
@@ -0,0 +1,21 @@
1
+ module MJ;
2
+
3
+ class Visitable
4
+
5
+ def accept( visitor )
6
+ method_name = nil
7
+ klass = self.class.ancestors.find do |ancestor|
8
+ method_name = "visit_#{ancestor.name.split('::')[-1]}"
9
+ visitor.respond_to?( method_name )
10
+ end
11
+
12
+ if klass
13
+ return visitor.send( method_name, self )
14
+ else
15
+ raise "#{visitor.class}: Not a visitor for #{self.class}!"
16
+ end
17
+ end
18
+
19
+ end
20
+
21
+ end
@@ -0,0 +1,16 @@
1
+ #!/bin/sh
2
+
3
+
4
+ if test -e /etc/SuSE-brand; then
5
+ file="<%= settings['KDE_PREFIX'] %>/share/apps/kwrited"
6
+ if test -f $file; then
7
+ echo "sudo chown 0 $file && sudo chmod u+s $file"
8
+ sudo chown 0 $file && sudo chmod u+s $file
9
+ fi
10
+
11
+ file="<%= settings['KDE_PREFIX'] %>/lib<%= settings['LIB_SUFFIX'] %>/kde4/libexec/kcheckpass"
12
+ if test -f $file; then
13
+ echo "sudo chgrp shadow $file && sudo chmod g+s $file"
14
+ sudo chgrp shadow $file && sudo chmod g+s $file
15
+ fi
16
+ fi
@@ -0,0 +1,22 @@
1
+ # Standard sessions file
2
+ #
3
+ # This file is used to tell x display managers (xdm,gdm,kdm) how to start the
4
+ # kde session.
5
+ #
6
+ # Copy this file to /usr/share/xsession. You have to configure kdm to use this
7
+ # directory. See "<%= settings['KDE_PREFIX'] %>/share/config/kdm/kdmrc".
8
+ # Search for SessionsDirs.
9
+ #
10
+ # This script expects a script mystartkde. See "files xsession". When both are
11
+ # there a new session Type "KDE 4 Trunk" should be available from your X
12
+ # Display Manager.
13
+ [Desktop Entry]
14
+ X-SuSE-translate=true
15
+ Encoding=UTF-8
16
+ Type=XSession
17
+ Exec=<%= settings['KDE_PREFIX'] %>/bin/mystartkde
18
+ TryExec=<%= settings['KDE_PREFIX'] %>/bin/startkde
19
+ Name=KDE 4 Trunk (unstable)
20
+ Comment=KDE Desktop Environment 4 Trunk (unstable)
21
+
22
+
@@ -0,0 +1,89 @@
1
+ # vim:ft=sh
2
+ # A script to start the kde workspace.
3
+ #
4
+ # You can use it in two ways. Just copy the content to the given path.
5
+ #
6
+ # 1. $HOME/.xsession
7
+ # ------------------
8
+ # Select "custom" session when logging in. This will use that script.
9
+ #
10
+ # 2. <%= settings['KDE_PREFIX'] %>/bin/mystartkde
11
+ # See "files xsession" on how to use that. Make sure the script is executable.
12
+
13
+
14
+ # Little helper function that adds to a path like environment variable. It
15
+ # checks if the path is already there before doing that.
16
+ function path_add
17
+ {
18
+ test -d $2 || return
19
+
20
+ case "x${!1}x" in
21
+ "xx")
22
+ eval "${1}"="$2"
23
+ ;;
24
+
25
+ x*:$2:*x)
26
+ # Value already part of var.
27
+ ;;
28
+
29
+ "x$2x")
30
+ # Value already part of var.
31
+ ;;
32
+
33
+ x$2:*x)
34
+ # Value already part of var.
35
+ ;;
36
+
37
+ x*:$2x)
38
+ # Value already part of var.
39
+ ;;
40
+
41
+ *)
42
+ eval "${1}=$2:${!1}"
43
+ ;;
44
+ esac;
45
+ }
46
+
47
+ # Initialize the vars from the setting file. This scripts is sourced after
48
+ # your shell login files (bash_profile, profile ...). We override any setting
49
+ # made there!
50
+ CMAKE_PREFIX_PATH="<%= settings['CMAKE_PREFIX_PATH'] %>"
51
+ unset KDEDIRS
52
+ LD_LIBRARY_PATH="<%= settings['LD_LIBRARY_PATH'] %>"
53
+ PATH="<%= settings['PATH'] %>"
54
+ PKG_CONFIG_PATH="<%= settings['PKG_CONFIG_PATH'] %>"
55
+ unset STRIGI_PLUGIN_PATH
56
+ XDG_DATA_DIRS="<%= settings['XDG_DATA_DIRS'] %>"
57
+
58
+ # Now add the necessary directories from the recipe. If they exist.
59
+ for path in "<%= settings['KOFFICE_PREFIX'] %>" "<%= settings['KDEDEVEL_PREFIX'] %>" "<%= settings['KDE_PREFIX'] %>" "<%= settings['KDESUPPORT_PREFIX'] %>" ; do
60
+ if test -d $path ; then
61
+ path_add "CMAKE_PREFIX_PATH" $path;
62
+ path_add "KDEDIRS" $path;
63
+ path_add "LD_LIBRARY_PATH" $path/lib<%= settings['LIB_SUFFIX'] %>
64
+ path_add "PATH" $path/bin;
65
+ path_add "PKG_CONFIG_PATH" $path/lib<%= settings['LIB_SUFFIX'] %>/pkgconfig;
66
+ path_add "STRIGI_PLUGIN_PATH" $path/lib<%= settings['LIB_SUFFIX'] %>/strigi;
67
+ path_add "XDG_DATA_DIRS" $path/share;
68
+ fi
69
+ done
70
+
71
+ # Export the variables.
72
+ export CMAKE_PREFIX_PATH
73
+ export KDEDIRS
74
+ export LD_LIBRARY_PATH
75
+ export PATH
76
+ export PKG_CONFIG_PATH
77
+ export STRIGI_PLUGIN_PATH
78
+ export XDG_DATA_DIRS
79
+
80
+ # Add $HOME/bin if it exists
81
+ path_add "PATH" "$HOME/bin"
82
+ path_add "PATH" "$HOME/local/bin"
83
+
84
+ # Now start the standard kde login script.
85
+ <%= settings['KDE_PREFIX'] %>/bin/startkde
86
+
87
+ # If you experience problems on logout it is sometimes helpful to make copies
88
+ # of the xsession-errors file on logout.
89
+ # cp $HOME/.xsession-errors $HOME/.xsession-errors-`date +"%Y%m%d%H%M"`