build-tool 0.2 → 0.3

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 (83) hide show
  1. data.tar.gz.sig +0 -0
  2. data/History.txt +14 -0
  3. data/Manifest.txt +5 -36
  4. data/lib/build-tool.rb +1 -1
  5. data/lib/build-tool/build-system/autoconf.rb +26 -11
  6. data/lib/build-tool/build-system/base.rb +7 -0
  7. data/lib/build-tool/build-system/custom.rb +0 -4
  8. data/lib/build-tool/build-system/qt.rb +6 -0
  9. data/lib/build-tool/cfg/lexer.rb +49 -0
  10. data/lib/build-tool/cfg/lexer.rex +19 -0
  11. data/lib/build-tool/cfg/node.rb +4 -0
  12. data/lib/build-tool/cfg/parser.rb +495 -401
  13. data/lib/build-tool/cfg/parser.y +34 -2
  14. data/lib/build-tool/cfg/visitor.rb +46 -6
  15. data/lib/build-tool/commands.rb +7 -4
  16. data/lib/build-tool/commands/build.rb +3 -0
  17. data/lib/build-tool/commands/configure.rb +5 -0
  18. data/lib/build-tool/commands/ctags.rb +6 -0
  19. data/lib/build-tool/commands/environments/list.rb +5 -0
  20. data/lib/build-tool/commands/environments/set.rb +6 -0
  21. data/lib/build-tool/commands/fetch.rb +8 -0
  22. data/lib/build-tool/commands/files.rb +7 -0
  23. data/lib/build-tool/commands/gc.rb +4 -0
  24. data/lib/build-tool/commands/history.rb +7 -0
  25. data/lib/build-tool/commands/info.rb +2 -0
  26. data/lib/build-tool/commands/install.rb +3 -1
  27. data/lib/build-tool/commands/lsfeatures.rb +3 -0
  28. data/lib/build-tool/commands/modules/info.rb +15 -0
  29. data/lib/build-tool/commands/modules/list.rb +8 -3
  30. data/lib/build-tool/commands/modules/shell.rb +1 -1
  31. data/lib/build-tool/commands/rebase.rb +6 -0
  32. data/lib/build-tool/commands/recipes.rb +0 -4
  33. data/lib/build-tool/commands/recipes/add.rb +45 -0
  34. data/lib/build-tool/commands/recipes/incoming.rb +66 -0
  35. data/lib/build-tool/commands/recipes/info.rb +4 -0
  36. data/lib/build-tool/commands/recipes/install.rb +11 -1
  37. data/lib/build-tool/commands/recipes/list.rb +2 -0
  38. data/lib/build-tool/configuration.rb +3 -0
  39. data/lib/build-tool/module.rb +27 -3
  40. data/lib/build-tool/vcs/archive.rb +58 -30
  41. data/lib/build-tool/vcs/base.rb +14 -0
  42. data/lib/build-tool/vcs/mercurial.rb +113 -0
  43. data/lib/build-tool/vcs/svn.rb +20 -2
  44. data/lib/mj/error.rb +7 -0
  45. data/lib/mj/vcs/git.rb +133 -0
  46. metadata +9 -40
  47. metadata.gz.sig +2 -3
  48. data/recipes/kde/custom/qt/qtscriptgenerator/compile.sh +0 -77
  49. data/recipes/kde/custom/qt/qtscriptgenerator/configure.sh +0 -70
  50. data/recipes/kde/custom/qt/qtscriptgenerator/install.sh +0 -39
  51. data/recipes/kde/custom/scripting/pyqt4/compile.sh +0 -10
  52. data/recipes/kde/custom/scripting/pyqt4/configure.sh +0 -14
  53. data/recipes/kde/custom/scripting/pyqt4/install.sh +0 -10
  54. data/recipes/kde/custom/scripting/sip/compile.sh +0 -10
  55. data/recipes/kde/custom/scripting/sip/configure.sh +0 -13
  56. data/recipes/kde/custom/scripting/sip/install.sh +0 -10
  57. data/recipes/kde/files/finish_installation.sh +0 -16
  58. data/recipes/kde/files/kde4.desktop +0 -22
  59. data/recipes/kde/files/xsession +0 -93
  60. data/recipes/kde/info.yaml +0 -10
  61. data/recipes/kde/kde-bindings.recipe +0 -22
  62. data/recipes/kde/kde-core.recipe +0 -104
  63. data/recipes/kde/kde-devel.recipe +0 -38
  64. data/recipes/kde/kde-finance.recipe +0 -17
  65. data/recipes/kde/kde-graphics.recipe +0 -27
  66. data/recipes/kde/kde-kdevelop.recipe +0 -116
  67. data/recipes/kde/kde-l10n.recipe +0 -14
  68. data/recipes/kde/kde-multimedia.recipe +0 -31
  69. data/recipes/kde/kde-network.recipe +0 -55
  70. data/recipes/kde/kde-office.recipe +0 -28
  71. data/recipes/kde/kde-plasma.recipe +0 -117
  72. data/recipes/kde/kde-qt.recipe +0 -122
  73. data/recipes/kde/kde-scripting.recipe +0 -63
  74. data/recipes/kde/kde-support.recipe +0 -73
  75. data/recipes/kde/kde-utils.recipe +0 -22
  76. data/recipes/kde/kde-webdev.recipe +0 -41
  77. data/recipes/kde/recipe +0 -155
  78. data/recipes/kde/recipe-local +0 -146
  79. data/recipes/kde/settings.yaml +0 -69
  80. data/recipes/kde43/info.yaml +0 -10
  81. data/recipes/kde43/recipe +0 -256
  82. data/recipes/kde43/recipe-local +0 -146
  83. data/recipes/kde43/settings.yaml +0 -32
