build-tool 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -45,6 +45,16 @@ module BuildTool; module VCS
45
45
  #
46
46
  attr_reader :config
47
47
 
48
+ #
49
+ ### CAPABILITIES
50
+ def patches_supported?
51
+ false
52
+ end
53
+
54
+ def apply_patches_after_rebase?
55
+ false
56
+ end
57
+
48
58
  # Collect garbage, do maintenance ...
49
59
  def gc
50
60
  end
@@ -80,6 +90,10 @@ module BuildTool; module VCS
80
90
  logger.debug "VCS #{name} did not implement configure!"
81
91
  end
82
92
 
93
+ def recipe
94
+ Application::instance.recipe
95
+ end
96
+
83
97
  #
84
98
  ### VIRTUAL FUNCTIONS
85
99
  #
@@ -0,0 +1,113 @@
1
+ require 'build-tool/vcs/base'
2
+ require 'build-tool/errors'
3
+
4
+ module BuildTool; module VCS
5
+
6
+ class MercurialError < BuildTool::Error; end
7
+
8
+ class MercurialConfiguration < BaseConfiguration
9
+
10
+ def name
11
+ "mercurial"
12
+ end
13
+
14
+ attr_accessor :remote
15
+
16
+ def initialize( mod = nil )
17
+ super( mod )
18
+ @remote = {}
19
+ end
20
+
21
+ def vcs( mod )
22
+ @module = mod
23
+ Mercurial.new( self )
24
+ end
25
+
26
+ def branch
27
+ self.module.remote_path
28
+ end
29
+ end
30
+
31
+ #
32
+ # Implementation for the hg version control system.
33
+ #
34
+ class Mercurial < Base
35
+
36
+ def initialize( config )
37
+ super( config )
38
+ @remote = {}
39
+ @vcs = nil
40
+ end
41
+
42
+ #
43
+ ### ATTRIBUTES
44
+ #
45
+ def name
46
+ "mercurial"
47
+ end
48
+
49
+ def fetching_supported?
50
+ true
51
+ end
52
+
53
+ #
54
+ ### METHODS
55
+ #
56
+
57
+ def checkedout?
58
+ return false if !local_path_exist?
59
+ if !Pathname.new( local_path ).join( ".hg" ).exist?
60
+ raise Base::VcsError, "Checkout path #{local_path} is not a mercurial repo!"
61
+ end
62
+ return true
63
+ end
64
+
65
+ # Initialize the local repository
66
+ def clone
67
+ # Check if path exists
68
+ if local_path_exist?
69
+ raise MercurialError, "Failed to create repository at '#{local_path}': Path exists"
70
+ end
71
+ FileUtils.mkdir_p Pathname.new( local_path ).dirname if ! $noop
72
+
73
+ # Initialize the repository
74
+ if hg( "clone #{repository.url} #{local_path}", Pathname.new( local_path ).dirname) != 0
75
+ raise MercurialError, "Error while initializing the repo `hg init #{local_path}'`: #{$?}"
76
+ end
77
+
78
+ fetch()
79
+ rebase()
80
+ end
81
+
82
+ # Fetch from +repository+
83
+ #
84
+ # Initializes the local clone if it does not exist.
85
+ def fetch()
86
+ if !checkedout? and !$noop
87
+ clone
88
+ end
89
+ cmd = "pull #{repository.url}"
90
+ if ( rc = hg( cmd ) ) != 0
91
+ raise MercurialError, "Error while fetching: #{rc}"
92
+ end
93
+ end
94
+
95
+ def hg( command, wd = local_path, &block )
96
+ rc = self.class.execute "hg #{command}", wd, &block
97
+ if rc != 0
98
+ raise MercurialError, "hg #{command || "" } failed with error code #{rc}";
99
+ end
100
+ rc
101
+ end
102
+
103
+ def rebase
104
+ if 0 != ( hg "update #{config.branch}" )
105
+ raise MercurialSvnError, "Error while rebasing the repo with `hg update: #{$?}"
106
+ end
107
+ end
108
+
109
+ end # class Mercurial
110
+
111
+ end; end # module BuildTool::VCS
112
+
113
+
@@ -4,6 +4,11 @@ module BuildTool; module VCS
4
4
 
5
5
  class SvnConfiguration < BaseConfiguration
6
6
 
