build-tool 0.1.4 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. data.tar.gz.sig +2 -3
  2. data/History.txt +29 -0
  3. data/Manifest.txt +39 -10
  4. data/README.txt +5 -8
  5. data/Rakefile +14 -6
  6. data/bin/build-tool +3 -35
  7. data/db/migrations/001_command_histories.rb +20 -0
  8. data/db/migrations/002_module_events.rb +24 -0
  9. data/db/migrations/003_command_histories_add_logfile.rb +19 -0
  10. data/lib/build-tool.rb +1 -1
  11. data/lib/build-tool/application.rb +103 -30
  12. data/lib/build-tool/build-system/autoconf.rb +69 -6
  13. data/lib/build-tool/build-system/base.rb +2 -25
  14. data/lib/build-tool/build-system/custom.rb +6 -19
  15. data/lib/build-tool/build-system/kdel10n.rb +39 -0
  16. data/lib/build-tool/build-system/none.rb +82 -0
  17. data/lib/build-tool/cfg/lexer.rb +133 -7
  18. data/lib/build-tool/cfg/lexer.rex +58 -6
  19. data/lib/build-tool/cfg/node.rb +13 -1
  20. data/lib/build-tool/cfg/parser.rb +519 -333
  21. data/lib/build-tool/cfg/parser.y +74 -11
  22. data/lib/build-tool/cfg/visitor.rb +182 -20
  23. data/lib/build-tool/command_actions.rb +202 -0
  24. data/lib/build-tool/commands.rb +193 -49
  25. data/lib/build-tool/commands/build.rb +13 -8
  26. data/lib/build-tool/commands/configure.rb +8 -3
  27. data/lib/build-tool/commands/environments.rb +4 -8
  28. data/lib/build-tool/commands/environments/list.rb +8 -0
  29. data/lib/build-tool/commands/fetch.rb +7 -2
  30. data/lib/build-tool/commands/gc.rb +53 -0
  31. data/lib/build-tool/commands/history.rb +111 -0
  32. data/lib/build-tool/commands/install.rb +6 -1
  33. data/lib/build-tool/commands/lsfeatures.rb +73 -0
  34. data/lib/build-tool/commands/modules.rb +3 -7
  35. data/lib/build-tool/commands/modules/info.rb +15 -6
  36. data/lib/build-tool/commands/modules/list.rb +10 -5
  37. data/lib/build-tool/commands/rebase.rb +6 -1
  38. data/lib/build-tool/commands/recipes.rb +3 -7
  39. data/lib/build-tool/configuration.rb +24 -1
  40. data/lib/build-tool/environment.rb +17 -3
  41. data/lib/build-tool/feature.rb +47 -0
  42. data/lib/build-tool/history.rb +173 -0
  43. data/lib/build-tool/module.rb +49 -90
  44. data/lib/build-tool/recipe.rb +5 -0
  45. data/lib/build-tool/vcs/archive.rb +140 -0
  46. data/lib/build-tool/vcs/base.rb +5 -5
  47. data/lib/build-tool/vcs/git-svn.rb +4 -0
  48. data/lib/build-tool/vcs/git.rb +4 -0
  49. data/lib/mj/logging.rb +11 -0
  50. data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/compile.sh +0 -0
  51. data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/configure.sh +0 -0
  52. data/recipes/{kdeqt4.6 → kde}/custom/qt/qtscriptgenerator/install.sh +0 -0
  53. data/recipes/kde/custom/scripting/pyqt4/compile.sh +10 -0
  54. data/recipes/kde/custom/scripting/pyqt4/configure.sh +14 -0
  55. data/recipes/kde/custom/scripting/pyqt4/install.sh +10 -0
  56. data/recipes/kde/custom/scripting/sip/compile.sh +10 -0
  57. data/recipes/kde/custom/scripting/sip/configure.sh +13 -0
  58. data/recipes/kde/custom/scripting/sip/install.sh +10 -0
  59. data/recipes/kde/files/xsession +8 -4
  60. data/recipes/kde/kde-bindings.recipe +22 -0
  61. data/recipes/kde/kde-core.recipe +104 -0
  62. data/recipes/kde/kde-devel.recipe +38 -0
  63. data/recipes/kde/kde-finance.recipe +17 -0
  64. data/recipes/kde/kde-graphics.recipe +27 -0
  65. data/recipes/kde/kde-kdevelop.recipe +116 -0
  66. data/recipes/kde/kde-l10n.recipe +14 -0
  67. data/recipes/kde/kde-multimedia.recipe +31 -0
  68. data/recipes/kde/kde-network.recipe +55 -0
  69. data/recipes/kde/kde-office.recipe +28 -0
  70. data/recipes/kde/kde-plasma.recipe +117 -0
  71. data/recipes/{kdeqt4.6/recipe → kde/kde-qt.recipe} +25 -57
  72. data/recipes/kde/kde-scripting.recipe +63 -0
  73. data/recipes/kde/kde-support.recipe +73 -0
  74. data/recipes/kde/kde-utils.recipe +22 -0
  75. data/recipes/kde/kde-webdev.recipe +41 -0
  76. data/recipes/kde/recipe +92 -532
  77. data/recipes/kde/recipe-local +58 -2
  78. data/recipes/kde/settings.yaml +17 -0
  79. data/recipes/kde43/recipe-local +58 -2
  80. data/test/test_configuration_parser.rb +76 -21
  81. data/test/test_feature.rb +34 -0
  82. data/test/test_history.rb +149 -0
  83. metadata +185 -30
  84. metadata.gz.sig +0 -0
  85. data/lib/build-tool/pluginbase.rb +0 -43
  86. data/recipes/kdeqt4.6/info.yaml +0 -7
  87. data/recipes/kdeqt4.6/recipe-local +0 -30
  88. data/recipes/kdeqt4.6/settings.yaml +0 -27
  89. data/tasks/rdoc.rake +0 -34
  90. data/test.rb +0 -28
