puppet 2.7.19 → 2.7.20.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (324) hide show
  1. data/CONTRIBUTING.md +61 -238
  2. data/Gemfile +32 -0
  3. data/Gemfile.lock +44 -0
  4. data/LICENSE +1 -1
  5. data/README_DEVELOPER.md +300 -5
  6. data/Rakefile +41 -37
  7. data/ext/build_defaults.yaml +20 -0
  8. data/ext/debian/README.Debian +8 -0
  9. data/ext/debian/README.source +2 -0
  10. data/ext/debian/TODO.Debian +1 -0
  11. data/ext/debian/changelog.erb +1104 -0
  12. data/ext/debian/compat +1 -0
  13. data/ext/debian/control +142 -0
  14. data/ext/debian/copyright +361 -0
  15. data/ext/debian/docs +1 -0
  16. data/ext/debian/fileserver.conf +17 -0
  17. data/ext/debian/puppet-common.dirs +8 -0
  18. data/ext/debian/puppet-common.install +3 -0
  19. data/ext/debian/puppet-common.lintian-overrides +7 -0
  20. data/ext/debian/puppet-common.manpages +2 -0
  21. data/ext/debian/puppet-common.postinst +35 -0
  22. data/ext/debian/puppet-common.postrm +32 -0
  23. data/ext/debian/puppet-el.dirs +1 -0
  24. data/ext/debian/puppet-el.emacsen-install +25 -0
  25. data/ext/debian/puppet-el.emacsen-remove +11 -0
  26. data/ext/debian/puppet-el.emacsen-startup +9 -0
  27. data/ext/debian/puppet-el.install +1 -0
  28. data/ext/debian/puppet-testsuite.install +3 -0
  29. data/ext/debian/puppet-testsuite.lintian-overrides +4 -0
  30. data/ext/debian/puppet.NEWS +86 -0
  31. data/ext/debian/puppet.conf +14 -0
  32. data/ext/debian/puppet.default +7 -0
  33. data/ext/debian/puppet.dirs +1 -0
  34. data/ext/debian/puppet.init +118 -0
  35. data/ext/debian/puppet.install +4 -0
  36. data/ext/debian/puppet.lintian-overrides +3 -0
  37. data/ext/debian/puppet.logrotate +11 -0
  38. data/ext/debian/puppet.manpages +36 -0
  39. data/ext/debian/puppet.postinst +20 -0
  40. data/ext/debian/puppet.postrm +20 -0
  41. data/ext/debian/puppet.preinst +20 -0
  42. data/ext/debian/puppetmaster-common.install +5 -0
  43. data/ext/debian/puppetmaster-common.manpages +5 -0
  44. data/ext/debian/puppetmaster-common.puppetqd.default +27 -0
  45. data/ext/debian/puppetmaster-common.puppetqd.init +84 -0
  46. data/ext/debian/puppetmaster-passenger.dirs +4 -0
  47. data/ext/debian/puppetmaster-passenger.postinst +66 -0
  48. data/ext/debian/puppetmaster-passenger.postrm +33 -0
  49. data/ext/debian/puppetmaster.NEWS +13 -0
  50. data/ext/debian/puppetmaster.README.debian +16 -0
  51. data/ext/debian/puppetmaster.default +38 -0
  52. data/ext/debian/puppetmaster.dirs +1 -0
  53. data/ext/debian/puppetmaster.init +158 -0
  54. data/ext/debian/puppetmaster.install +1 -0
  55. data/ext/debian/puppetmaster.lintian-overrides +3 -0
  56. data/ext/debian/puppetmaster.manpages +1 -0
  57. data/ext/debian/puppetmaster.postinst +20 -0
  58. data/ext/debian/puppetmaster.postrm +5 -0
  59. data/ext/debian/puppetmaster.preinst +22 -0
  60. data/ext/debian/rules +127 -0
  61. data/ext/debian/source/format +1 -0
  62. data/ext/debian/source/options +1 -0
  63. data/ext/debian/vim-puppet.README.Debian +13 -0
  64. data/ext/debian/vim-puppet.dirs +3 -0
  65. data/ext/debian/vim-puppet.yaml +5 -0
  66. data/ext/debian/watch +2 -0
  67. data/ext/emacs/puppet-mode.el +1 -0
  68. data/{conf → ext}/osx/PackageInfo.plist +0 -0
  69. data/{conf → ext}/osx/createpackage.sh +0 -0
  70. data/ext/osx/file_mapping.yaml +38 -0
  71. data/ext/osx/preflight.erb +37 -0
  72. data/{tasks/rake/templates → ext/osx}/prototype.plist.erb +0 -0
  73. data/ext/packaging/README-Solaris.md +117 -0
  74. data/ext/packaging/README.md +255 -0
  75. data/ext/packaging/spec/spec_helper.rb +12 -0
  76. data/ext/packaging/spec/tasks/00_utils_spec.rb +66 -0
  77. data/ext/packaging/tasks/00_utils.rake +382 -0
  78. data/ext/packaging/tasks/10_setupvars.rake +71 -0
  79. data/ext/packaging/tasks/20_setupextravars.rake +25 -0
  80. data/ext/packaging/tasks/apple.rake +201 -0
  81. data/ext/packaging/tasks/clean.rake +5 -0
  82. data/ext/packaging/tasks/deb.rake +108 -0
  83. data/ext/packaging/tasks/doc.rake +20 -0
  84. data/ext/packaging/tasks/fetch.rake +18 -0
  85. data/ext/packaging/tasks/gem.rake +68 -0
  86. data/ext/packaging/tasks/ips.rake +80 -0
  87. data/ext/packaging/tasks/mock.rake +126 -0
  88. data/ext/packaging/tasks/pe_deb.rake +9 -0
  89. data/ext/packaging/tasks/pe_remote.rake +45 -0
  90. data/ext/packaging/tasks/pe_rpm.rake +21 -0
  91. data/ext/packaging/tasks/pe_ship.rake +30 -0
  92. data/ext/packaging/tasks/pe_sign.rake +27 -0
  93. data/ext/packaging/tasks/pe_sles.rake +96 -0
  94. data/ext/packaging/tasks/release.rake +73 -0
  95. data/ext/packaging/tasks/remote_build.rake +78 -0
  96. data/ext/packaging/tasks/rpm.rake +52 -0
  97. data/ext/packaging/tasks/ship.rake +78 -0
  98. data/ext/packaging/tasks/sign.rake +82 -0
  99. data/ext/packaging/tasks/tag.rake +8 -0
  100. data/ext/packaging/tasks/tar.rake +68 -0
  101. data/ext/packaging/tasks/template.rake +13 -0
  102. data/ext/packaging/tasks/update.rake +16 -0
  103. data/ext/packaging/tasks/version.rake +21 -0
  104. data/ext/project_data.yaml +24 -0
  105. data/{conf/redhat/puppet.spec → ext/redhat/puppet.spec.erb} +18 -10
  106. data/install.rb +8 -8
  107. data/lib/puppet.rb +2 -6
  108. data/lib/puppet/agent/locker.rb +2 -0
  109. data/lib/puppet/application.rb +1 -1
  110. data/lib/puppet/application/agent.rb +1 -1
  111. data/lib/puppet/application/apply.rb +1 -1
  112. data/lib/puppet/application/cert.rb +5 -6
  113. data/lib/puppet/application/describe.rb +1 -1
  114. data/lib/puppet/application/device.rb +1 -1
  115. data/lib/puppet/application/doc.rb +1 -1
  116. data/lib/puppet/application/filebucket.rb +1 -1
  117. data/lib/puppet/application/inspect.rb +1 -1
  118. data/lib/puppet/application/kick.rb +1 -1
  119. data/lib/puppet/application/master.rb +1 -1
  120. data/lib/puppet/application/resource.rb +1 -1
  121. data/lib/puppet/defaults.rb +21 -3
  122. data/lib/puppet/external/dot.rb +1 -1
  123. data/lib/puppet/face/help/global.erb +1 -1
  124. data/lib/puppet/face/module/install.rb +1 -1
  125. data/lib/puppet/face/module/list.rb +1 -1
  126. data/lib/puppet/face/module/uninstall.rb +1 -1
  127. data/lib/puppet/face/node/clean.rb +23 -18
  128. data/lib/puppet/face/parser.rb +11 -2
  129. data/lib/puppet/file_collection.rb +16 -27
  130. data/lib/puppet/file_collection/lookup.rb +6 -16
  131. data/lib/puppet/file_serving/base.rb +4 -4
  132. data/lib/puppet/indirector/catalog/static_compiler.rb +3 -4
  133. data/lib/puppet/indirector/certificate/disabled_ca.rb +22 -0
  134. data/lib/puppet/indirector/certificate_request/disabled_ca.rb +22 -0
  135. data/lib/puppet/indirector/certificate_revocation_list/disabled_ca.rb +22 -0
  136. data/lib/puppet/indirector/face.rb +2 -2
  137. data/lib/puppet/indirector/key/disabled_ca.rb +22 -0
  138. data/lib/puppet/indirector/node/exec.rb +13 -1
  139. data/lib/puppet/indirector/request.rb +4 -0
  140. data/lib/puppet/metatype/manager.rb +17 -10
  141. data/lib/puppet/network/authstore.rb +1 -1
  142. data/lib/puppet/network/rights.rb +1 -2
  143. data/lib/puppet/node/environment.rb +1 -0
  144. data/lib/puppet/parameter/value.rb +9 -3
  145. data/lib/puppet/parser/ast.rb +1 -4
  146. data/lib/puppet/parser/files.rb +1 -1
  147. data/lib/puppet/parser/functions.rb +68 -22
  148. data/lib/puppet/parser/functions/create_resources.rb +2 -3
  149. data/lib/puppet/parser/functions/shellquote.rb +21 -25
  150. data/lib/puppet/parser/lexer.rb +40 -6
  151. data/lib/puppet/parser/relationship.rb +3 -1
  152. data/lib/puppet/parser/resource.rb +2 -3
  153. data/lib/puppet/parser/resource/param.rb +3 -5
  154. data/lib/puppet/parser/scope.rb +7 -4
  155. data/lib/puppet/property.rb +5 -3
  156. data/lib/puppet/provider.rb +5 -5
  157. data/lib/puppet/provider/aixobject.rb +1 -1
  158. data/lib/puppet/provider/augeas/augeas.rb +1 -1
  159. data/lib/puppet/provider/exec/windows.rb +1 -1
  160. data/lib/puppet/provider/file/windows.rb +10 -29
  161. data/lib/puppet/provider/group/groupadd.rb +2 -3
  162. data/lib/puppet/provider/group/ldap.rb +1 -1
  163. data/lib/puppet/provider/group/windows_adsi.rb +1 -1
  164. data/lib/puppet/provider/ldap.rb +5 -1
  165. data/lib/puppet/provider/nameservice.rb +3 -3
  166. data/lib/puppet/provider/nameservice/directoryservice.rb +2 -2
  167. data/lib/puppet/provider/package/gem.rb +6 -2
  168. data/lib/puppet/provider/package/portage.rb +4 -2
  169. data/lib/puppet/provider/parsedfile.rb +1 -1
  170. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
  171. data/lib/puppet/provider/service/base.rb +2 -41
  172. data/lib/puppet/provider/service/daemontools.rb +1 -1
  173. data/lib/puppet/provider/service/launchd.rb +1 -1
  174. data/lib/puppet/provider/service/redhat.rb +6 -5
  175. data/lib/puppet/provider/service/runit.rb +1 -1
  176. data/lib/puppet/provider/service/service.rb +43 -0
  177. data/lib/puppet/provider/service/windows.rb +1 -8
  178. data/lib/puppet/provider/user/user_role_add.rb +2 -1
  179. data/lib/puppet/provider/user/useradd.rb +8 -3
  180. data/lib/puppet/provider/user/windows_adsi.rb +12 -1
  181. data/lib/puppet/provider/zone/solaris.rb +1 -1
  182. data/lib/puppet/rails/inventory_node.rb +26 -13
  183. data/lib/puppet/reports.rb +1 -1
  184. data/lib/puppet/resource.rb +20 -5
  185. data/lib/puppet/resource/status.rb +1 -1
  186. data/lib/puppet/ssl/certificate_authority.rb +2 -0
  187. data/lib/puppet/ssl/host.rb +31 -6
  188. data/lib/puppet/test/test_helper.rb +3 -1
  189. data/lib/puppet/transaction/event.rb +1 -1
  190. data/lib/puppet/transaction/report.rb +2 -2
  191. data/lib/puppet/type.rb +30 -25
  192. data/lib/puppet/type/augeas.rb +1 -1
  193. data/lib/puppet/type/cron.rb +2 -2
  194. data/lib/puppet/type/exec.rb +6 -6
  195. data/lib/puppet/type/file.rb +5 -15
  196. data/lib/puppet/type/file/content.rb +1 -1
  197. data/lib/puppet/type/file/ensure.rb +1 -1
  198. data/lib/puppet/type/file/mode.rb +1 -1
  199. data/lib/puppet/type/file/selcontext.rb +6 -2
  200. data/lib/puppet/type/file/source.rb +1 -1
  201. data/lib/puppet/type/mount.rb +1 -1
  202. data/lib/puppet/type/package.rb +1 -1
  203. data/lib/puppet/type/schedule.rb +1 -1
  204. data/lib/puppet/type/scheduled_task.rb +1 -1
  205. data/lib/puppet/type/tidy.rb +1 -1
  206. data/lib/puppet/type/whit.rb +16 -9
  207. data/lib/puppet/util.rb +27 -11
  208. data/lib/puppet/util/adsi.rb +25 -23
  209. data/lib/puppet/util/autoload.rb +1 -1
  210. data/lib/puppet/util/classgen.rb +1 -1
  211. data/lib/puppet/util/feature.rb +3 -1
  212. data/lib/puppet/util/fileparsing.rb +9 -9
  213. data/lib/puppet/util/filetype.rb +55 -40
  214. data/lib/puppet/util/instance_loader.rb +5 -5
  215. data/lib/puppet/util/instrumentation.rb +3 -5
  216. data/lib/puppet/util/log_paths.rb +1 -3
  217. data/lib/puppet/util/monkey_patches.rb +34 -8
  218. data/lib/puppet/util/platform.rb +7 -0
  219. data/lib/puppet/util/posix.rb +3 -3
  220. data/lib/puppet/util/provider_features.rb +2 -3
  221. data/lib/puppet/util/rdoc.rb +4 -3
  222. data/lib/puppet/util/reference.rb +1 -1
  223. data/lib/puppet/util/selinux.rb +31 -36
  224. data/lib/puppet/util/tagging.rb +28 -6
  225. data/lib/puppet/util/windows.rb +1 -0
  226. data/lib/puppet/util/windows/error.rb +1 -1
  227. data/lib/puppet/util/windows/process.rb +3 -3
  228. data/lib/puppet/util/windows/security.rb +9 -46
  229. data/lib/puppet/util/windows/sid.rb +96 -0
  230. data/lib/puppet/util/windows/user.rb +65 -2
  231. data/lib/puppet/util/zaml.rb +109 -59
  232. data/lib/puppet/version.rb +18 -0
  233. data/spec/fixtures/unit/util/filetype/aixtab_output +44 -0
  234. data/spec/fixtures/unit/util/filetype/suntab_output +9 -0
  235. data/spec/integration/defaults_spec.rb +26 -7
  236. data/spec/integration/parser/functions_spec.rb +0 -4
  237. data/spec/integration/util/file_locking_spec.rb +1 -1
  238. data/spec/integration/util/windows/security_spec.rb +3 -23
  239. data/spec/lib/puppet_spec/files.rb +3 -3
  240. data/spec/shared_contexts/platform.rb +8 -0
  241. data/spec/spec_helper.rb +6 -1
  242. data/spec/unit/application/queue_spec.rb +2 -1
  243. data/spec/unit/configurer_spec.rb +1 -1
  244. data/spec/unit/face/{instrumentation_data.rb → instrumentation_data_spec.rb} +0 -0
  245. data/spec/unit/face/{instrumentation_listener.rb → instrumentation_listener_spec.rb} +0 -0
  246. data/spec/unit/face/{instrumentation_probe.rb → instrumentation_probe_spec.rb} +0 -0
  247. data/spec/unit/indirector/catalog/static_compiler_spec.rb +194 -0
  248. data/spec/unit/indirector/certificate/disabled_ca_spec.rb +33 -0
  249. data/spec/unit/indirector/certificate_request/disabled_ca_spec.rb +33 -0
  250. data/spec/unit/indirector/certificate_revocation_list/disabled_ca_spec.rb +33 -0
  251. data/spec/unit/indirector/key/disabled_ca_spec.rb +33 -0
  252. data/spec/unit/indirector/request_spec.rb +22 -0
  253. data/spec/unit/network/http/webrick_spec.rb +0 -7
  254. data/spec/unit/node/environment_spec.rb +8 -8
  255. data/spec/unit/parser/ast_spec.rb +0 -5
  256. data/spec/unit/parser/collector_spec.rb +1 -0
  257. data/spec/unit/parser/files_spec.rb +2 -2
  258. data/spec/unit/parser/functions/create_resources_spec.rb +3 -4
  259. data/spec/unit/parser/functions/require_spec.rb +0 -6
  260. data/spec/unit/parser/functions/shellquote_spec.rb +0 -5
  261. data/spec/unit/parser/functions/template_spec.rb +6 -1
  262. data/spec/unit/parser/functions_spec.rb +73 -23
  263. data/spec/unit/parser/lexer_spec.rb +133 -8
  264. data/spec/unit/parser/relationship_spec.rb +24 -0
  265. data/spec/unit/parser/resource_spec.rb +0 -4
  266. data/spec/unit/parser/scope_spec.rb +2 -2
  267. data/spec/unit/property_spec.rb +21 -1
  268. data/spec/unit/provider/exec/posix_spec.rb +7 -6
  269. data/spec/unit/provider/file/windows_spec.rb +29 -29
  270. data/spec/unit/provider/group/groupadd_spec.rb +36 -30
  271. data/spec/unit/provider/group/windows_adsi_spec.rb +2 -2
  272. data/spec/unit/provider/package/gem_spec.rb +12 -0
  273. data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +14 -11
  274. data/spec/unit/provider/service/redhat_spec.rb +11 -1
  275. data/spec/unit/provider/service/windows_spec.rb +19 -0
  276. data/spec/unit/provider/user/ldap_spec.rb +22 -8
  277. data/spec/unit/provider/user/user_role_add_spec.rb +12 -0
  278. data/spec/unit/provider/user/useradd_spec.rb +146 -118
  279. data/spec/unit/provider/user/windows_adsi_spec.rb +24 -2
  280. data/spec/unit/puppet_spec.rb +10 -0
  281. data/spec/unit/resource/status_spec.rb +1 -1
  282. data/spec/unit/resource_spec.rb +73 -0
  283. data/spec/unit/ssl/certificate_authority_spec.rb +25 -1
  284. data/spec/unit/ssl/host_spec.rb +73 -27
  285. data/spec/unit/ssl/key_spec.rb +0 -4
  286. data/spec/unit/transaction/event_spec.rb +1 -1
  287. data/spec/unit/type/exec_spec.rb +1 -1
  288. data/spec/unit/type/file/content_spec.rb +6 -4
  289. data/spec/unit/type/file/{ctime.rb → ctime_spec.rb} +0 -0
  290. data/spec/unit/type/file/{mtime.rb → mtime_spec.rb} +0 -0
  291. data/spec/unit/type/file/{type.rb → type_spec.rb} +0 -0
  292. data/spec/unit/type/file_spec.rb +2 -12
  293. data/spec/unit/type/host_spec.rb +14 -5
  294. data/spec/unit/type/mount_spec.rb +8 -0
  295. data/spec/unit/type/scheduled_task_spec.rb +2 -2
  296. data/spec/unit/util/adsi_spec.rb +23 -8
  297. data/spec/unit/util/command_line_spec.rb +11 -2
  298. data/spec/unit/util/feature_spec.rb +12 -1
  299. data/spec/unit/util/filetype_spec.rb +161 -55
  300. data/spec/unit/util/log_spec.rb +1 -1
  301. data/spec/unit/util/monkey_patches_spec.rb +7 -0
  302. data/spec/unit/util/rdoc_spec.rb +8 -2
  303. data/spec/unit/util/selinux_spec.rb +24 -32
  304. data/spec/unit/util/windows/sid_spec.rb +100 -0
  305. data/spec/unit/util/zaml_spec.rb +165 -25
  306. data/spec/unit/util_spec.rb +3 -9
  307. data/spec/watchr.rb +2 -6
  308. data/tasks/rake/gem.rake +4 -2
  309. data/tasks/rake/sign.rake +1 -1
  310. data/test/language/parser.rb +1 -0
  311. data/test/language/scope.rb +0 -5
  312. data/test/language/snippets.rb +1 -2
  313. data/test/lib/puppettest.rb +16 -27
  314. data/test/lib/puppettest/parsertesting.rb +0 -1
  315. data/test/network/authstore.rb +2 -4
  316. data/test/puppet/defaults.rb +0 -4
  317. data/test/util/fileparsing.rb +2 -6
  318. metadata +1706 -1617
  319. data/conf/osx/preflight +0 -24
  320. data/spec/spec.opts +0 -4
  321. data/spec/unit/file_collection/lookup_spec.rb +0 -45
  322. data/spec/unit/file_collection_spec.rb +0 -52
  323. data/tasks/rake/apple.rake +0 -176
  324. data/test/puppet/errortest.rb +0 -19