@@ -9,12 +9,18 @@ module BuildTool; module Commands; module Modules
9
9
 
10
10
  name "list"
11
11
  description "list modules"
12
+ long_description [ "Shows a list of modules. Without a parameter all modules are show. With",
13
+ "parameters list all modules matching them." ]
12
14
  cmdalias "lsmods"
13
15
 
14
16
  def initialize_options
17
+ @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} [MODULE|GROUP]..."
18
+
15
19
  @template = false
16
20
  @all = false
17
21
 
22
+ @options.separator "Options:"
23
+
18
24
  options.on( "--all", "Include inactive modules." ) {
19
25
  @all = true
20
26
  }
@@ -24,7 +30,6 @@ module BuildTool; module Commands; module Modules
24
30
  }
25
31
 
26
32
  super
27
-
28
33
  end
29
34
 
30
35
  def do_execute( args )
@@ -32,7 +37,7 @@ module BuildTool; module Commands; module Modules
32
37
  if args.length == 0
33
38
  configuration.modules.each do |mod|
34
39
  if @template or not mod.is_template?
35
- say "%-30s : %s" % [ mod.name, mod.description ] if ( mod.active? || @all )
40
+ say "%-30s : %s" % [ mod.name, mod.description || "No description specified" ] if ( mod.active? || @all )
36
41
  end
37
42
  end
38
43
  else
@@ -40,7 +45,7 @@ module BuildTool; module Commands; module Modules
40
45
  mods = complete_modules( arg, @template )
41
46
  next if !mods
42
47
  mods.each do |mod|
43
- say "%-30s : %s" % [ mod.name, mod.description ] if ( mod.active? || @all )
48
+ say "%-30s : %s" % [ mod.name, mod.description || "No description specified" ] if ( mod.active? || @all )
44
49
  end
45
50
  end
46
51
  end
@@ -10,9 +10,9 @@ module BuildTool; module Commands; module Modules
10
10
  include MJ::Tools::SubProcess
11
11
 
12
12
  name "shell"
13
- description "open a shell having the modules environment."
14
13
 
15
14
  def initialize_options
15
+ @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} MODULE"
16
16
  super
17
17
  end
18
18
 
@@ -13,6 +13,7 @@ module BuildTool; module Commands;
13
13
 
14
14
  name "rebase"
15
15
  description "rebase local checkout against previously fetched remote changes."
16
+ long_description [ "Invokes the rebase phase for the specified modules." ]
16
17
 
17
18
  # Log this command if $noop is not active
18
19
  def log?
@@ -23,6 +24,11 @@ module BuildTool; module Commands;
23
24
  BuildTool::Application.instance.name != "build-tool"
24
25
  end
25
26
 
27
+ def initialize_options
28
+ @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} MODULES..."
29
+ super
30
+ end
31
+
26
32
  def is_module_ready?( mod )
27
33
  isready = true
28
34
  if !mod.checkedout?
@@ -14,10 +14,6 @@ module BuildTool; module Commands;
14
14
  super
15
15
  end
16
16
 
17
- def applicable?
18
- BuildTool::Application.instance.name == "build-tool"
19
- end
20
-
21
17
  def do_execute
22
18
  raise NotImplementedError
23
19
  end