7
+ def initialize
8
+ super
9
+ @only = nil
10
+ end
11
+
7
12
  def name
8
13
  "svn"
9
14
  end
@@ -13,6 +18,12 @@ module BuildTool; module VCS
13
18
  Svn.new( self )
14
19
  end
15
20
 
21
+ attr_reader :only
22
+ def only=( list )
23
+ @only = list
24
+ puts @only.inspect
25
+ end
26
+
16
27
  end
17
28
 
18
29
  #
@@ -45,7 +56,7 @@ module BuildTool; module VCS
45
56
  def checkedout?
46
57
  return false if !local_path_exist?
47
58
  if !File.exists? "#{local_path}/.svn"
48
- $log.debug("Checkout path #{local_path} is not a svn repo")
59
+ logger.debug("Checkout path #{local_path} is not a svn repo")
49
60
  return false
50
61
  end
51
62
  return true
@@ -62,7 +73,14 @@ module BuildTool; module VCS
62
73
  FileUtils.mkdir_p( File.dirname( local_path ) ) if !$noop
63
74
 
64
75
  # Init the repository
65
- svn "checkout --depth=infinity #{repository.url}/#{remote_path} #{local_path}", File.dirname(local_path)
76
+ if config.only
77
+ svn "checkout --depth=files #{repository.url}/#{remote_path} #{local_path}", local_path.dirname
78
+ config.only.each do |elem|
79
+ svn "update --depth=infinity #{elem}", local_path
80
+ end
81
+ else
82
+ svn "checkout --depth=infinity #{repository.url}/#{remote_path} #{local_path}", local_path.dirname
83
+ end
66
84
  end
67
85
 
68
86
  def fetch()
data/lib/mj/error.rb ADDED
@@ -0,0 +1,7 @@
1
+ #
2
+ #
3
+ module MJ
4
+
5
+ class Error < StandardError; end
6
+
7
+ end # module MJ
data/lib/mj/vcs/git.rb ADDED
@@ -0,0 +1,133 @@
1
+ require 'mj/tools/subprocess'
2
+ require 'mj/error'
3
+
4
+ #
5
+ #
6
+ module MJ; module VCS; module Git;
7
+
8
+ # Thrown if git signals a problem
9
+ class GitError < MJ::Error; end
10
+
11
+ # A (local) git repository.
12
+ #
13
+ class Repository
14
+
15
+ include MJ::Tools::SubProcess
16
+
17
+ attr_reader :path
18
+
19
+ # Some helper methods that should be factored out somewhere
20
+
21
+ # Create directory +dir+ recursively if needed.
22
+ def mkdir_p(dir)
23
+ logger.debug "mkdir -p #{dir}"
24
+ FileUtils.mkdir_p(dir) if !@noop
25
+ end
26
+
27
+ # Checkout a branch
28
+ def checkout(opts)
29
+ if ! exist? and ! $noop
30
+ raise GitError, "Repository #{path} does not exist!"
31
+ end
32
+ # Fetch only from remote if specified
33
+ git("checkout " + opts)
34
+ end
35
+
36
+ # Clone a repository
37
+ def clone(url)
38
+ # Initialize the repository
39
+ init(url)
40
+ remote_add(url, "origin")
41
+ fetch("origin")
42
+ checkout("-b master origin/master")
43
+ end # def clone
44
+
45
+ # Check if the repository exists
46
+ def exist?
47
+ # If path does not exist the repo does not exist
48
+ return false if !path.exist?
49
+ # If the path is not a directory we have a problem
50
+ raise GitError, "#{path.to_s} is not a directory!" if !path.directory?
51
+ # If the path is a directory but no .git directory is found we have a problem too
52
+ if !path.join( ".git" ).exist?
53
+ raise GitError, "#{path.to_s} is not a git repo!"
54
+ end
55
+ return true
56
+ end
57
+
58
+ def fetch(remote = nil)
59
+ if ! exist? and ! $noop
60
+ raise GitError, "Repository #{path} does not exist!"
61
+ end
62
+ # Fetch only from remote if specified
63
+ cmd = "fetch"
64
+ if remote
65
+ cmd += " -q #{remote}"
66
+ end
67
+ git(cmd)
68
+ end
69
+
70
+ # Execute +command+ from working directory +wd+. If specified call +block+ with every line
71
+ # of command output.
72
+ def git(command, wd = path, &block)
73
+ rc = self.class.execute "git #{command}", wd, &block
74
+ if rc != 0
75
+ raise GitError, "git #{command || "" } failed with error code #{rc}";
76
+ end
77
+ rc
78
+ end
79
+
80
+ def init(url)
81
+ # If the repository already exists we cannot initialize
82
+ if exist?
83
+ raise GitError, "Repository #{path} already exists!"
84
+ end
85
+ # Create the repository parent directory if needed
86
+ mkdir_p path
87
+ # Initialize the repository
88
+ git("init")
89
+ end
90
+
91
+ # If +noop+ is true no methods invoked on this object actually do any changes. The
92
+ # required actions will be logged but not executed.
93
+ def initialize(path, noop=false)
94
+ @path = path
95
+ @noop = noop
96
+ end
97
+
98
+ def log(rev="")
99
+ @lines = Array.new
100
+ git("log #{rev}") do |line|
101
+ @lines << line
102
+ end
103
+ @lines
104
+ end
105
+
106
+ def rebase(branch, remote="origin")
107
+ if ! exist? and ! $noop
108
+ raise GitError, "Repository #{path} does not exist!"
109
+ end
110
+ # Fetch only from remote if specified
111
+ cmd = "rebase "
112
+ if remote
113
+ cmd += "#{remote}/#{branch}"
114
+ else
115
+ cmd += "origin/#{branch}"
116
+ end
117
+ git(cmd)
118
+ end
119
+
120
+ # Add a new remote
121
+ def remote_add(url, name)
122
+ if ! exist? and ! $noop
123
+ raise GitError, "Repository #{path} does not exist!"
124
+ end
125
+ # Add the origin remote
126
+ git("remote add #{name} #{url.to_s}")
127
+ end
128
+
129
+
130
+ end # class Git
131
+
132
+ end; end; end # module BuildTool::VCS::Git
133
+
metadata CHANGED
@@ -1,12 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: build-tool
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 2
9
- version: "0.2"
8
+ - 3
9
+ version: "0.3"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Michael Jansen
@@ -35,7 +35,7 @@ cert_chain:
35
35
  M3zOaQdtTmiQPBqNIsE=