@@ -40,6 +40,11 @@ module BuildTool
40
40
  return nil
41
41
  end
42
42
 
43
+ def include_file( filename, configuration )
44
+ logger.debug "Including #{global_config_file_path( filename )}"
45
+ load_from_file( global_config_file_path( filename ), configuration )
46
+ end
47
+
43
48
  def long_description
44
49
  return @long_description if @metainfo_loaded
45
50
  load_metainfo
@@ -0,0 +1,140 @@
1
+ require 'open-uri'
2
+
3
+ require 'build-tool/vcs/base'
4
+ require 'fileutils'
5
+
6
+
7
+ module BuildTool; module VCS
8
+
9
+ class ArchiveConfiguration < BaseConfiguration
10
+
11
+ def name
12
+ "archive"
13
+ end
14
+
15
+ def vcs( mod )
16
+ @module = mod
17
+ Archive.new( self )
18
+ end
19
+
20
+ end # class ArchiveConfiguration
21
+
22
+
23
+ class Archive < Base
24
+
25
+ class ArchiveError < BuildTool::Error; end
26
+
27
+ #
28
+ ### Attributes
29
+ #
30
+ def name
31
+ "archive"
32
+ end
33
+
34
+ def fetching_supported?
35
+ true
36
+ end
37
+
38
+ def archive_local_path
39
+ "#{File.dirname( local_path )}/#{archive_name}"
40
+ end
41
+
42
+ def archive_name
43
+ File.basename( archive_url )
44
+ end
45
+
46
+ def archive_url
47
+ "#{repository.url}/#{remote_path}"
48
+ end
49
+
50
+ #
51
+ ### METHODS
52
+ #
53
+
54
+ def checkedout?
55
+ File.exist? archive_local_path
56
+ end
57
+
58
+ def clone
59
+ # Check if the archive is already downloaded
60
+ if File.exist? archive_local_path
61
+ logger.debug "Archive already fetched. Skipping."
62
+ return 0
63
+ end
64
+
65
+ # If the archive doesn't exist we assume the unpacked archive
66
+ # should not exist too.
67
+ if local_path_exist?
68
+ logger.debug "We fetch a new archive. Remove the old sources."
69
+ FileUtils.rm_rf local_path if !$noop
70
+ end
71
+
72
+ # Create the directories parent dir.
73
+ FileUtils.mkdir_p( File.dirname( local_path ) ) if !$noop
74
+
75
+ # Download the archive
76
+ logger.trace "get #{archive_name} from #{archive_url} to #{archive_local_path}"
77
+ if !$noop
78
+ target = open( archive_local_path, "wb" )
79
+ open( archive_url ) { |file|
80
+ while c = file.getc
81
+ target.putc c
82
+ end
83
+ }
84
+ target.close()
85
+ 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
113
+ end
114
+
115
+ def guess_top_level_directory
116
+ return "<topdir>" if $noop
117
+ topdir = nil
118
+ if archive_name =~ /(\.tgz|\.tar\.gz)$/
119
+ if self.class.execute( "gunzip -c #{archive_local_path} | tar tf -" ) { |line|
120
+ rc = /^([^\/]*)\//.match( line )
121
+ if topdir and topdir != rc[1]
122
+ raise StandardError, "Unable to determine toplevel directory for archive #{archive_name}!"
123
+ end
124
+ topdir = rc[1]
125
+ } != 0
126
+ raise StandardError, "Failed to unpack the archive: $?"
127
+ end
128
+ else
129
+ raise NotImplementedError, "No idea how to unpack the archive"
130
+ end
131
+ return topdir
132
+ end
133
+
134
+ def rebase
135
+ 0
136
+ end
137
+
138
+ end # class Archive
139
+
140
+ end; end
@@ -24,10 +24,6 @@ module BuildTool; module VCS
24
24
  @module.source_directory