@@ -0,0 +1,45 @@
1
+ require 'build-tool/commands'
2
+ require 'build-tool/recipe'
3
+ require 'mj/vcs/git'
4
+
5
+ module BuildTool; module Commands; module Recipes
6
+
7
+ #
8
+ # BuildCommand
9
+ #
10
+ class Add < Standard
11
+
12
+ name "add"
13
+ description "Add a recipe to build-tool."
14
+ long_description "Add a new recipe to build-tool from URL with NAME."
15
+
16
+ def initialize_options
17
+ @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} URL NAME"
18
+ super
19
+ end
20
+
21
+ def do_execute( args )
22
+ if ( args.length < 2 )
23
+ return usage( "Not enough arguments" )
24
+ elsif (args.length > 2 )
25
+ return usage( "To many arguments" )
26
+ end
27
+
28
+ path = BuildTool::Application::instance.local_configuration_dir.join( "recipes" )
29
+ if ! path.exist? && ! $noop
30
+ FileUtils.mkdir_p( path )
31
+ end
32
+
33
+ repo = MJ::VCS::Git::Repository.new(path.join(args[1]), $noop)
34
+ repo.clone(args[0])
35
+ return 0
36
+ end
37
+
38
+ end # class
39
+
40
+ end; end # module Commands::Recipes
41
+
42
+ end; # module BuildTool
43
+
44
+
45
+
@@ -0,0 +1,66 @@
1
+ require 'build-tool/commands'
2
+ require 'build-tool/recipe'
3
+ require 'mj/vcs/git'
4
+
5
+ module BuildTool; module Commands; module Recipes
6
+
7
+ #
8
+ # BuildCommand
9
+ #
10
+ class Fetch < Standard
11
+
12
+ name "incoming"
13
+ description "Show the incoming changes to the recipe from the repository."
14
+
15
+ def applicable?
16
+ BuildTool::Application.instance.name != "build-tool"
17
+ end
18
+
19
+ def initialize_options
20
+ @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname}"
21
+
22
+ @options.separator "Options:"
23
+ @rebase = false
24
+ @fetch = false
25
+ options.on( "-f", "--[no-]fetch", "Fetch from origin." ) { |t|
26
+ @fetch = t
27
+ }
28
+ options.on( "-r", "--[no-]rebase", "Rebase against master." ) { |t|
29
+ @rebase = t
30
+ }
31
+ super
32
+ end
33
+
34
+ def do_execute( args )
35
+ if ( args.length != 0 )
36
+ return usage("No arguments expected")
37
+ end
38
+
39
+ recipe = BuildTool::Application::instance.recipe
40
+ repo = MJ::VCS::Git::Repository.new(recipe.global_path, $noop)
41
+
42
+ if @fetch
43
+ say "Fetching"
44
+ repo.fetch()
45
+ end
46
+
47
+ repo.log("HEAD..origin/master").each do |line|
48
+ say line
49
+ end
50
+
51
+ if @rebase
52
+ say "Rebasing"
53
+ repo.rebase("master")
54
+ end
55
+ return 0
56
+ end
57
+
58
+ end # class
59
+
60
+ end; end # module Commands::Recipes
61
+
62
+ end; # module BuildTool
63
+
64
+
65
+
66
+
@@ -1,6 +1,8 @@
1
1
  require 'build-tool/commands'
2
2
  require 'build-tool/recipe'
3
3
 
4
+ require 'ftools'
5
+
4
6
  module BuildTool; module Commands; module Recipes
5
7
 
6
8
  #
@@ -10,8 +12,10 @@ module BuildTool; module Commands; module Recipes
10
12
 
11
13
  name "info"
12
14
  description "show information about a module."
15
+ long_description [ "Show detailed information about RECIPE." ]
13
16
 
14
17
  def initialize_options
18
+ @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} RECIPE"
15
19
  super
16
20
  end
17
21
 
@@ -11,8 +11,11 @@ module BuildTool; module Commands; module Recipes
11
11
 
12
12
  name "install"
13
13
  description "install a build recipe"
14
+ long_description [ "Prepare a recipe for usage. If SCRIPTNAME is provided the recipe is",
15
+ "installed as SCRIPTNAME-build instead of RECIPE-build" ]
14
16
 
15
17
  def initialize_options
18
+ @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} RECIPE [SCRIPTNAME]"
16
19
  super
17
20
  end
18
21
 
@@ -114,7 +117,14 @@ EOS
114
117
  if conffile.exist?
115
118
  say "The config file already exists. I will not copy the file."
116
119
  else