@@ -0,0 +1,68 @@
1
+ if @build_gem
2
+ require 'rubygems/package_task'
3
+
4
+ def glob_gem_files
5
+ gem_files = []
6
+ gem_excludes_file_list = []
7
+ gem_excludes_raw = @gem_excludes.nil? ? [] : @gem_excludes.split(' ')
8
+ gem_excludes_raw << 'ext/packaging'
9
+ gem_excludes_raw.each do |exclude|
10
+ if File.directory?(exclude)
11
+ gem_excludes_file_list += FileList["#{exclude}/**/*"]
12
+ else
13
+ gem_excludes_file_list << exclude
14
+ end
15
+ end
16
+ files = FileList[@gem_files.split(' ')]
17
+ files.each do |file|
18
+ if File.directory?(file)
19
+ gem_files += FileList["#{file}/**/*"]
20
+ else
21
+ gem_files << file
22
+ end
23
+ end
24
+ gem_files = gem_files - gem_excludes_file_list
25
+ end
26
+
27
+ spec = Gem::Specification.new do |s|
28
+ s.name = @name unless @name.nil?
29
+ s.name = @gem_name unless @gem_name.nil?
30
+ s.version = @gemversion unless @gemversion.nil?
31
+ s.author = @author unless @author.nil?
32
+ s.email = @email unless @email.nil?
33
+ s.homepage = @homepage unless @homepage.nil?
34
+ s.summary = @summary unless @summary.nil?
35
+ s.summary = @gem_summary unless @gem_summary.nil?
36
+ s.description = @description unless @description.nil?
37
+ s.description = @gem_description unless @gem_description.nil?
38
+ s.files = glob_gem_files unless glob_gem_files.nil?
39
+ s.executables = @gem_executables unless @gem_executables.nil?
40
+ s.require_path = @gem_require_path unless @gem_require_path.nil?
41
+ s.test_files = FileList[@gem_test_files.split(' ')] unless @gem_test_files.nil?
42
+ s.rubyforge_project = @gem_forge_project unless @gem_forge_project.nil?
43
+
44
+ @gem_runtime_dependencies.each do |gem, version|
45
+ s.add_runtime_dependency("#{gem}", "#{version}") unless (version.nil? or version.empty?)
46
+ s.add_runtime_dependency("#{gem}") if (version.nil? or version.empty?)
47
+ end unless @gem_runtime_dependencies.nil?
48
+
49
+ @gem_devel_dependencies.each do |gem, version|
50
+ s.add_devel_dependency("#{gem}", "#{version}") unless (version.nil? or version.empty?)
51
+ s.add_devel_dependency("#{gem}") if (version.nil? or version.empty?)
52
+ end unless @gem_devel_dependencies.nil?
53
+
54
+ @gem_rdoc_options.each do |option|
55
+ s.rdoc_options << option
56
+ end unless @gem_rdoc_options.nil?
57
+ end
58
+
59
+ namespace :package do
60
+ gem_task = Gem::PackageTask.new(spec)
61
+ desc "Build a gem"
62
+ task :gem => [ "clean" ] do
63
+ gem_task.define
64
+ Rake::Task[:gem].invoke
65
+ rm_rf "pkg/#{@name}-#{@gemversion}"
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,80 @@
1
+ if @build_ips
2
+ require 'erb'
3
+ namespace :package do
4
+ namespace :ips do
5
+ workdir = "pkg/ips"
6
+ proto = workdir + '/proto'
7
+ repo = workdir + '/repo'
8
+ pkgs = workdir + '/pkgs'
9
+ repouri = "file://#{`pwd`.strip + '/' + repo}"
10
+ artifact = "#{pkgs}/#{@name}@#{@ipsversion}.p5p"
11
+
12
+ # Create a source repo
13
+ # We dont clean the base pkg directory only ips work dir.
14
+ task :clean do
15
+ %x[rm -rf #{workdir}]
16
+ end
17
+
18
+ # Create an installation image at ips/proto
19
+ task :prepare => :clean do
20
+ check_tool('pkgsend')
21
+ x %[mkdir -p #{workdir}]
22
+ x %[gmake -f ext/ips/rules DESTDIR=#{proto} 2>#{workdir}/build.out ]
23
+ end
24
+
25
+ # Process templates and write the initial manifest
26
+ task :prototmpl do
27
+ erb("ext/ips/#{@name}.p5m.erb", workdir + '/' + @name + '.p5m.x')
28
+ end
29
+
30
+ # Update manifest to include the installation image information.
31
+ task :protogen => :prototmpl do
32
+ x %[pkgsend generate #{proto} >> #{workdir}/#{@name}.p5m.x ]
33
+ os=%x[uname -p].chomp
34
+ end
35
+
36
+ # Generate and resolve dependency list
37
+ task :protodeps => :protogen do
38
+ x %[pkgdepend generate -d #{proto} #{workdir}/#{@name}.p5m.x > #{workdir}/#{@name}.depends ]
39
+ x %[pkgdepend resolve -m #{workdir}/#{@name}.depends ]
40
+ x %[cat #{workdir}/#{@name}.depends.res >> #{workdir}/#{@name}.p5m.x]
41
+ end
42
+
43
+ # Mogrify manifest to remove unncecessary info, and other kinds of transforms.
44
+ task :protomogrify => :protodeps do
45
+ x %[pkgmogrify ./ext/ips/transforms ./#{workdir}/#{@name}.p5m.x| pkgfmt >> #{workdir}/#{@name}.p5m ]
46
+ end
47
+
48
+ # Generate and resolve dependency list
49
+ task :license => :protomogrify do
50
+ x %[cp LICENSE #{proto}/#{@name}.license]
51
+ end
52
+
53
+ # Ensure that our manifest is sane.
54
+ task :lint => :license do
55
+ x %[pkglint #{workdir}/#{@name}.p5m]
56
+ end
57
+
58
+ task :package => :lint do
59
+ x %[rm -rf #{pkgs}]
60
+ x %[mkdir -p #{pkgs}]
61
+ x %[pkgrepo create #{repo}]
62
+ x %[pkgrepo set -s #{repo} publisher/prefix=puppetlabs.com]
63
+ x %[pkgsend -s #{repouri} publish -d #{proto} --fmri-in-manifest #{workdir}/#{@name}.p5m]
64
+ x %[rm -f #{artifact}]
65
+ x %[pkgrecv -s #{repouri} -a -d #{artifact} #{@name}@#{@ipsversion}]
66
+ end
67
+
68
+ task :dry_install do
69
+ x %[pkg install -nv -g #{artifact} #{@name}@#{@ipsversion}]
70
+ end
71
+ end
72
+
73
+ desc "Creates an ips version"
74
+ task :ips do
75
+ Rake::Task['package:ips:prepare'].invoke
76
+ Rake::Task['package:ips:package'].invoke
77
+ end
78
+
79
+ end
80
+ end
@@ -0,0 +1,126 @@
1
+
2
+ def mock(mock_config, srpm)
3
+ check_tool('mock')
4
+ sh "mock -r #{mock_config} #{srpm}"
5
+ end
6
+
7
+ def srpm_file
8
+ srpm = Dir["pkg/srpm/*.rpm"][0]
9
+ check_file(srpm)
10
+ srpm
11
+ end
12
+
13
+ def mock_el_family(mock_config)
14
+ if @build_pe
15
+ family = mock_config.split('-')[2][/[a-z]+/]
16
+ else
17
+ family = mock_config.split('-')[0]
18
+ family = 'el' if family == 'pl'
19
+ end
20
+ family
21
+ end
22
+
23
+ def mock_el_ver(mock_config)
24
+ if @build_pe
25
+ version = mock_config.split('-')[2][/[0-9]+/]
26
+ else
27
+ version = mock_config.split('-')[1]
28
+ version = "f#{version}" if mock_config.split('-')[0] == 'fedora'
29
+ end
30
+ version
31
+ end
32
+
33
+ def mock_arch(mock_config)
34
+ if @build_pe
35
+ arch = mock_config.split('-')[3]
36
+ else
37
+ arch = mock_config.split('-')[2]
38
+ end
39
+ end
40
+
41
+ def build_rpm_with_mock(mocks, is_rc, subdir)
42
+ mocks.split(' ').each do |mock_config|
43
+ family = mock_el_family(mock_config)
44
+ version = mock_el_ver(mock_config)
45
+ arch = mock_arch(mock_config)
46
+ result = "/var/lib/mock/#{mock_config}/result/*.rpm"
47
+
48
+ mock(mock_config, srpm_file)
49
+
50
+ Dir[result].each do |rpm|
51
+ rpm.strip!
52
+ unless ENV['RC_OVERRIDE'] == '1'
53
+ if is_rc == FALSE and rpm =~ /[0-9]+rc[0-9]+\./
54
+ puts "It looks like you might be trying to ship an RC to the production repos. Leaving rpm in #{result}. Pass RC_OVERRIDE=1 to override."
55
+ next
56
+ elsif is_rc and rpm !~ /[0-9]+rc[0-9]+\./
57
+ puts "It looks like you might be trying to ship a production release to the development repos. Leaving rpm in #{result}. Pass RC_OVERRIDE=1 to override."
58
+ next
59
+ end
60
+ end
61
+
62
+ if @build_pe
63
+ case File.basename(rpm)
64
+ when /debuginfo/
65
+ rm_rf(rpm)
66
+ when /src\.rpm/
67
+ cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-srpms")
68
+ when /i.?86/
69
+ cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-i386")
70
+ when /x66_64/
71
+ cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-x86_64")
72
+ when /noarch/
73
+ cp_pr(rpm, "pkg/pe/rpm/#{family}-#{version}-i386")
74
+ ln("pkg/pe/rpm/#{family}-#{version}-i386/#{File.basename(rpm)}", "pkg/pe/rpm/#{family}-#{version}-x86_64/")
75
+ end
76
+ else
77
+ case File.basename(rpm)
78
+ when /debuginfo/
79
+ rm_rf(rpm)
80
+ when /src\.rpm/
81
+ cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/SRPMS")
82
+ when /i.?86/
83
+ cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/i386")
84
+ when /x86_64/
85
+ cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/x86_64")
86
+ when /noarch/
87
+ cp_pr(rpm, "pkg/#{family}/#{version}/#{subdir}/i386")
88
+ ln("pkg/#{family}/#{version}/#{subdir}/i386/#{File.basename(rpm)}", "pkg/#{family}/#{version}/#{subdir}/x86_64/")
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
94
+
95
+
96
+ namespace :pl do
97
+ task :setup_el_dirs do
98
+ if @build_pe
99
+ %x{mkdir -p pkg/pe/rpm/sles-11-{i586,x86_64,srpms}}
100
+ %x{mkdir -p pkg/pe/rpm/el-{5,6}-{i386,x86_64,srpms}}
101
+ else
102
+ %x{mkdir -p pkg/el/{5,6}/{products,devel,dependencies}/{SRPMS,i386,x86_64}}
103
+ %x{mkdir -p pkg/fedora/{f15,f16,f17}/{products,devel,dependencies}/{SRPMS,i386,x86_64}}
104
+ end
105
+ end
106
+
107
+ desc "Use default mock to make a final rpm, keyed to PL infrastructure, pass MOCK to specify config"
108
+ task :mock => [ "package:srpm", "pl:setup_el_dirs" ] do
109
+ # If default mock isn't specified, just take the first one in the @final_mocks list
110
+ @default_mock ||= @final_mocks.split(' ')[0]
111
+ subdir = ENV['subdir'] || 'products'
112
+ build_rpm_with_mock(@default_mock, FALSE, subdir)
113
+ end
114
+
115
+ desc "Use specified mocks to make final rpms, keyed to PL infrastructure, pass MOCK to specifiy config"
116
+ task :mock_final => [ "package:srpm", "pl:setup_el_dirs" ] do
117
+ subdir = ENV['subdir'] || 'products'
118
+ build_rpm_with_mock(@final_mocks, FALSE, subdir)
119
+ end
120
+
121
+ desc "Use specified mocks to make RC rpms, keyed to PL infrastructure, pass MOCK to specify config"
122
+ task :mock_rc => [ "package:srpm", "pl:setup_el_dirs" ] do
123
+ subdir = 'devel'
124
+ build_rpm_with_mock(@rc_mocks, TRUE, subdir)
125
+ end
126
+ end
@@ -0,0 +1,9 @@
1
+ if @build_pe
2
+ namespace :pe do
3
+ desc "Create a PE deb from this repo using the default cow #{@default_cow}."
4
+ task :local_deb => "pl:deb"
5
+
6
+ desc "Create PE debs from this git repository using all cows specified in build_defaults yaml"
7
+ task :local_deb_all => "pl:deb_all"
8
+ end
9
+ end
@@ -0,0 +1,45 @@
1
+ if @build_pe
2
+ namespace :pe do
3
+ desc "Execute remote debian build using default cow on builder and retrieve package"
4
+ task :deb => ['pl:fetch', 'pl:load_extras'] do
5
+ ENV['PE_VER'] ||= @pe_version
6
+ check_var('PE_VER', ENV['PE_VER'])
7
+ Rake::Task["pl:remote_build"].reenable
8
+ Rake::Task["pl:remote_build"].invoke(@deb_build_host, 'HEAD', "pe:local_deb PE_VER=#{ENV['PE_VER']}")
9
+ end
10
+
11
+ desc "Execute remote debian build using ALL cows on builder and retrieve packages"
12
+ task :deb_all => ['pl:fetch', 'pl:load_extras'] do
13
+ ENV['PE_VER'] ||= @pe_version
14
+ check_var('PE_VER', ENV['PE_VER'])
15
+ Rake::Task["pl:remote_build"].reenable
16
+ Rake::Task["pl:remote_build"].invoke(@deb_build_host, 'HEAD', "pe:local_deb_all PE_VER=#{ENV['PE_VER']}")
17
+ end
18
+
19
+ desc "Execute remote rpm build using default mock on builder and retrieve package"
20
+ task :mock => ['pl:fetch', 'pl:load_extras'] do
21
+ Rake::Task["pl:remote_build"].reenable
22
+ Rake::Task["pl:remote_build"].invoke(@rpm_build_host, 'HEAD', "pe:local_mock TEAM=#{@team}")
23
+ end
24
+
25
+ desc "Execute remote rpm build with ALL mocks on builder and retrieve packages"
26
+ task :mock_all => ['pl:fetch', 'pl:load_extras'] do
27
+ Rake::Task["pl:remote_build"].reenable
28
+ Rake::Task["pl:remote_build"].invoke(@rpm_build_host, 'HEAD', "pe:local_mock_final TEAM=#{@team}")
29
+ end
30
+
31
+ desc "Execute remote sles rpm build and retrieve package"
32
+ task :sles => ['pl:fetch', 'pl:load_extras'] do
33
+ Rake::Task["pl:remote_build"].reenable
34
+ Rake::Task["pl:remote_build"].invoke(@sles_build_host, 'HEAD', "pe:local_sles TEAM=#{@team}")
35
+ end
36
+
37
+ desc "Execute remote debian, el, and sles builds, sign, and ship pkgs"
38
+ task :all => ['clean', 'pl:fetch', 'pl:load_extras'] do
39
+ ['pe:deb', 'pe:mock_all', 'pe:sles', 'pe:ship_rpms', 'pe:ship_debs'].each do |task|
40
+ Rake::Task[task].execute
41
+ end
42
+ end
43
+ end
44
+ end
45
+
@@ -0,0 +1,21 @@
1
+ if @build_pe
2
+ namespace :pe do
3
+ desc "Build a PE rpm using rpmbuild (requires all BuildRequires, rpmbuild, etc)"
4
+ task :local_rpm => "package:rpm"
5
+
6
+ desc "Build rpms using ALL final mocks in build_defaults yaml, keyed to PL infrastructure, pass MOCK to override"
7
+ task :local_mock_final => ["pl:fetch", "pl:load_extras", "pl:mock_final"] do
8
+ if @team == 'release'
9
+ Rake::Task["pe:sign_rpms"].invoke
10
+ end
11
+ end
12
+
13
+ desc "Build a PE rpm using the default mock"
14
+ task :local_mock => ["pl:fetch", "pl:load_extras", "pl:mock" ] do
15
+ if @team == 'release'
16
+ Rake::Task["pe:sign_rpms"].invoke
17
+ end
18
+ end
19
+ end
20
+ end
21
+
@@ -0,0 +1,30 @@
1
+ if @build_pe
2
+ namespace :pe do
3
+ desc "ship PE rpms to #{@yum_host}"
4
+ task :ship_rpms => ["pl:load_extras"] do
5
+ rsync_to('pkg/pe/rpm/', @yum_host, "#{@yum_repo_path}/#{@pe_version}/repos/")
6
+ Rake::Task["pe:remote_update_yum_repo"].invoke
7
+ end
8
+
9
+ desc "Update remote rpm repodata for PE on #{@yum_host}"
10
+ task :remote_update_yum_repo => "pl:load_extras" do
11
+ remote_ssh_cmd(@yum_host, "for dir in $(find #{@apt_repo_path}/#{@pe_version}/repos/el* -type d | grep -v repodata | grep -v cache | xargs) ; do pushd $dir; sudo rm -rf repodata; createrepo -q -d .; popd &> /dev/null ; done; sync")
12
+ end
13
+
14
+ desc "Ship PE debs to #{@apt_host}"
15
+ task :ship_debs => "pl:load_extras" do
16
+ dist = @default_cow.split('-')[1]
17
+ if Dir["pkg/pe/deb/#{dist}/*"].empty?
18
+ STDERR.puts "The pkg/pe/deb/#{dist} directory has no packages. Did you run rake pe:deb?"
19
+ else
20
+ rsync_to("pkg/pe/deb/#{dist}/", @apt_host, "#{@apt_repo_path}/#{@pe_version}/repos/incoming/unified/")
21
+ Rake::Task["pe:remote_freight"].invoke
22
+ end
23
+ end
24
+
25
+ desc "remote freight PE packages to #{@apt_host}"
26
+ task :remote_freight => "pl:load_extras" do
27
+ remote_ssh_cmd(@apt_host, "sudo pe-the-things #{@pe_version} #{@apt_repo_path} #{@freight_conf}")
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,27 @@
1
+ # The sign_el5 and sign_modern methods are defined in sign.rake
2
+ # This is just adapted for the 'PE' layout
3
+
4
+ namespace :pe do
5
+ desc "Sign all staged in rpms in pkg"
6
+ task :sign_rpms do
7
+ old_rpms = FileList.new
8
+ modern_rpms = FileList.new
9
+ sign_dists = 'el5', 'el6', 'sles11'
10
+ ['i386', 'x86_64'].each do |arch|
11
+ sign_dists.each do |dist|
12
+ family=dist[/[a-z]+/]
13
+ version=dist[/[0-9]+/]
14
+ rpm_stagedir = "pkg/pe/rpm/#{family}-#{version}-#{arch}/*.rpm"
15
+ srpm_stagedir = "pkg/pe/rpm/#{family}-#{version}-srpms/*.rpm"
16
+ if family == 'el' and version == '6'
17
+ modern_rpms += FileList[rpm_stagedir] + FileList[srpm_stagedir]
18
+ else
19
+ old_rpms += FileList[rpm_stagedir] + FileList[srpm_stagedir]
20
+ end
21
+ end
22
+ end
23
+ sign_el5(old_rpms) unless old_rpms.empty?
24
+ sign_modern(modern_rpms) unless modern_rpms.empty?
25
+ end
26
+ end
27
+
@@ -0,0 +1,96 @@
1
+ # tasks for sles building
2
+
3
+ # take a tarball and stage it in a temp dir with appropriate
4
+ # directories/files set up for building an rpm.
5
+ # return the directory
6
+
7
+ if @build_pe
8
+ def prep_sles_dir
9
+ temp = get_temp
10
+ check_file("pkg/#{@name}-#{@version}.tar.gz")
11
+ mkdir_pr temp, "#{temp}/SOURCES", "#{temp}/SPECS"
12
+ if @sign_tar
13
+ Rake::Task["pl:sign_tar"].invoke
14
+ cp_p "pkg/#{@name}-#{@version}.tar.gz.asc", "#{temp}/SOURCES"
15
+ end
16
+ cp_p "pkg/#{@name}-#{@version}.tar.gz", "#{temp}/SOURCES"
17
+ erb "ext/redhat/#{@name}.spec.erb", "#{temp}/SPECS/#{@name}.spec"
18
+ temp
19
+ end
20
+
21
+ namespace :pe do
22
+ # Temporary task to pull down pe dependencies until this is NFS-mounted
23
+ task :retrieve_sles_deps => 'pl:load_extras' do
24
+ rsync_from("#{@sles_repo_path}/#{@pe_version}/repos/sles-*", @sles_repo_host, "#{ENV['HOME']}/package_repos/")
25
+ FileList["#{ENV['HOME']}/package_repos/*"].each do |f|
26
+ update_rpm_repo(f) if File.directory?(f)
27
+ end
28
+ cd "#{ENV['HOME']}/package_repos" do
29
+ unless File.symlink?('sles-11-i586')
30
+ if File.exist?('sles-11-i586')
31
+ rm_rf 'sles-11-i586'
32
+ end
33
+ File.symlink('sles-11-i386', 'sles-11-i586')
34
+ end
35
+ end
36
+ end
37
+
38
+ # pl:setup_el_dirs is defined in mock.rake
39
+ desc "Build a sles rpm from this repo"
40
+ task :local_sles => ['package:tar', 'pl:setup_el_dirs', 'pl:fetch', 'pl:load_extras', 'pe:retrieve_sles_deps'] do
41
+ check_tool('build')
42
+ check_tool('linux32')
43
+ check_tool('linux64')
44
+ build_root = get_temp
45
+ work_dir = prep_sles_dir
46
+ build_source_dir = "#{work_dir}/SOURCES"
47
+ build_spec_dir = "#{work_dir}/SPECS"
48
+ build_spec = "#{build_spec_dir}/#{@name}.spec"
49
+ build_dest_dir = "usr/src/packages"
50
+ noarch = FALSE
51
+ build_dep_dir = @sles_build_deps_dir
52
+ build_os_dep_dir = @sles_build_iso_dir
53
+ built_arch = ''
54
+ @sles_arch_repos.each do |arch, deps_repo|
55
+ if noarch == FALSE
56
+ linux_cmd = arch == 'i586' ? 'linux32' : 'linux64'
57
+ sh "yes | sudo #{linux_cmd} build \
58
+ --rpms #{deps_repo}:#{ENV['HOME']}/package_repos/sles-11-#{arch} \
59
+ --root #{build_root}/#{arch} \
60
+ --rsync-src #{build_source_dir} \
61
+ --rsync-dest /usr/src/packages/SOURCES \
62
+ --no-checks #{build_spec} \
63
+ --arch #{arch} || true"
64
+ rpms = FileList["#{build_root}/#{arch}/#{build_dest_dir}/RPMS/**/*.rpm"]
65
+ srpms = FileList["#{build_root}/#{arch}/#{build_dest_dir}/SRPMS/**/*.rpm"]
66
+ if rpms.empty?
67
+ STDERR.puts "No RPMS were built. Perhaps an error occurred?"
68
+ exit 1
69
+ end
70
+ built_arch = arch
71
+ cp rpms, "pkg/pe/rpm/sles-11-#{arch}"
72
+ cp srpms, "pkg/pe/rpm/sles-11-srpms"
73
+ noarch = rpms.exclude(/noarch/).empty?
74
+ rm_rf build_root
75
+ rm_rf work_dir
76
+ else
77
+ arches_to_copy_to = @sles_arch_repos.keys - [ built_arch ]
78
+ arches_to_copy_to.each do |other_arch|
79
+ cp FileList["pkg/pe/rpm/sles-11-#{built_arch}/*"], "pkg/pe/rpm/sles-11-#{other_arch}"
80
+ end
81
+ end
82
+ end
83
+ cd 'pkg/pe/rpm' do
84
+ if File.exist?('sles-11-i586')
85
+ mkdir_p 'sles-11-i386'
86
+ cp FileList["sles-11-i586/*"], 'sles-11-i386'
87
+ rm_rf 'sles-11-i586'
88
+ end
89
+ end
90
+ if @team == 'release'
91
+ Rake::Task["pe:sign_rpms"].invoke
92
+ end
93
+ end
94
+ end
95
+ end
96
+