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,71 @@
1
+ require 'yaml'
2
+ require 'erb'
3
+
4
+ begin
5
+ @project_specs ||= YAML.load_file('ext/project_data.yaml')
6
+ @name = @project_specs['project']
7
+ @author = @project_specs['author']
8
+ @email = @project_specs['email']
9
+ @homepage = @project_specs['homepage']
10
+ @summary = @project_specs['summary']
11
+ @description = @project_specs['description']
12
+ @files = @project_specs['files']
13
+ @tar_excludes = @project_specs['tar_excludes']
14
+ @version_file = @project_specs['version_file']
15
+ @gem_files = @project_specs['gem_files']
16
+ @gem_require_path = @project_specs['gem_require_path']
17
+ @gem_test_files = @project_specs['gem_test_files']
18
+ @gem_executables = @project_specs['gem_executables']
19
+ @gem_runtime_dependencies = @project_specs['gem_runtime_dependencies']
20
+ @gem_devel_dependencies = @project_specs['gem_devel_dependencies']
21
+ @gem_rdoc_options = @project_specs['gem_rdoc_options']
22
+ @gem_forge_project = @project_specs['gem_forge_project']
23
+ @gem_excludes = @project_specs['gem_excludes']
24
+ rescue => e
25
+ STDERR.puts "There was an error loading the project specifications from the 'ext/project_data.yaml' file.\n" + e
26
+ exit 1
27
+ end
28
+
29
+ begin
30
+ @pkg_defaults ||= YAML.load_file('ext/build_defaults.yaml')
31
+ @sign_tar = boolean_value( ENV['SIGN_TAR'] || @pkg_defaults['sign_tar'] )
32
+ @build_gem = boolean_value( ENV['GEM'] || @pkg_defaults['build_gem'] )
33
+ @build_dmg = boolean_value( ENV['DMG'] || @pkg_defaults['build_dmg'] )
34
+ @build_ips = boolean_value( ENV['IPS'] || @pkg_defaults['build_ips'] )
35
+ @build_doc = boolean_value( ENV['DOC'] || @pkg_defaults['build_doc'] )
36
+ @build_pe = boolean_value( ENV['PE'] || @pkg_defaults['build_pe'] )
37
+ @default_cow = ENV['COW'] || @pkg_defaults['default_cow']
38
+ @cows = ENV['COW'] || @pkg_defaults['cows']
39
+ @pbuild_conf = ENV['PBUILDCONF'] || @pkg_defaults['pbuild_conf']
40
+ @packager = ENV['PACKAGER'] || @pkg_defaults['packager']
41
+ @default_mock = ENV['MOCK'] || @pkg_defaults['default_mock']
42
+ @final_mocks = ENV['MOCK'] || @pkg_defaults['final_mocks']
43
+ @rc_mocks = ENV['MOCK'] || @pkg_defaults['rc_mocks']
44
+ @gpg_name = ENV['GPG_NAME'] || @pkg_defaults['gpg_name']
45
+ @gpg_key = ENV['GPG_KEY'] || @pkg_defaults['gpg_key']
46
+ @certificate_pem = ENV['CERT_PEM'] || @pkg_defaults['certificate_pem']
47
+ @privatekey_pem = ENV['PRIVATE_PEM'] || @pkg_defaults['privatekey_pem']
48
+ @yum_host = @pkg_defaults['yum_host']
49
+ @yum_repo_path = @pkg_defaults['yum_repo_path']
50
+ @apt_host = @pkg_defaults['apt_host']
51
+ @apt_repo_url = @pkg_defaults['apt_repo_url']
52
+ @apt_repo_path = @pkg_defaults['apt_repo_path']
53
+ @ips_repo = @pkg_defaults['ips_repo']
54
+ @ips_store = @pkg_defaults['ips_store']
55
+ @ips_host = @pkg_defaults['ips_host']
56
+ rescue => e
57
+ STDERR.puts "There was an error loading the packaging defaults from the 'ext/build_defaults.yaml' file.\n" + e
58
+ exit 1
59
+ end
60
+
61
+ @build_root ||= Dir.pwd
62
+ @version ||= @build_pe ? get_dot_version : get_dash_version
63
+ @gemversion ||= get_dot_version
64
+ @ipsversion ||= get_ips_version
65
+ @debversion ||= get_debversion
66
+ @origversion ||= get_origversion
67
+ @rpmversion ||= get_rpmversion
68
+ @rpmrelease ||= get_rpmrelease
69
+ @keychain_loaded ||= FALSE
70
+ @builder_data_file ||= 'builder_data.yaml'
71
+ @team ||= ENV['TEAM'] || 'pe'
@@ -0,0 +1,25 @@
1
+ namespace :pl do
2
+ task :load_extras do
3
+ begin
4
+ @build_data = YAML.load_file("#{ENV['HOME']}/.packaging/#{@builder_data_file}")
5
+ @rpm_build_host = @build_data['rpm_build_host'] if @build_data['rpm_build_host']
6
+ @deb_build_host = @build_data['deb_build_host'] if @build_data['deb_build_host']
7
+ @osx_build_host = @build_data['osx_build_host'] if @build_data['osx_build_host']
8
+ @tarball_path = @build_data['tarball_path'] if @build_data['tarball_path']
9
+ @dmg_path = @build_data['dmg_path'] if @build_data['dmg_path']
10
+ @pe_version = @build_data['pe_version'] if @build_data['pe_version']
11
+ @team = @build_data['team'] if @build_data['team']
12
+ @yum_repo_path = @build_data['yum_repo_path'] if @build_data['yum_repo_path']
13
+ @apt_repo_path = @build_data['apt_repo_path'] if @build_data['apt_repo_path']
14
+ @freight_conf = @build_data['freight_conf'] if @build_data['freight_conf']
15
+ @sles_build_host = @build_data['sles_build_host'] if @build_data['sles_build_host']
16
+ @sles_arch_repos = @build_data['sles_arch_repos'] if @build_data['sles_arch_repos']
17
+ @sles_repo_path = @build_data['sles_repo_path'] if @build_data['sles_repo_path']
18
+ @sles_repo_host = @build_data['sles_repo_host'] if @build_data['sles_repo_host']
19
+ rescue => e
20
+ STDERR.puts "There was an error loading the builder data from #{ENV['HOME']}/.packaging/#{@builder_data_file}. Try rake pl:fetch to download the current extras builder data.\n" + e
21
+ exit 1
22
+ end
23
+ end
24
+ end
25
+
@@ -0,0 +1,201 @@
1
+ # Title: Rake task to build Apple packages for #{@name}.
2
+ # Author: Gary Larizza
3
+ # Date: 05/18/2012
4
+ # Description: This task will create a DMG-encapsulated package that will
5
+ # install a package on OS X systems. This happens by building
6
+ # a directory tree of files that will then be fed to the
7
+ # packagemaker binary (can be installed by installing the
8
+ # XCode Tools) which will create the .pkg file.
9
+ #
10
+
11
+ # Path to Binaries (Constants)
12
+ TAR = '/usr/bin/tar'
13
+ CP = '/bin/cp'
14
+ INSTALL = '/usr/bin/install'
15
+ DITTO = '/usr/bin/ditto'
16
+ PACKAGEMAKER = '/Developer/usr/bin/packagemaker'
17
+ SED = '/usr/bin/sed'
18
+
19
+ # Setup task to populate all the variables
20
+ task :setup do
21
+ # Read the Apple file-mappings
22
+ begin
23
+ @source_files = YAML.load_file('ext/osx/file_mapping.yaml')
24
+ rescue
25
+ STDERR.puts "Could not load Apple file mappings from 'ext/osx/file_mapping.yaml'"
26
+ exit 1
27
+ end
28
+ @package_name = @name
29
+ @title = "#{@name}-#{@version}"
30
+ @reverse_domain = "com.#{@packager}.#{@package_name}"
31
+ @package_major_version = @version.split('.')[0]
32
+ @package_minor_version = @version.split('.')[1] +
33
+ @version.split('.')[2].split('-')[0].split('rc')[0]
34
+ @pm_restart = 'None'
35
+ @build_date = Time.new.strftime("%Y-%m-%dT%H:%M:%SZ")
36
+ @apple_bindir = '/usr/bin'
37
+ @apple_sbindir = '/usr/sbin'
38
+ @apple_libdir = '/usr/lib/ruby/site_ruby/1.8'
39
+ @apple_docdir = '/usr/share/doc'
40
+ end
41
+
42
+ # method: make_directory_tree
43
+ # description: This method sets up the directory structure that packagemaker
44
+ # needs to build a package. A prototype.plist file (holding
45
+ # package-specific options) is built from an ERB template located
46
+ # in the ext/osx directory.
47
+ def make_directory_tree
48
+ project_tmp = "#{get_temp}/#{@package_name}"
49
+ @scratch = "#{project_tmp}/#{@title}"
50
+ @working_tree = {
51
+ 'scripts' => "#{@scratch}/scripts",
52
+ 'resources' => "#{@scratch}/resources",
53
+ 'working' => "#{@scratch}/root",
54
+ 'payload' => "#{@scratch}/payload",
55
+ }
56
+ puts "Cleaning Tree: #{project_tmp}"
57
+ rm_rf(project_tmp)
58
+ @working_tree.each do |key,val|
59
+ mkdir_p(val)
60
+ end
61
+
62
+ erb 'ext/osx/preflight.erb', "#{@working_tree["scripts"]}/preflight"
63
+ erb 'ext/osx/prototype.plist.erb', "#{@scratch}/prototype.plist"
64
+
65
+ end
66
+
67
+ # method: build_dmg
68
+ # description: This method builds a package from the directory structure in
69
+ # /tmp/#{@name} and puts it in the
70
+ # /tmp/#{@name}/#{@name}-#{version}/payload directory. A DMG is
71
+ # created, using hdiutil, based on the contents of the
72
+ # /tmp/#{@name}/#{@name}-#{version}/payload directory. The resultant
73
+ # DMG is placed in the pkg/apple directory.
74
+ #
75
+ def build_dmg
76
+ # Local Variables
77
+ dmg_format_code = 'UDZO'
78
+ zlib_level = '9'
79
+ dmg_format_option = "-imagekey zlib-level=#{zlib_level}"
80
+ dmg_format = "#{dmg_format_code} #{dmg_format_option}"
81
+ dmg_file = "#{@title}.dmg"
82
+ package_file = "#{@title}.pkg"
83
+ pm_extra_args = '--verbose --no-recommend --no-relocate'
84
+ package_target_os = '10.4'
85
+
86
+ # Build .pkg file
87
+ system("sudo #{PACKAGEMAKER} --root #{@working_tree['working']} \
88
+ --id #{@reverse_domain} \
89
+ --filter DS_Store \
90
+ --target #{package_target_os} \
91
+ --title #{@title} \
92
+ --info #{@scratch}/prototype.plist \
93
+ --scripts #{@working_tree['scripts']} \
94
+ --resources #{@working_tree['resources']} \
95
+ --version #{@version} \
96
+ #{pm_extra_args} --out #{@working_tree['payload']}/#{package_file}")
97
+
98
+ # Build .dmg file
99
+ system("sudo hdiutil create -volname #{@title} \
100
+ -srcfolder #{@working_tree['payload']} \
101
+ -uid 99 \
102
+ -gid 99 \
103
+ -ov \
104
+ -format #{dmg_format} \
105
+ #{dmg_file}")
106
+
107
+ if File.directory?("#{pwd}/pkg/apple")
108
+ mv("#{pwd}/#{dmg_file}", "#{pwd}/pkg/apple/#{dmg_file}")
109
+ puts "moved: #{dmg_file} has been moved to #{pwd}/pkg/apple/#{dmg_file}"
110
+ else
111
+ mkdir_p("#{pwd}/pkg/apple")
112
+ mv(dmg_file, "#{pwd}/pkg/apple/#{dmg_file}")
113
+ puts "moved: #{dmg_file} has been moved to #{pwd}/pkg/apple/#{dmg_file}"
114
+ end
115
+ end
116
+
117
+ # method: pack_source
118
+ # description: This method copies the #{@name} source into a directory
119
+ # structure in /tmp/#{@name}/#{@name}-#{version}/root mirroring the
120
+ # structure on the target system for which the package will be
121
+ # installed. Anything installed into /tmp/#{@name}/root will be
122
+ # installed as the package's payload.
123
+ #
124
+ def pack_source
125
+ work = "#{@working_tree['working']}"
126
+ source = pwd
127
+
128
+ # Make all necessary directories
129
+ @source_files.each_value do |files|
130
+ files.each_value do |params|
131
+ mkdir_p "#{work}/#{params['path']}"
132
+ end
133
+ end
134
+
135
+ # Install directory contents into place
136
+ unless @source_files['directories'].nil?
137
+ @source_files['directories'].each do |dir, params|
138
+ unless FileList["#{source}/#{dir}/*"].empty?
139
+ cmd = "#{DITTO} #{source}/#{dir}/ #{work}/#{params['path']}"
140
+ puts cmd
141
+ system(cmd)
142
+ end
143
+ end
144
+ end
145
+
146
+ # Setup a preflight script and replace variables in the files with
147
+ # the correct paths.
148
+ chown('root', 'wheel', "#{@working_tree['scripts']}/preflight")
149
+ chmod(0644, "#{@working_tree['scripts']}/preflight")
150
+
151
+ # Do a run through first setting the specified permissions then
152
+ # making sure 755 is set for all directories
153
+ unless @source_files['directories'].nil?
154
+ @source_files['directories'].each do |dir, params|
155
+ owner = params['owner']
156
+ group = params['group']
157
+ perms = params['perms']
158
+ path = params['path']
159
+ chmod_R(Integer(perms), "#{work}/#{path}")
160
+ chown_R(owner, group, "#{work}/#{path}")
161
+ chmod(0755, "#{work}/#{path}")
162
+ Dir["#{work}/#{path}/**/*"].each do |file|
163
+ chmod(0755, file) if File.directory?(file)
164
+ end
165
+ end
166
+ end
167
+
168
+ # Install any files
169
+ unless @source_files['files'].nil?
170
+ @source_files['files'].each do |file, params|
171
+ owner = params['owner']
172
+ group = params['group']
173
+ perms = params['perms']
174
+ dest = params['path']
175
+ # Allow for regexs like [A-Z]*
176
+ FileList[file].each do |file|
177
+ cmd = "#{INSTALL} -o #{owner} -g #{group} -m #{perms} #{source}/#{file} #{work}/#{dest}"
178
+ puts cmd
179
+ system(cmd)
180
+ end
181
+ end
182
+ end
183
+ end
184
+
185
+ if @build_dmg
186
+ namespace :package do
187
+ desc "Task for building an Apple Package"
188
+ task :apple => [:setup] do
189
+ # Test for Root and Packagemaker binary
190
+ raise "Please run rake as root to build Apple Packages" unless Process.uid == 0
191
+ raise "Packagemaker must be installed. Please install XCode Tools" unless \
192
+ File.exists?('/Developer/usr/bin/packagemaker')
193
+
194
+ make_directory_tree
195
+ pack_source
196
+ build_dmg
197
+ chmod_R(0775, "#{pwd}/pkg")
198
+ end
199
+ end
200
+ end
201
+
@@ -0,0 +1,5 @@
1
+ desc "Clean all built packages, eg rm -rf pkg"
2
+ task :clean do
3
+ rm_rf 'pkg'
4
+ end
5
+
@@ -0,0 +1,108 @@
1
+ def pdebuild args
2
+ results_dir = args[:work_dir]
3
+ cow = args[:cow]
4
+ devel_repo = args[:devel]
5
+ set_cow_envs(cow)
6
+ update_cow(cow, devel_repo)
7
+ begin
8
+ sh "pdebuild --configfile #{@pbuild_conf} \
9
+ --buildresult #{results_dir} \
10
+ --pbuilder cowbuilder -- \
11
+ --basepath /var/cache/pbuilder/#{cow}/"
12
+ rescue Exception => e
13
+ puts e
14
+ handle_method_failure('pdebuild', args)
15
+ end
16
+ end
17
+
18
+ def update_cow(cow, is_rc = nil)
19
+ ENV['FOSS_DEVEL'] = is_rc
20
+ ENV['PATH'] = "/usr/sbin:#{ENV['PATH']}"
21
+ set_cow_envs(cow)
22
+ begin
23
+ sh "sudo -E /usr/sbin/cowbuilder --update --override-config --configfile #{@pbuild_conf} --basepath /var/cache/pbuilder/#{cow} --distribution #{ENV['DIST']} --architecture #{ENV['ARCH']}"
24
+ rescue
25
+ STDERR.puts "Couldn't update the cow #{cow}. Perhaps you don't have sudo?"
26
+ exit 1
27
+ end
28
+ end
29
+
30
+ def debuild args
31
+ results_dir = args[:work_dir]
32
+ begin
33
+ sh "debuild --no-lintian -uc -us"
34
+ rescue
35
+ STDERR.puts "Something went wrong. Hopefully the backscroll or #{results_dir}/#{@name}_#{@debversion}.build file has a clue."
36
+ exit 1
37
+ end
38
+ end
39
+
40
+ task :prep_deb_tars, :work_dir do |t,args|
41
+ work_dir = args.work_dir
42
+ cp_p "pkg/#{@name}-#{@version}.tar.gz", work_dir
43
+ cd work_dir do
44
+ sh "tar zxf #{@name}-#{@version}.tar.gz"
45
+ mv "#{@name}-#{@version}", "#{@name}-#{@debversion}"
46
+ mv "#{@name}-#{@version}.tar.gz", "#{@name}_#{@origversion}.orig.tar.gz"
47
+ end
48
+ end
49
+
50
+ task :build_deb, :deb_command, :cow, :devel do |t,args|
51
+ deb_build = args.deb_command
52
+ cow = args.cow
53
+ devel = args.devel
54
+ work_dir = get_temp
55
+ subdir = 'pe/' if @build_pe
56
+ dest_dir = "#{@build_root}/pkg/#{subdir}deb/#{cow.split('-')[1] unless cow.nil?}"
57
+ check_tool(deb_build)
58
+ mkdir_p dest_dir
59
+ deb_args = { :work_dir => work_dir, :cow => cow, :devel => devel}
60
+ Rake::Task[:prep_deb_tars].reenable
61
+ Rake::Task[:prep_deb_tars].invoke(work_dir)
62
+ cd "#{work_dir}/#{@name}-#{@debversion}" do
63
+ mv 'ext/debian', '.'
64
+ send(deb_build, deb_args)
65
+ cp FileList["#{work_dir}/*.deb", "#{work_dir}/*.dsc", "#{work_dir}/*.changes", "#{work_dir}/*.debian.tar.gz", "#{work_dir}/*.orig.tar.gz"], dest_dir
66
+ rm_rf "#{work_dir}/#{@name}-#{@debversion}"
67
+ rm_rf work_dir
68
+ end
69
+ end
70
+
71
+ namespace :package do
72
+ desc "Create a deb from this repo, using debuild (all builddeps must be installed)"
73
+ task :deb => :tar do
74
+ Rake::Task[:build_deb].invoke('debuild')
75
+ end
76
+ end
77
+
78
+ namespace :pl do
79
+ desc "Create a deb from this repo using the default cow #{@default_cow}."
80
+ task :deb => "package:tar" do
81
+ check_var('PE_VER', ENV['PE_VER']) if @build_pe
82
+ Rake::Task[:build_deb].invoke('pdebuild', @default_cow)
83
+ end
84
+
85
+ desc "Create an RC deb from this repo using the default cow #{@default_cow}."
86
+ task :deb_rc => "package:tar" do
87
+ Rake::Task[:build_deb].invoke('pdebuild', @default_cow, 'devel')
88
+ end
89
+
90
+ desc "Create debs from this git repository using all cows specified in build_defaults yaml"
91
+ task :deb_all do
92
+ check_var('PE_VER', ENV['PE_VER']) if @build_pe
93
+ @cows.split(' ').each do |cow|
94
+ Rake::Task["package:tar"].invoke
95
+ Rake::Task[:build_deb].reenable
96
+ Rake::Task[:build_deb].invoke('pdebuild', cow)
97
+ end
98
+ end
99
+
100
+ desc "Create RC debs from this git repository using all cows specified in build_defaults yaml"
101
+ task :deb_all_rc do
102
+ @cows.split(' ').each do |cow|
103
+ Rake::Task["package:tar"].invoke
104
+ Rake::Task[:build_deb].reenable
105
+ Rake::Task[:build_deb].invoke('pdebuild', cow, 'devel')
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,20 @@
1
+ # Most projects set rdoc options in the context of gem building. However, mcollective
2
+ # generates its own rdoc package. We can reuse the @gem_rdoc_options here
3
+
4
+ if @build_doc
5
+ begin
6
+ require 'rdoc/task'
7
+ rescue LoadError
8
+ require 'rake/rdoctask'
9
+ end
10
+
11
+ namespace :package do
12
+ RDoc::Task.new(:doc) do |rdoc|
13
+ rdoc.rdoc_dir = 'doc'
14
+ rdoc.title = "#{@name} version #{@version}"
15
+ @gem_rdoc_options.each do |option|
16
+ rdoc.options << option
17
+ end unless @gem_rdoc_options.nil?
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,18 @@
1
+ if @build_pe
2
+ pl_packaging_url = "https://raw.github.com/puppetlabs/build-data/#{@team}"
3
+ else
4
+ pl_packaging_url = "https://raw.github.com/puppetlabs/build-data/#{@name}"
5
+ end
6
+
7
+ namespace :pl do
8
+ task :fetch do
9
+ rm_rf "#{ENV['HOME']}/.packaging"
10
+ mkdir_p "#{ENV['HOME']}/.packaging"
11
+ begin
12
+ sh "curl #{pl_packaging_url}/#{@builder_data_file} > #{ENV['HOME']}/.packaging/#{@builder_data_file}"
13
+ rescue
14
+ STDERR.puts "There was an error fetching the builder extras data."
15
+ exit 1
16
+ end
17
+ end
18
+ end