117
- File.copy(recipe.join("settings.yaml"), conffile)
120
+ from = File.new(recipe.join("settings.yaml"), "r")
121
+ to = File.new(conffile, "w")
122
+ to.write("RECIPE: #{recipename}\n\n")
123
+ from.each_line do |line|
124
+ to.write line
125
+ end
126
+ to.close
127
+ from.close
118
128
  end
119
129
 
120
130
  say <<EOS
@@ -10,8 +10,10 @@ module BuildTool; module Commands; module Recipes
10
10
 
11
11
  name "list"
12
12
  description "list build recipes"
13
+ long_description [ "Shows the list of recipes." ]
13
14
 
14
15
  def initialize_options
16
+ @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname}"
15
17
  super
16
18
  end
17
19
 
@@ -2,6 +2,7 @@ require 'build-tool/vcs/git'
2
2
  require 'build-tool/vcs/git-svn'
3
3
  require 'build-tool/vcs/svn'
4
4
  require 'build-tool/vcs/archive'
5
+ require 'build-tool/vcs/mercurial'
5
6
 
6
7
  require 'build-tool/build-system/cmake'
7
8
  require 'build-tool/build-system/qt'
@@ -102,6 +103,8 @@ module BuildTool
102
103
  return BuildTool::VCS::SvnConfiguration.new
103
104
  when "archive"
104
105
  return BuildTool::VCS::ArchiveConfiguration.new
106
+ when "mercurial"
107
+ return BuildTool::VCS::MercurialConfiguration.new
105
108
  else
106
109
  raise StandardError, "Unknown Version Control System #{name}"
107
110
  end
@@ -14,6 +14,7 @@ module BuildTool
14
14
  raise StandardError, "Module name is required!"
15
15
  end
16
16
  @active = nil
17
+ @patches = Array.new
17
18
  @name = name
18
19
  @parent = parent
19
20
  @local_path = nil
@@ -26,6 +27,9 @@ module BuildTool
26
27
  @is_template = false
27
28
  @vcs_configuration = nil
28
29
  @feature = nil
30
+
31
+ @long_description = nil
32
+ @description = nil
29
33
  end
30
34
 
31
35
  #
@@ -33,6 +37,7 @@ module BuildTool
33
37
  #
34
38
  attr_writer :feature
35
39
  attr_writer :active
40
+ attr_reader :patches
36
41
 
37
42
  def active?
38
43
  # If the module is activated that wins
@@ -49,7 +54,7 @@ module BuildTool
49
54
 
50
55
  # not inherited
51
56
  def build_directory
52
- "#{build_prefix_required}/bld/#{local_path}"
57
+ build_prefix_required.join("bld", local_path)
53
58
  end
54
59
 
55
60
  def build_prefix=( path )
@@ -110,8 +115,9 @@ module BuildTool
110
115
  end
111
116
  end
112
117
 
118
+ attr_writer :description
113
119
  def description
114
- @description || "no description"
120
+ @description
115
121
  end
116
122
 
117
123
  # Environment
@@ -175,6 +181,11 @@ module BuildTool
175
181
  @local_path || @name
176
182
  end
177
183
 
184
+ attr_writer :long_description
185
+ def long_description
186
+ @long_description
187
+ end
188
+
178
189
  # The module name
179
190
  attr_reader :name
180
191
 
@@ -205,7 +216,7 @@ module BuildTool
205
216
  end
206
217
 
207
218
  def source_directory
208
- "#{build_prefix_required}/src/#{local_path}"
219
+ build_prefix_required.join("src", local_path)
209
220
  end
210
221
  alias source_directory_required source_directory
211
222
 
@@ -265,6 +276,12 @@ module BuildTool
265
276
  # Clone the repository.
266
277
  def clone
267
278
  vcs_required.clone
279
+ if !patches.empty?
280
+ if !vcs.patches_supported?
281
+ raise NotImplementedError, "Patch support not implemented for vcs #{vcs.name}"
282
+ end
283
+ vcs_required.apply_patches( patches )
284
+ end
268
285
  end
269
286
 
270
287
  # Fetch changes from the remote repository. Do not change the local
@@ -277,6 +294,13 @@ module BuildTool
277
294
  # from the remote repository.
278
295
  def rebase
279
296
  vcs_required.rebase
297
+ if !patches.empty?
298
+ if !vcs.patches_supported?
299
+ raise NotImplementedError, "Patch support not implemented for vcs #{vcs.name}"
300
+ end
301
+ vcs_required.apply_patches( patches )
302
+ end
303
+ build_system_required.after_rebase
280
304
  end
281
305
 
282
306
  def configure
@@ -19,10 +19,10 @@ module BuildTool; module VCS
19
19
 