25
25
  end
26
26
 
27
- def module
28
- @module
29
- end
30
-
31
27
  end
32
28
 
33
29
  #
@@ -49,6 +45,10 @@ module BuildTool; module VCS
49
45
  #
50
46
  attr_reader :config
51
47
 
48
+ # Collect garbage, do maintenance ...
49
+ def gc
50
+ end
51
+
52
52
  def local_path
53
53
  local_path = @config.local_path
54
54
  raise ConfigurationError, "#{self.class}.local_path not set" if local_path.nil?
@@ -95,7 +95,7 @@ module BuildTool; module VCS
95
95
  ] do
96
96
  class_eval <<-EOS
97
97
  def #{method}
98
- raise NotImplementedError, "Method #{method} is not implemented for class #{self}"
98
+ raise NotImplementedError, "Method #{method} is not implemented for class %s" % self.class
99
99
  end
100
100
  EOS
101
101
  end
@@ -97,6 +97,10 @@ module BuildTool; module VCS
97
97
  update_externals
98
98
  end
99
99
 
100
+ def gc
101
+ git.git( "gc" )
102
+ end
103
+
100
104
  def git
101
105
  if @git.nil?
102
106
  @git = Git.new( config )
@@ -118,6 +118,10 @@ best chance you have is issuing the command manually!
118
118
 
119
119
  end
120
120
 
121
+ def gc
122
+ git( "gc" )
123
+ end
124
+
121
125
  def remote?( name )
122
126
  found = false
123
127
  git( "remote" ) do |line|
data/lib/mj/logging.rb CHANGED
@@ -28,4 +28,15 @@ module MJ; module Logging;
28
28
 
29
29
  end # class BasicLayout
30
30
 
31
+ class LoggerAdapter
32
+
33
+ def initialize( prefix )
34
+ @prefix = prefix.upcase
35
+ end
36
+
37
+ def info( string )
38
+ logger.trace( "<#{@prefix}> #{string}" )
39
+ end
40
+ end
41
+
31
42
  end; end
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ # Uncomment this line if you want to debug the script
4
+ # set -x
5
+
6
+ source_directory=$1
7
+ build_directory=$(pwd)
8
+
9
+ echo " - calling make"
10
+ make
@@ -0,0 +1,14 @@
1
+ #!/bin/sh
2
+
3
+ # Uncomment this line if you want to debug the script
4
+ # set -x
5
+
6
+ source_directory=$1
7
+ build_directory=$(pwd)
8
+
9
+ python ${source_directory}/configure.py \
10
+ --confirm-license \
11
+ --bindir=$INSTALL_PREFIX/bin \
12
+ --destdir=$INSTALL_PREFIX/lib$LIB_SUFFIX/python$PYTHON_VERSION/site-packages \
13
+ --sipdir=$INSTALL_PREFIX/share/sip \
14
+ --plugin-destdir=$INSTALL_PREFIX/lib$LIB_SUFFIX/plugins
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ # Uncomment this line if you want to debug the script
4
+ # set -x
5
+
6
+ source_directory=$1
7
+ build_directory=$(pwd)
8
+
9
+ echo "- making install"
10
+ make install
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ # Uncomment this line if you want to debug the script
4
+ # set -x
5
+
6
+ source_directory=$1
7
+ build_directory=$(pwd)
8
+
9
+ echo " - calling make"
10
+ make
@@ -0,0 +1,13 @@
1
+ #!/bin/sh
2
+
3
+ # Uncomment this line if you want to debug the script
4
+ # set -x
5
+
6
+ source_directory=$1
7
+ build_directory=$(pwd)
8
+
9
+ python ${source_directory}/configure.py \
10
+ -b $INSTALL_PREFIX/bin \
11
+ -d $INSTALL_PREFIX/lib$LIB_SUFFIX/python$PYTHON_VERSION/site-packages \
12
+ -v $INSTALL_PREFIX/share/sip \
13
+ -e $INSTALL_PREFIX/include/python$PYTHON_VERSION
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ # Uncomment this line if you want to debug the script
4
+ # set -x
5
+
6
+ source_directory=$1
7
+ build_directory=$(pwd)
8
+
9
+ echo "- making install"
10
+ make install
@@ -1,3 +1,4 @@
1
+ #!/bin/sh
1
2
  # vim:ft=sh