36
36
  -----END CERTIFICATE-----
37
37
 
38
- date: 2010-05-16 00:00:00 +02:00
38
+ date: 2010-06-24 00:00:00 +02:00
39
39
  default_executable:
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
@@ -244,6 +244,8 @@ files:
244
244
  - lib/build-tool/commands/modules/shell.rb
245
245
  - lib/build-tool/commands/rebase.rb
246
246
  - lib/build-tool/commands/recipes.rb
247
+ - lib/build-tool/commands/recipes/add.rb
248
+ - lib/build-tool/commands/recipes/incoming.rb
247
249
  - lib/build-tool/commands/recipes/info.rb
248
250
  - lib/build-tool/commands/recipes/install.rb
249
251
  - lib/build-tool/commands/recipes/list.rb
@@ -262,47 +264,14 @@ files:
262
264
  - lib/build-tool/vcs/base.rb
263
265
  - lib/build-tool/vcs/git-svn.rb
264
266
  - lib/build-tool/vcs/git.rb
267
+ - lib/build-tool/vcs/mercurial.rb
265
268
  - lib/build-tool/vcs/svn.rb
269
+ - lib/mj/error.rb
266
270
  - lib/mj/logging.rb
267
271
  - lib/mj/tools/ssh.rb
268
272
  - lib/mj/tools/subprocess.rb
273
+ - lib/mj/vcs/git.rb
269
274
  - lib/mj/visitor.rb