20
20
  end # class ArchiveConfiguration
21
21
 
22
-
23
22
  class Archive < Base
24
23
 
25
24
  class ArchiveError < BuildTool::Error; end
25
+ class FileNotFoundError < BuildTool::Error; end
26
26
 
27
27
  #
28
28
  ### Attributes
@@ -35,6 +35,14 @@ module BuildTool; module VCS
35
35
  true
36
36
  end
37
37
 
38
+ def patches_supported?
39
+ true
40
+ end
41
+
42
+ def apply_patches_after_rebase?
43
+ true
44
+ end
45
+
38
46
  def archive_local_path
39
47
  "#{File.dirname( local_path )}/#{archive_name}"
40
48
  end
@@ -55,7 +63,25 @@ module BuildTool; module VCS
55
63
  File.exist? archive_local_path
56
64
  end
57
65
 
66
+ def apply_patches( patches )
67
+ patches.each do |patch|
68
+ full_path = self.recipe.find_first_config_file( "custom/#{config.module.name}/patches/#{patch}.patch" )
69
+ if full_path.nil?
70
+ raise FileNotFoundError, "Patch '#{patch}' not found from module #{config.module.name}."
71
+ end
72
+ logger.info "Applying patch #{patch}"
73
+ self.class.execute( "patch -p1 -i #{full_path}", local_path )
74
+ end
75
+
76
+ end
77
+
58
78
  def clone
79
+ fetch()
80
+ rebase()
81
+ 0
82
+ end
83
+
84
+ def fetch()
59
85
  # Check if the archive is already downloaded
60
86
  if File.exist? archive_local_path
61
87
  logger.debug "Archive already fetched. Skipping."
@@ -83,33 +109,7 @@ module BuildTool; module VCS
83
109
  }
84
110
  target.close()
85
111
  end
86
-
87
- # Determine if the archive has a top level directory
88
- topdir = guess_top_level_directory()
89
-
90
- if archive_name =~ /(\.tgz|\.tar\.gz)$/
91
- if self.class.execute( "gunzip -c #{archive_local_path} | tar xf -", File.dirname(local_path) ) != 0
92
- raise StandardError, "Failed to unpack the archive: $?"
93
- end
94
- else
95
- raise NotImplementedError, "No idea how to unpack the archive"
96
- end
97
-
98
- # Rename the top level directory to our desired path
99
- logger.trace "mv #{File.dirname(local_path)}/#{topdir} #{local_path}"
100
- if !$noop
101
- FileUtils.move( "#{File.dirname(local_path)}/#{topdir}", local_path )
102
- end
103
- 0
104
- end
105
-
106
- def fetch()
107
- if !checkedout?
108
- clone
109
- else
110
- # No update for archives
111
- end
112
- return true
112
+ return 0
113
113
  end
114
114
 
115
115
  def guess_top_level_directory
@@ -123,15 +123,43 @@ module BuildTool; module VCS
123
123
  end
124
124
  topdir = rc[1]
125
125
  } != 0
126
- raise StandardError, "Failed to unpack the archive: $?"
126
+ # No topdir
127
+ return nil
127
128
  end
128
129
  else
129
- raise NotImplementedError, "No idea how to unpack the archive"
130
+ raise NotImplementedError, "No idea how to unpack the archive '#{archive_name}'."
130
131
  end
131
132
  return topdir
132
133
  end
133
134
 
134
135
  def rebase
136
+
137
+ # Check if the archive is already downloaded
138
+ if !File.exist? archive_local_path
139
+ logger.debug "Archive not fetched. Skipping."
140
+ return 0
141
+ end
142
+
143
+ if local_path_exist?
144
+ return 0
145
+ end
146
+
147
+ # Create the directory we want to use to checkout
148
+ FileUtils.mkdir_p local_path if !$noop
149
+
150
+ if archive_name =~ /(\.tgz|\.tar\.gz)$/
151
+ if guess_top_level_directory()
152
+ cmd = "gunzip -c #{archive_local_path} | tar --strip-components=1 --extract --file=- --directory=#{local_path}"
153
+ else
154
+ cmd = "gunzip -c #{archive_local_path} | tar --strip-components=0 --extract --file=- --directory=#{local_path}"
155
+ end
156
+ if self.class.execute( cmd ) != 0
157
+ raise StandardError, "Failed to unpack the archive: $?"
158
+ end
159
+ else
160
+ raise NotImplementedError, "No idea how to unpack the archive"
161
+ end
162
+
135
163
  0
136
164
  end
137
165