2
3
  # A script to start the kde workspace.
3
4
  #
@@ -48,21 +49,23 @@ function path_add
48
49
  # your shell login files (bash_profile, profile ...). We override any setting
49
50
  # made there!
50
51
  CMAKE_PREFIX_PATH="<%= settings['CMAKE_PREFIX_PATH'] %>"
51
- unset KDEDIRS
52
52
  LD_LIBRARY_PATH="<%= settings['LD_LIBRARY_PATH'] %>"
53
53
  PATH="<%= settings['PATH'] %>"
54
54
  PKG_CONFIG_PATH="<%= settings['PKG_CONFIG_PATH'] %>"
55
- unset STRIGI_PLUGIN_PATH
55
+ PYTHONPATH="<%= settings['PYTHONPATH'] %>"
56
56
  XDG_DATA_DIRS="<%= settings['XDG_DATA_DIRS'] %>"
57
+ unset STRIGI_PLUGIN_PATH
58
+ unset KDEDIRS
57
59
 
58
60
  # 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
61
+ for path in "<%= settings['QT_PREFIX'] %>" "<%= settings['KOFFICE_PREFIX'] %>" "<%= settings['KDEDEVEL_PREFIX'] %>" "<%= settings['KDE_PREFIX'] %>" "<%= settings['KDESUPPORT_PREFIX'] %>" ; do
60
62
  if test -d $path ; then
61
63
  path_add "CMAKE_PREFIX_PATH" $path;
62
64
  path_add "KDEDIRS" $path;
63
- path_add "LD_LIBRARY_PATH" $path/lib<%= settings['LIB_SUFFIX'] %>
65
+ path_add "LD_LIBRARY_PATH" $path/lib<%= settings['LIB_SUFFIX'] %>;
64
66
  path_add "PATH" $path/bin;
65
67
  path_add "PKG_CONFIG_PATH" $path/lib<%= settings['LIB_SUFFIX'] %>/pkgconfig;
68
+ path_add "PYTHONPATH" $path/lib<%= settings['LIB_SUFFIX'] %>/python<%= settings['PYTHON_VERSION'] %>/site-packages;
66
69
  path_add "STRIGI_PLUGIN_PATH" $path/lib<%= settings['LIB_SUFFIX'] %>/strigi;
67
70
  path_add "XDG_DATA_DIRS" $path/share;
68
71
  fi
@@ -74,6 +77,7 @@ export KDEDIRS
74
77
  export LD_LIBRARY_PATH
75
78
  export PATH
76
79
  export PKG_CONFIG_PATH
80
+ export PYTHONPATH
77
81
  export STRIGI_PLUGIN_PATH
78
82
  export XDG_DATA_DIRS
79
83
 