270
- - recipes/kde/custom/qt/qtscriptgenerator/compile.sh
271
- - recipes/kde/custom/qt/qtscriptgenerator/configure.sh
272
- - recipes/kde/custom/qt/qtscriptgenerator/install.sh
273
- - recipes/kde/custom/scripting/pyqt4/compile.sh
274
- - recipes/kde/custom/scripting/pyqt4/configure.sh
275
- - recipes/kde/custom/scripting/pyqt4/install.sh
276
- - recipes/kde/custom/scripting/sip/compile.sh
277
- - recipes/kde/custom/scripting/sip/configure.sh
278
- - recipes/kde/custom/scripting/sip/install.sh
279
- - recipes/kde/files/finish_installation.sh
280
- - recipes/kde/files/kde4.desktop
281
- - recipes/kde/files/xsession
282
- - recipes/kde/info.yaml
283
- - recipes/kde/kde-bindings.recipe
284
- - recipes/kde/kde-core.recipe
285
- - recipes/kde/kde-devel.recipe
286
- - recipes/kde/kde-finance.recipe
287
- - recipes/kde/kde-graphics.recipe
288
- - recipes/kde/kde-kdevelop.recipe
289
- - recipes/kde/kde-l10n.recipe
290
- - recipes/kde/kde-multimedia.recipe
291
- - recipes/kde/kde-network.recipe
292
- - recipes/kde/kde-office.recipe
293
- - recipes/kde/kde-plasma.recipe
294
- - recipes/kde/kde-qt.recipe
295
- - recipes/kde/kde-scripting.recipe
296
- - recipes/kde/kde-support.recipe
297
- - recipes/kde/kde-utils.recipe
298
- - recipes/kde/kde-webdev.recipe
299
- - recipes/kde/recipe
300
- - recipes/kde/recipe-local
301
- - recipes/kde/settings.yaml
302
- - recipes/kde43/info.yaml
303
- - recipes/kde43/recipe
304
- - recipes/kde43/recipe-local
305
- - recipes/kde43/settings.yaml
306
275
  - tasks/genfiles.rake
307
276
  - tasks/rspec.rake
308
277
  - test/commands/test_build.rb
metadata.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- NB��H ���� l��zU�����WL���u�:x��63^���k��h�f����0ȷ��'j(i�(�f�}�D-y$B
2
- ��אPB����}���D�������1qn��>�_-�f'�n�{΁d4�"��Y჻�l�Cå�(6��({ F��o����:Q'cs�N1jn���% ���k�M��"�����<���ĥ���i�+i
3
- i86��N�-��M&b*�|N�&���v%���F)
1
+ ���@X��T�Kзa@�W�k�Z�Η����
2
+ z�7����D�[����&"%/no#r���M0X�=�:0
@@ -1,77 +0,0 @@
1
- #!/bin/sh
2
-
3
- # Uncomment this line if you want to debug the script
4
- # set -x
5
-
6
- echo "
7
- If you get compile errors about missing phonon or xmlreader files, then
8
- patch manually the qtbindings/qtbinding.pro file. Remove any subdirs your qt
9
- does not support. E.g.
10
-
11
- qtscript_svg \\
12
- qtscript_xml \\
13
- - qtscript_phonon \\
14
- qtscript_webkit \\
15
- - qtscript_xmlpatterns \\
16
- qtscript_uitools \\
17
- qs_eval
18
-
19
- if you use the default configuration of qt this recipe provides.
20
- qtscriptgenerator does no automatic configuring.
21
- "
22
-
23
- source_directory=$1
24
- build_directory=$(pwd)
25
-
26
- # Check the requirements
27
- if test "x${QTDIR}x" == "xx"; then
28
- echo "QTDIR has to be set for the qtscriptgenerator to build!";
29
- exit -1;
30
- fi
31
-
32
- cd generator
33
- rc=$?
34
- if test $rc -ne 0; then
35
- echo "The generator directory does not exist: $rc" >&2;
36
- exit -1;
37
- fi
38
-
39
- echo " - calling make"
40
- make
41
- rc=$?
42
- if test $rc -ne 0; then
43
- echo "make failed with error code: $rc" >&2;
44
- exit -1;
45
- fi
46
-
47
- echo " - executing the generator"
48
- ./generator
49
- rc=$?
50
- if test $rc -ne 0; then
51
- echo "./generator failed with error code: $rc" >&2;
52
- exit -1;
53
- fi
54
-
55
- echo "Generator created successfully"
56
- cd ..
57
-
58
- echo "Creating the bindings"
59
- cd qtbindings
60
- rc=$?
61
- if test $rc -ne 0; then
62
- echo "The qtbindings directory does not exists"
63
- exit -1;
64
- fi
65
-
66
- echo " - calling make"
67
- make
68
- rc=$?
69
- if test $rc -ne 0; then
70
- echo "make failed with error code: $rc" >&2;
71
- exit -1;
72
- fi
73
-
74
- echo "Bindings created successfully"
75
- cd ..
76
-
77
- exit 0