tpkg 2.3.3 → 2.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +1 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE +20 -0
  5. data/Portfile +39 -0
  6. data/Portfile.template +39 -0
  7. data/README.md +43 -0
  8. data/Rakefile +468 -18
  9. data/bin/gem2tpkg +2 -2
  10. data/bin/tpkg +18 -13
  11. data/bin/tpkg_uploader +132 -0
  12. data/ca.pem +1 -0
  13. data/control +7 -0
  14. data/depend +3 -0
  15. data/externals-etch/authorized_keys +40 -0
  16. data/externals-etch/group +9 -0
  17. data/externals-etch/iptables +38 -0
  18. data/externals-etch/limits +30 -0
  19. data/externals-etch/nfs +30 -0
  20. data/externals-etch/sudo +30 -0
  21. data/externals-etch/supplemental_groups +8 -0
  22. data/externals-etch/sysctl +30 -0
  23. data/externals-etch/user +41 -0
  24. data/externals/group +39 -0
  25. data/externals/supplemental_groups +48 -0
  26. data/externals/user +39 -0
  27. data/lib/tpkg.rb +260 -991
  28. data/lib/tpkg/os.rb +164 -0
  29. data/lib/tpkg/os/debian.rb +159 -0
  30. data/lib/tpkg/os/freebsd.rb +113 -0
  31. data/lib/tpkg/os/macosx.rb +113 -0
  32. data/lib/tpkg/os/redhat.rb +173 -0
  33. data/lib/tpkg/os/solaris.rb +101 -0
  34. data/lib/tpkg/os/windows.rb +26 -0
  35. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify.rb +67 -0
  36. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb +127 -0
  37. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/kwalify.schema.yaml +58 -0
  38. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/main.rb +442 -0
  39. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/messages.rb +173 -0
  40. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/meta-validator.rb +275 -0
  41. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/parser/base.rb +127 -0
  42. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/parser/yaml.rb +841 -0
  43. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/rule.rb +559 -0
  44. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/templates/genclass-java.eruby +222 -0
  45. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/templates/genclass-php.eruby +104 -0
  46. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/templates/genclass-ruby.eruby +113 -0
  47. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/types.rb +156 -0
  48. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util.rb +158 -0
  49. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/assert-text-equal.rb +46 -0
  50. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/hash-interface.rb +18 -0
  51. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/hashlike.rb +51 -0
  52. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/option-parser.rb +220 -0
  53. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/ordered-hash.rb +57 -0
  54. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/testcase-helper.rb +112 -0
  55. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/validator.rb +282 -0
  56. data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/yaml-parser.rb +870 -0
  57. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh.rb +219 -0
  58. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/agent.rb +179 -0
  59. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/constants.rb +18 -0
  60. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/key_manager.rb +219 -0
  61. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/methods/abstract.rb +60 -0
  62. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/methods/hostbased.rb +71 -0
  63. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/methods/keyboard_interactive.rb +66 -0
  64. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/methods/password.rb +39 -0
  65. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/methods/publickey.rb +92 -0
  66. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/pageant.rb +183 -0
  67. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/session.rb +134 -0
  68. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/buffer.rb +340 -0
  69. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/buffered_io.rb +198 -0
  70. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/config.rb +205 -0
  71. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/connection/channel.rb +630 -0
  72. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/connection/constants.rb +33 -0
  73. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/connection/session.rb +597 -0
  74. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/connection/term.rb +178 -0
  75. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/errors.rb +85 -0
  76. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/key_factory.rb +102 -0
  77. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/known_hosts.rb +129 -0
  78. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/loggable.rb +61 -0
  79. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/packet.rb +102 -0
  80. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/prompt.rb +93 -0
  81. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/proxy/command.rb +75 -0
  82. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/proxy/errors.rb +14 -0
  83. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/proxy/http.rb +94 -0
  84. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/proxy/socks4.rb +70 -0
  85. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/proxy/socks5.rb +142 -0
  86. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/ruby_compat.rb +43 -0
  87. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/service/forward.rb +288 -0
  88. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test.rb +89 -0
  89. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/channel.rb +129 -0
  90. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/extensions.rb +152 -0
  91. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/kex.rb +44 -0
  92. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/local_packet.rb +51 -0
  93. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/packet.rb +81 -0
  94. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/remote_packet.rb +38 -0
  95. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/script.rb +157 -0
  96. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/socket.rb +64 -0
  97. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/algorithms.rb +384 -0
  98. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/cipher_factory.rb +97 -0
  99. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/constants.rb +30 -0
  100. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac.rb +31 -0
  101. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/abstract.rb +79 -0
  102. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/md5.rb +12 -0
  103. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/md5_96.rb +11 -0
  104. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/none.rb +15 -0
  105. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/sha1.rb +13 -0
  106. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/sha1_96.rb +11 -0
  107. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/identity_cipher.rb +55 -0
  108. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/kex.rb +13 -0
  109. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +208 -0
  110. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +77 -0
  111. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/openssl.rb +127 -0
  112. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/packet_stream.rb +235 -0
  113. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/server_version.rb +71 -0
  114. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/session.rb +276 -0
  115. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/state.rb +206 -0
  116. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/verifiers/lenient.rb +30 -0
  117. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/verifiers/null.rb +12 -0
  118. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/verifiers/strict.rb +53 -0
  119. data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/version.rb +62 -0
  120. data/lib/tpkg/version.rb +3 -0
  121. data/man/man1/cpan2tpkg.1 +82 -0
  122. data/man/man1/gem2tpkg.1 +120 -0
  123. data/man/man1/tpkg.1 +411 -0
  124. data/pkginfo +8 -0
  125. data/postinstall.solaris +11 -0
  126. data/postremove.solaris +16 -0
  127. data/schema/schema-1.0.5.yml +0 -0
  128. data/schema/schema-1.0.6.yml +0 -0
  129. data/schema/schema-1.0.7.yml +0 -0
  130. data/schema/schema-1.0.8.yml +0 -0
  131. data/schema/schema-1.0.9.yml +0 -0
  132. data/schema/schema.yml +0 -0
  133. data/schema/tpkg-1.0.0.dtd +0 -0
  134. data/schema/tpkg-1.0.1.dtd +0 -0
  135. data/schema/tpkg-1.0.2.dtd +0 -0
  136. data/schema/tpkg-1.0.3.dtd +0 -0
  137. data/schema/tpkg-1.0.4.dtd +0 -0
  138. data/schema/tpkg-1.0.5.dtd +0 -0
  139. data/schema/tpkg-1.0.6.dtd +0 -0
  140. data/schema/tpkg-1.0.7.dtd +0 -0
  141. data/schema/tpkg-1.0.8.dtd +0 -0
  142. data/schema/tpkg-1.0.9.dtd +0 -0
  143. data/schema/tpkg.dtd +0 -0
  144. data/test/TODO +30 -0
  145. data/test/premadetestpkg/pkg_without_file_metadata-1.0-1.tpkg +0 -0
  146. data/test/test_checksum.rb +53 -0
  147. data/test/test_compress.rb +55 -0
  148. data/test/test_conflict.rb +41 -0
  149. data/test/test_crontabs.rb +398 -0
  150. data/test/test_dependency.rb +1113 -0
  151. data/test/test_downgrade.rb +80 -0
  152. data/test/test_download.rb +95 -0
  153. data/test/test_encrypt.rb +136 -0
  154. data/test/test_filemetadata.rb +131 -0
  155. data/test/test_initscript.rb +93 -0
  156. data/test/test_install.rb +186 -0
  157. data/test/test_lock.rb +82 -0
  158. data/test/test_make.rb +410 -0
  159. data/test/test_metadata.rb +805 -0
  160. data/test/test_misc.rb +379 -0
  161. data/test/test_options.rb +1711 -0
  162. data/test/test_os.rb +193 -0
  163. data/test/test_os_debian.rb +99 -0
  164. data/test/test_os_freebsd.rb +89 -0
  165. data/test/test_os_macosx.rb +79 -0
  166. data/test/test_os_redhat.rb +124 -0
  167. data/test/test_os_solaris.rb +85 -0
  168. data/test/test_os_windows.rb +26 -0
  169. data/test/test_query.rb +134 -0
  170. data/test/test_remove.rb +539 -0
  171. data/test/test_tar.rb +99 -0
  172. data/test/test_unpack.rb +977 -0
  173. data/test/test_upgrade.rb +398 -0
  174. data/test/test_version.rb +54 -0
  175. data/test/testcmds/crontab +14 -0
  176. data/test/testcmds/debian/apt-cache +145 -0
  177. data/test/testcmds/debian/dpkg-query +16 -0
  178. data/test/testcmds/freebsd/pkg_info +13 -0
  179. data/test/testcmds/macosx/port +35 -0
  180. data/test/testcmds/redhat/rpmbuild +6 -0
  181. data/test/testcmds/redhat/yum +90 -0
  182. data/test/testcmds/solaris/pkginfo +25 -0
  183. data/test/testcmds/solaris/pkgutil +36 -0
  184. data/test/testpkg/reloc/encfile +2 -0
  185. data/test/testpkg/reloc/file +2 -0
  186. data/test/testpkg/reloc/precryptfile +1 -0
  187. data/test/testpkg/reloc/precryptfile.plaintext +3 -0
  188. data/test/testpkg/tpkg-bad-ownergroup.xml +25 -0
  189. data/test/testpkg/tpkg-bad-ownergroup.yml +18 -0
  190. data/test/testpkg/tpkg-default-perms.xml +28 -0
  191. data/test/testpkg/tpkg-default-perms.yml +20 -0
  192. data/test/testpkg/tpkg-good-ownergroup.xml +25 -0
  193. data/test/testpkg/tpkg-good-ownergroup.yml +18 -0
  194. data/test/testpkg/tpkg-nativedeps.yml +13 -0
  195. data/test/testpkg/tpkg-nofiles.xml +14 -0
  196. data/test/testpkg/tpkg-nofiles.yml +9 -0
  197. data/test/testpkg/tpkg.xml +35 -0
  198. data/test/testpkg/tpkg.yml +25 -0
  199. data/test/tpkgtest.rb +300 -0
  200. data/tpkg.conf +16 -0
  201. data/tpkg.gemspec +24 -0
  202. data/tpkg.spec +28 -0
  203. data/tpkg.xml +17 -0
  204. data/tpkg_profile.sh +32 -0
  205. metadata +306 -31
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 16accff9642ba5dbf8083890dfa43bbf35335128
4
+ data.tar.gz: f991d4fb37208a27c18a6b2def1509957f0e4586
5
+ SHA512:
6
+ metadata.gz: 9d33886e05eb4edcea9e5ca8b5ebed4da2b2af0eb16df653f6631500e154e7b306a18dc7e38d869c21423eb4d3362c6761c8be7532840b8d956196d973a68d49
7
+ data.tar.gz: 4b260550c6723e9bc506af9d98118dfcd7f06822e79a2aefc91cdb4802f7f4dabaaae7d67267ce269457afeac6767590e5f4501f11d6d918e1c424d98c24e4dd
@@ -0,0 +1 @@
1
+ Gemfile.lock
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in tpkg.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ The MIT License
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
20
+
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2
+ # $Id$
3
+
4
+ PortSystem 1.0
5
+ PortGroup github 1.0
6
+
7
+ github.setup tpkg client 2.3.3 v
8
+ github.tarball_from downloads
9
+
10
+ name tpkg
11
+ distname ${github.author}-${github.project}-${github.version}
12
+
13
+ categories sysutils
14
+ maintainers aput.net:jheiss openmaintainer
15
+ supported_archs noarch
16
+ license MIT
17
+
18
+ description Tpkg is an application packaging and deployment tool.
19
+
20
+ long_description Tpkg is a cross-platform tool for packaging and \
21
+ deploying applications. It is designed to work \
22
+ alongside your operating system's packaging tool. \
23
+ The deployment features in tpkg are designed to \
24
+ scale to deployments across hundreds or thousands \
25
+ of systems.
26
+
27
+ platforms darwin
28
+
29
+ checksums rmd160 03a3b051ba0f1dc2a9ed7a86ce4eae4ab364abfc \
30
+ sha256 e1078eb9a5c88a4fdd5394653aeb7e0984c9fbf8039a1596b5ed6729c00ce48a
31
+
32
+ depends_build port:rb-rake
33
+ depends_run port:facter
34
+
35
+ use_configure no
36
+ build {}
37
+ destroot.cmd ${prefix}/bin/rake
38
+ destroot.target install\[${destroot}\]
39
+ destroot.destdir
@@ -0,0 +1,39 @@
1
+ # -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2
+ # $Id$
3
+
4
+ PortSystem 1.0
5
+ PortGroup github 1.0
6
+
7
+ github.setup tpkg client %VER% v
8
+ github.tarball_from downloads
9
+
10
+ name tpkg
11
+ distname ${github.author}-${github.project}-${github.version}
12
+
13
+ categories sysutils
14
+ maintainers aput.net:jheiss openmaintainer
15
+ supported_archs noarch
16
+ license MIT
17
+
18
+ description Tpkg is an application packaging and deployment tool.
19
+
20
+ long_description Tpkg is a cross-platform tool for packaging and \
21
+ deploying applications. It is designed to work \
22
+ alongside your operating system's packaging tool. \
23
+ The deployment features in tpkg are designed to \
24
+ scale to deployments across hundreds or thousands \
25
+ of systems.
26
+
27
+ platforms darwin
28
+
29
+ checksums rmd160 %RMD160% \
30
+ sha256 %SHA256%
31
+
32
+ depends_build port:rb-rake
33
+ depends_run port:facter
34
+
35
+ use_configure no
36
+ build {}
37
+ destroot.cmd ${prefix}/bin/rake
38
+ destroot.target install\[${destroot}\]
39
+ destroot.destdir
@@ -0,0 +1,43 @@
1
+ # tpkg - Application Packaging and Deployment
2
+
3
+ tpkg is a tool for packaging and deploying applications. It is designed
4
+ to work alongside your operating system's packaging tool.
5
+
6
+ The packaging features of tpkg work in a similar fashion as many OS
7
+ packaging tools like rpm, dpkg, SysV, etc, but with some additional
8
+ features. tpkg is designed to be cross-platform so that you can use the
9
+ same tool across all the operating systems in your environment.
10
+
11
+ The deployment features in tpkg are designed to scale to deployments
12
+ across hundreds or thousands of systems.
13
+
14
+ ## Documentation
15
+
16
+ http://tpkg.github.com/
17
+
18
+ ## Help
19
+
20
+ If you run into any problems or have any questions you'll find us on the
21
+ tpkg-users mailing list:
22
+
23
+ https://lists.sourceforge.net/lists/listinfo/tpkg-users
24
+
25
+ ## Contributing
26
+
27
+ 1. Fork it
28
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
29
+ 3. Commit your changes (`git commit -am 'Added some feature'`)
30
+ 4. Push to the branch (`git push origin my-new-feature`)
31
+ 5. Create new Pull Request
32
+
33
+ ## License
34
+
35
+ MIT
36
+
37
+ ## Credits
38
+
39
+ Various parties have contributed to tpkg development and hold the copyright to
40
+ the code they have contributed, including but not limited to:
41
+
42
+ Yellowpages.com
43
+ Jason Heiss
data/Rakefile CHANGED
@@ -1,19 +1,469 @@
1
- require 'rake/gempackagetask'
2
- spec = Gem::Specification.new do |s|
3
- s.name = 'tpkg'
4
- s.summary = 'tpkg Application Packaging & Deployment'
5
- s.version = '2.3.3'
6
- s.authors = ['Darren Dao', 'Jason Heiss']
7
- s.email = 'tpkg-users@lists.sourceforge.net'
8
- s.homepage = 'http://tpkg.github.com/'
9
- s.rubyforge_project = 'tpkg'
10
- s.platform = Gem::Platform::RUBY
11
- s.required_ruby_version = '>=1.8'
12
- s.files = Dir['**/**']
13
- s.executables = [ 'tpkg', 'cpan2tpkg', 'gem2tpkg', 'tpkg_xml_to_yml' ]
14
- s.add_dependency('facter')
15
- s.add_dependency('net-ssh')
16
- s.add_dependency('kwalify')
17
- end
18
- Rake::GemPackageTask.new(spec).define
1
+ require 'rbconfig'
2
+ require 'tempfile'
3
+ require 'tmpdir'
4
+ require 'open-uri'
5
+ require 'openssl'
6
+ require 'rake/testtask'
7
+ require 'bundler/gem_tasks'
8
+
9
+ TPKGVER = `ruby -Ilib -e "require 'tpkg'; puts Tpkg::VERSION"`.chomp
10
+ TARBALLFILE = "tpkg-client-#{TPKGVER}.tar.gz"
11
+ TARBALL = File.expand_path(TARBALLFILE)
12
+
13
+ BUILDROOT = '/var/tmp/tpkg-client-buildroot'
14
+
15
+ # Copies the tpkg client files to destdir. If any of the dir options
16
+ # are not specified the files that would go in that directory will not
17
+ # be copied.
18
+ # options:
19
+ # :bindir
20
+ # :libdir
21
+ # :etcdir
22
+ # :mandir
23
+ # :externalsdir
24
+ # :schemadir
25
+ # :profiledir
26
+ # :ruby (#! lines in scripts will be changed to specified ruby)
27
+ # :copythirdparty
28
+ # If not specified the thirdparty directory will not be copied. The
29
+ # package will need to express appropriate dependencies as
30
+ # replacements for the libraries contained in that directory.
31
+ def copy_tpkg_files(destdir, options={})
32
+ if options[:bindir]
33
+ bindir = File.join(destdir, options[:bindir])
34
+ mkdir_p(bindir)
35
+ binapps = ['tpkg', 'cpan2tpkg', 'gem2tpkg', 'tpkg_xml_to_yml']
36
+ binapps.each do |binapp|
37
+ if options[:ruby]
38
+ # Change #! line
39
+ File.open(File.join(bindir, binapp), 'w') do |newfile|
40
+ File.open(File.join('bin', binapp)) do |oldfile|
41
+ # Modify the first line
42
+ firstline = oldfile.gets
43
+ # Preserve any options. I.e. #!/usr/bin/ruby -w
44
+ shebang, shebangopts = firstline.split(' ', 2)
45
+ newfile.puts "#!#{options[:ruby]} #{shebangopts}"
46
+ # Then dump in the rest of the file
47
+ newfile.write(oldfile.read)
48
+ end
49
+ end
50
+ else
51
+ cp(File.join('bin', binapp), bindir, :preserve => true)
52
+ end
53
+ chmod(0555, File.join(bindir, binapp))
54
+ end
55
+ end
56
+
57
+ if options[:libdir]
58
+ libdir = File.join(destdir, options[:libdir])
59
+ mkdir_p(libdir)
60
+
61
+ # Substitute TPKGVER into tpkg.rb
62
+ # Substitute proper path into DEFAULT_CONFIGDIR in tpkg.rb if appropriate
63
+ File.open(File.join(libdir, 'tpkg.rb'), 'w') do |newfile|
64
+ IO.foreach(File.join('lib', 'tpkg.rb')) do |line|
65
+ if line =~ /^\s*VERSION/
66
+ line.sub!(/=.*/, "= '#{TPKGVER}'")
67
+ end
68
+ if options[:etcdir] && line =~ /^\s*DEFAULT_CONFIGDIR/
69
+ line.sub!(/=.*/, "= '#{options[:etcdir]}'")
70
+ end
71
+ newfile.write(line)
72
+ end
73
+ end
74
+ chmod(0444, File.join(libdir, 'tpkg.rb'))
75
+
76
+ tpkglibdir = File.join(libdir, 'tpkg')
77
+ mkdir_p(tpkglibdir)
78
+ libs = ['deployer.rb', 'metadata.rb', 'os.rb', 'silently.rb', 'thread_pool.rb', 'version.rb', 'versiontype.rb']
79
+ libs.each do |lib|
80
+ cp(File.join('lib', 'tpkg', lib), tpkglibdir, :preserve => true)
81
+ chmod(0444, File.join(tpkglibdir, lib))
82
+ end
83
+ tpkgoslibdir = File.join(tpkglibdir, 'os')
84
+ mkdir_p(tpkgoslibdir)
85
+ Dir.glob('lib/tpkg/os/*.rb').each do |lib|
86
+ cp(lib, tpkgoslibdir, :preserve => true)
87
+ chmod(0444, File.join(tpkgoslibdir, File.basename(lib)))
88
+ end
89
+
90
+ if options[:copythirdparty]
91
+ # All the nice consistent usage of FileUtils and then this...
92
+ system("cd lib/tpkg && find thirdparty -name .svn -prune -o -print | cpio -pdum #{tpkglibdir}")
93
+ end
94
+ end
95
+
96
+ if options[:mandir]
97
+ mandir = File.join(destdir, options[:mandir])
98
+ Dir.chdir('man')
99
+ Dir.glob('man*').each do |mansubdir|
100
+ mansectiondir = File.join(mandir, mansubdir)
101
+ mkdir_p(mansectiondir)
102
+ Dir.chdir(mansubdir)
103
+ Dir.glob('*').each do |manpage|
104
+ cp(manpage, mansectiondir, :preserve => true)
105
+ chmod(0444, File.join(mansectiondir, manpage))
106
+ end
107
+ Dir.chdir('..')
108
+ end
109
+ Dir.chdir('..')
110
+ end
111
+
112
+ if options[:etcdir]
113
+ etcdir = File.join(destdir, options[:etcdir])
114
+ mkdir_p(etcdir)
115
+ cp('tpkg.conf', etcdir, :preserve => true)
116
+ chmod(0644, File.join(etcdir, 'tpkg.conf'))
117
+ # All of the supporting config files go into a subdirectory
118
+ etctpkgdir = File.join(etcdir, 'tpkg')
119
+ mkdir_p(etctpkgdir)
120
+ etctpkgfiles = ['ca.pem']
121
+ etctpkgfiles.each do |etctpkgfile|
122
+ cp(etctpkgfile, etctpkgdir, :preserve => true)
123
+ chmod(0644, File.join(etctpkgdir, etctpkgfile))
124
+ end
125
+ end
126
+
127
+ if options[:externalsdir]
128
+ externalsdir = File.join(destdir, options[:externalsdir])
129
+ mkdir_p(externalsdir)
130
+ Dir.glob(File.join('externals', '*')).each do |external|
131
+ cp(external, externalsdir, :preserve => true)
132
+ chmod(0555, File.join(externalsdir, File.basename(external)))
133
+ end
134
+ end
135
+
136
+ if options[:schemadir]
137
+ schemadir = File.join(destdir, options[:schemadir])
138
+ mkdir_p(schemadir)
139
+ Dir.glob(File.join('schema', '*')).each do |schema|
140
+ cp(schema, schemadir, :preserve => true)
141
+ chmod(0555, File.join(schemadir, File.basename(schema)))
142
+ end
143
+ end
144
+
145
+ if options[:profiledir]
146
+ profiledir = File.join(BUILDROOT, options[:profiledir])
147
+ mkdir_p(profiledir)
148
+ cp('tpkg_profile.sh', File.join(profiledir, 'tpkg.sh'), :preserve => true)
149
+ chmod(0755, File.join(profiledir, 'tpkg.sh'))
150
+ end
151
+ end
152
+
153
+ # rake test
154
+ # Run a specific file: rake test TEST=test/make.rb
155
+ # Run a specific method:
156
+ # rake test TEST=test/test_make.rb TESTOPTS="--name=test_make_osarch_names"
157
+ Rake::TestTask.new do |t|
158
+ t.libs << "lib"
159
+ t.verbose = true
160
+ end
161
+
162
+ # FlogTask is broken...
163
+ # begin
164
+ # require 'flog_task'
165
+ # FlogTask.new do |t|
166
+ # t.dirs = ['lib']
167
+ # end
168
+ # rescue LoadError
169
+ # warn "Flog not installed"
170
+ # end
171
+ desc 'Run flog on code'
172
+ task :flog do
173
+ system("flog -g lib")
174
+ end
175
+ namespace :flog do
176
+ desc 'Just the flog summary'
177
+ task :summary do
178
+ system("flog -s lib")
179
+ end
180
+ end
181
+ begin
182
+ require 'flay'
183
+ require 'flay_task'
184
+ FlayTask.new do |t|
185
+ t.dirs = ['lib']
186
+ end
187
+ rescue LoadError
188
+ warn "Flay gem not installed, flay rake tasks will be unavailable"
189
+ end
190
+
191
+ desc 'Build an tpkg client RPM on a Red Hat box'
192
+ task :redhat => [:redhatprep, :rpm]
193
+ desc 'Prep a Red Hat box for building an RPM'
194
+ task :redhatprep do
195
+ # Install the package which contains the rpmbuild command
196
+ system('rpm --quiet -q rpm-build || sudo yum install rpm-build')
197
+ end
198
+ desc 'Build an tpkg client RPM'
199
+ task :rpm do
200
+ #
201
+ # Create package file structure in build root
202
+ #
203
+
204
+ rm_rf(BUILDROOT)
205
+
206
+ bindir = File.join('usr', 'bin')
207
+ libdir = File.join('usr', 'lib', 'ruby', 'site_ruby', '1.8')
208
+ mandir = File.join('usr', 'share', 'man')
209
+ etcdir = '/etc'
210
+ externalsdir = File.join('usr', 'lib', 'tpkg', 'externals')
211
+ schemadir = File.join('etc', 'tpkg', 'schema')
212
+ profiledir = File.join('etc', 'profile.d')
213
+ copy_tpkg_files(BUILDROOT,
214
+ :bindir => bindir,
215
+ :libdir => libdir,
216
+ :mandir => mandir,
217
+ :etcdir => etcdir,
218
+ :externalsdir => externalsdir,
219
+ :schemadir => schemadir,
220
+ :profiledir => profiledir,
221
+ :copythirdparty => true)
222
+
223
+ #
224
+ # Prep spec file
225
+ #
226
+
227
+ spec = Tempfile.new('tpkgrpm')
228
+ IO.foreach('tpkg.spec') do |line|
229
+ line.sub!('%VER%', TPKGVER)
230
+ spec.puts(line)
231
+ end
232
+ spec.flush
233
+
234
+ #
235
+ # Build the package
236
+ #
237
+ system("rpmbuild -bb --buildroot #{BUILDROOT} #{spec.path}")
238
+
239
+ #
240
+ # Cleanup
241
+ #
242
+
243
+ rm_rf(BUILDROOT)
244
+ end
245
+
246
+ desc 'Build an tpkg client deb'
247
+ task :deb do
248
+ #
249
+ # Create package file structure in build root
250
+ #
251
+
252
+ system("sudo rm -rf #{BUILDROOT}")
253
+
254
+ mkdir_p(File.join(BUILDROOT, 'DEBIAN'))
255
+ File.open(File.join(BUILDROOT, 'DEBIAN', 'control'), 'w') do |control|
256
+ IO.foreach('control') do |line|
257
+ next if line =~ /^\s*#/ # Remove comments
258
+ line.sub!('%VER%', TPKGVER)
259
+ control.puts(line)
260
+ end
261
+ end
262
+
263
+ bindir = File.join('usr', 'bin')
264
+ libdir = File.join('usr', 'local', 'lib', 'site_ruby')
265
+ mandir = File.join('usr', 'share', 'man')
266
+ etcdir = '/etc'
267
+ externalsdir = File.join('usr', 'lib', 'tpkg', 'externals')
268
+ schemadir = File.join('etc', 'tpkg', 'schema')
269
+ copy_tpkg_files(BUILDROOT,
270
+ :bindir => bindir,
271
+ :libdir => libdir,
272
+ :mandir => mandir,
273
+ :etcdir => etcdir,
274
+ :externalsdir => externalsdir,
275
+ :schemadir => schemadir,
276
+ :copythirdparty => true)
277
+
278
+ #
279
+ # Set permissions
280
+ #
281
+
282
+ system("sudo chown -R 0:0 #{BUILDROOT}")
283
+
284
+ #
285
+ # Build the package
286
+ #
287
+
288
+ system("dpkg --build #{BUILDROOT} tpkg-#{TPKGVER}.deb")
289
+
290
+ #
291
+ # Cleanup
292
+ #
293
+
294
+ system("sudo rm -rf #{BUILDROOT}")
295
+ end
296
+
297
+ desc 'Build tpkg client SysV packages for Solaris'
298
+ task :solaris => [:sysvpkg]
299
+ desc 'Build an tpkg client SysV package'
300
+ task :sysvpkg do
301
+ #
302
+ # Create package file structure in build root
303
+ #
304
+
305
+ rm_rf(BUILDROOT)
306
+
307
+ bindir = File.join('usr', 'bin')
308
+ libdir = File.join('opt', 'csw', 'lib', 'ruby', 'site_ruby', '1.8')
309
+ mandir = File.join('usr', 'share', 'man')
310
+ etcdir = '/etc'
311
+ externalsdir = File.join('usr', 'lib', 'tpkg', 'externals')
312
+ schemadir = File.join('etc', 'tpkg', 'schema')
313
+ profiledir = File.join('etc', 'profile.d')
314
+ copy_tpkg_files(BUILDROOT,
315
+ :bindir => bindir,
316
+ :libdir => libdir,
317
+ :mandir => mandir,
318
+ :etcdir => etcdir,
319
+ :externalsdir => externalsdir,
320
+ :schemadir => schemadir,
321
+ :profiledir => profiledir,
322
+ :copythirdparty => true,
323
+ :ruby => '/opt/csw/bin/ruby')
324
+
325
+ #
326
+ # Prep packaging files
327
+ #
328
+
329
+ rm_rf('solbuild')
330
+ mkdir('solbuild')
331
+ File.open(File.join('solbuild', 'pkginfo'), 'w') do |pkginfo|
332
+ IO.foreach('pkginfo') do |line|
333
+ line.sub!('%VER%', TPKGVER)
334
+ pkginfo.puts(line)
335
+ end
336
+ end
337
+ File.open(File.join('solbuild', 'prototype'), 'w') do |prototype|
338
+ prototype.puts("i pkginfo=./pkginfo")
339
+ cp('depend', 'solbuild/depend')
340
+ prototype.puts("i depend=./depend")
341
+ cp('postinstall.solaris', 'solbuild/postinstall')
342
+ prototype.puts("i postinstall=./postinstall")
343
+ cp('postremove.solaris', 'solbuild/postremove')
344
+ prototype.puts("i postremove=./postremove")
345
+ # The tail +2 removes the first line, which is the base directory
346
+ # and doesn't need to be included in the package.
347
+ IO.popen("find #{BUILDROOT} | tail +2 | pkgproto") do |pipe|
348
+ pipe.each do |line|
349
+ # Clean up the directory names
350
+ line.sub!(BUILDROOT, '')
351
+ # Don't force our permissions on directories
352
+ if line =~ /^d/
353
+ line.sub!(/\S+ \S+ \S+$/, '? ? ?')
354
+ end
355
+ prototype.write(line)
356
+ end
357
+ end
358
+ end
359
+
360
+ #
361
+ # Build the package
362
+ #
363
+
364
+ system("cd solbuild && pkgmk -r #{BUILDROOT} -d $PWD/solbuild")
365
+ system("pkgtrans solbuild ../OSStpkg-#{TPKGVER}.pkg OSStpkg")
366
+
367
+ #
368
+ # Cleanup
369
+ #
370
+
371
+ rm_rf('solbuild')
372
+ rm_rf(BUILDROOT)
373
+ end
374
+
375
+ # Install based on Config::CONFIG paths
376
+ task :install, :destdir do |t, args|
377
+ destdir = nil
378
+ if args.destdir
379
+ destdir = args.destdir
380
+ else
381
+ destdir = '/'
382
+ end
383
+ copy_tpkg_files(destdir,
384
+ :bindir => Config::CONFIG['bindir'],
385
+ :libdir => Config::CONFIG['sitelibdir'],
386
+ :mandir => Config::CONFIG['mandir'],
387
+ :etcdir => Config::CONFIG['sysconfdir'],
388
+ # Can't find a better way to get the path to the current ruby
389
+ :ruby => File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']),
390
+ :copythirdparty => true)
391
+ end
392
+
393
+ desc 'Fetch tarball from github'
394
+ task :fetch do
395
+ if !File.exist?(TARBALL)
396
+ url = "http://cloud.github.com/downloads/tpkg/client/#{TARBALLFILE}"
397
+ puts "Fetching tarball from #{url}"
398
+ open(url) do |df|
399
+ open(TARBALL, 'w') do |lf|
400
+ lf.write(df.read)
401
+ end
402
+ end
403
+ end
404
+ end
405
+
406
+ desc 'Prepare portfile for submission to MacPorts'
407
+ task :macport => :fetch do
408
+ md5 = `openssl md5 #{TARBALL}`.chomp.split.last
409
+ sha1 = `openssl sha1 #{TARBALL}`.chomp.split.last
410
+ rmd160 = `openssl rmd160 #{TARBALL}`.chomp.split.last
411
+ sha256 = `openssl sha256 #{TARBALL}`.chomp.split.last
412
+
413
+ portfile = File.join(Dir.tmpdir, 'Portfile')
414
+ rm_f(portfile)
415
+ File.open(portfile, 'w') do |newfile|
416
+ IO.foreach('Portfile.template') do |line|
417
+ line.sub!('%VER%', TPKGVER)
418
+ line.sub!('%MD5%', md5)
419
+ line.sub!('%SHA1%', sha1)
420
+ line.sub!('%RMD160%', rmd160)
421
+ line.sub!('%SHA256%', sha256)
422
+ newfile.puts(line)
423
+ end
424
+ end
425
+ puts "Portfile is #{portfile}"
426
+ end
427
+
428
+ # It may seem odd to package tpkg with tpkg, but if users want to
429
+ # program against the tpkg library it is handy for them to be able to
430
+ # install and depend on the library along with other tpkgs.
431
+ # In order to reduce confusion this package does not contain any of the
432
+ # executables that go in the normal packages.
433
+ desc 'Build tpkg of tpkg library'
434
+ task :tpkgpkg do
435
+ #
436
+ # Create package file structure in build root
437
+ #
438
+
439
+ rm_rf(BUILDROOT)
440
+
441
+ libdir = ENV['libdir'].nil?? File.join('root', 'opt', 'tpkg', 'lib', 'site_ruby', '1.8') : File.join('root', ENV['libdir'])
442
+
443
+ copy_tpkg_files(BUILDROOT,
444
+ :libdir => libdir,
445
+ :copythirdparty => true)
446
+
447
+ #
448
+ # Prep tpkg.xml
449
+ #
450
+ File.open(File.join(BUILDROOT, 'tpkg.xml'), 'w') do |tpkgxml|
451
+ IO.foreach('tpkg.xml') do |line|
452
+ line.sub!('%VER%', TPKGVER)
453
+ tpkgxml.puts(line)
454
+ end
455
+ end
456
+
457
+ #
458
+ # Build the package
459
+ #
460
+
461
+ system("tpkg --make #{BUILDROOT}")
462
+
463
+ #
464
+ # Cleanup
465
+ #
466
+
467
+ rm_rf(BUILDROOT)
468
+ end
19
469