@@ -0,0 +1,22 @@
1
+ #############################################################################
2
+ # KDEBINDINGS
3
+ #############################################################################
4
+ environment kdebindings < kde
5
+ var PYTHON_PATH set "<%= settings['KDE_PREFIX'] %>/lib<%= settings['LIB_SUFFIX'] %>/python2.6/site_packages"
6
+ end
7
+
8
+ module kdebindings < kde
9
+ use environment kdebindings
10
+ build-system cmake
11
+ # Currently onto2vocabulary crashes for me.
12
+ option BUILD_csharp "false"
13
+ option BUILD_ruby "true"
14
+ option BUILD_python "true"
15
+ option BUILD_php "false"
16
+ option BUILD_falcon "false"
17
+ option BUILD_java "false"
18
+ option BUILD_smoke "true"
19
+ option WITH_Nepomuk "false"
20
+ end
21
+ end
22
+
@@ -0,0 +1,104 @@
1
+ #############################################################################
2
+ # KDE
3
+ #############################################################################
4
+ environment kde < kdesupport
5
+ var CMAKE_PREFIX_PATH prepend "<%= settings['KDE_PREFIX'] %>"
6
+ var KDEDIRS prepend "<%= settings['KDE_PREFIX'] %>"
7
+ var LD_LIBRARY_PATH prepend "<%= settings['KDE_PREFIX'] %>/lib<%= settings['LIB_SUFFIX'] %>"
8
+ var MANPATH prepend "<%= settings['KDE_PREFIX'] %>/share/man"
9
+ var PATH prepend "<%= settings['KDE_PREFIX'] %>/bin"
10
+ var PKG_CONFIG_PATH prepend "<%= settings['KDE_PREFIX'] %>/lib<%= settings['LIB_SUFFIX'] %>/pkgconfig"
11
+ var STRIGI_PLUGIN_PATH prepend "<%= settings['KDE_PREFIX'] %>/lib<%= settings['LIB_SUFFIX'] %>/strigi"
12
+ var XDG_DATA_DIRS prepend "<%= settings['KDE_PREFIX'] %>"
13
+ end
14
+
15
+ module kde TEMPLATE
16
+ build-prefix "<%= settings['BUILD_DIR'] %>"
17
+ install-prefix "<%= settings['KDE_PREFIX'] %>"
18
+ use build-system cmake
19
+ use environment kde
20
+ use repository kde-core
21
+ use vcs git-svn
22
+ end
23
+
24
+ module kde-core < kde TEMPLATE
25
+ end
26
+
27
+ #############################################################################
28
+ # KDELIBS
29
+ #############################################################################
30
+ module "kdesupport/oxygen-icons" < kdesupport
31
+ # It's part part of KDE and it's not. That's why i put it here for now.
32
+ # Don't use a KDE/ prefix before it is not necessary to update it very
33
+ # often.
34
+ remote-path "oxygen-icons"
35
+ use repository "kde-icons"
36
+ end
37
+
38
+
39
+ module "KDE/kdelibs" < "kde-core"
40
+ # We use the default environment here to make sure kdelibs is able to
41
+ # bootstrap
42
+ use environment kdesupport
43
+ remote-path "kdelibs"
44
+ end
45
+
46
+
47
+ feature webkit
48
+ short description "WebKit related modules"
49
+
50
+ module "KDE/kwebkitpart" < kde
51
+ use repository kde
52
+ remote-path "extragear/base/kwebkitpart"
53
+ end
54
+
55
+ end # feature webkit
56
+
57
+ module "KDE/kdepimlibs" < "kde-core"
58
+ remote-path "kdepimlibs"
59
+ end
60
+
61
+
62
+ #############################################################################
63
+ # PyKDE4
64
+ #############################################################################
65
+ # The module is needed for plasmas python support.
66
+
67
+ feature "scripting"
68
+
69
+ feature "python"
70
+
71
+ module "KDE/pykde4" < kde
72
+ remote-path "kdebindings/python/pykde4"
73
+ build-system cmake
74
+ # option BUILD_Nepomuk "false"
75
+ option PYTHON_LIBS_WITH_KDE_LIBS "true"
76
+ option SIP_DEFAULT_SIP_DIR "<%= settings['KDE_PREFIX'] %>/share/sip"
77
+ option SIP_INCLUDES "<%= settings['SIP_INCLUDES'] %>"
78
+ end
79
+ end
80
+ end
81
+
82
+ end
83
+
84
+ #############################################################################
85
+ # KDEBASE/...
86
+ #############################################################################
87
+ module "KDE/kdebase/runtime" < "kde-core"
88
+ remote-path "kdebase/runtime"
89
+ end
90
+
91
+ module "KDE/kdebase/workspace" < "kde-core"
92
+ remote-path "kdebase/workspace"
93
+ build-system cmake
94
+ option PYTHON_LIBS_WITH_KDE_LIBS "true"
95
+ end
96
+ end
97
+
98
+ module "KDE/kdebase/apps" < "kde-core"
99
+ remote-path "kdebase/apps"
100
+ end
101
+
102
+ module "KDE/kdepim" < kde
103
+ remote-path "kdepim"
104
+ end