tpkg 2.3.3 → 2.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +1 -0
- data/Gemfile +4 -0
- data/LICENSE +20 -0
- data/Portfile +39 -0
- data/Portfile.template +39 -0
- data/README.md +43 -0
- data/Rakefile +468 -18
- data/bin/gem2tpkg +2 -2
- data/bin/tpkg +18 -13
- data/bin/tpkg_uploader +132 -0
- data/ca.pem +1 -0
- data/control +7 -0
- data/depend +3 -0
- data/externals-etch/authorized_keys +40 -0
- data/externals-etch/group +9 -0
- data/externals-etch/iptables +38 -0
- data/externals-etch/limits +30 -0
- data/externals-etch/nfs +30 -0
- data/externals-etch/sudo +30 -0
- data/externals-etch/supplemental_groups +8 -0
- data/externals-etch/sysctl +30 -0
- data/externals-etch/user +41 -0
- data/externals/group +39 -0
- data/externals/supplemental_groups +48 -0
- data/externals/user +39 -0
- data/lib/tpkg.rb +260 -991
- data/lib/tpkg/os.rb +164 -0
- data/lib/tpkg/os/debian.rb +159 -0
- data/lib/tpkg/os/freebsd.rb +113 -0
- data/lib/tpkg/os/macosx.rb +113 -0
- data/lib/tpkg/os/redhat.rb +173 -0
- data/lib/tpkg/os/solaris.rb +101 -0
- data/lib/tpkg/os/windows.rb +26 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify.rb +67 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/errors.rb +127 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/kwalify.schema.yaml +58 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/main.rb +442 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/messages.rb +173 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/meta-validator.rb +275 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/parser/base.rb +127 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/parser/yaml.rb +841 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/rule.rb +559 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/templates/genclass-java.eruby +222 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/templates/genclass-php.eruby +104 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/templates/genclass-ruby.eruby +113 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/types.rb +156 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util.rb +158 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/assert-text-equal.rb +46 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/hash-interface.rb +18 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/hashlike.rb +51 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/option-parser.rb +220 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/ordered-hash.rb +57 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/util/testcase-helper.rb +112 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/validator.rb +282 -0
- data/lib/tpkg/thirdparty/kwalify-0.7.2/lib/kwalify/yaml-parser.rb +870 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh.rb +219 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/agent.rb +179 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/constants.rb +18 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/key_manager.rb +219 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/methods/abstract.rb +60 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/methods/hostbased.rb +71 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/methods/keyboard_interactive.rb +66 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/methods/password.rb +39 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/methods/publickey.rb +92 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/pageant.rb +183 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/authentication/session.rb +134 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/buffer.rb +340 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/buffered_io.rb +198 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/config.rb +205 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/connection/channel.rb +630 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/connection/constants.rb +33 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/connection/session.rb +597 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/connection/term.rb +178 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/errors.rb +85 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/key_factory.rb +102 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/known_hosts.rb +129 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/loggable.rb +61 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/packet.rb +102 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/prompt.rb +93 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/proxy/command.rb +75 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/proxy/errors.rb +14 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/proxy/http.rb +94 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/proxy/socks4.rb +70 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/proxy/socks5.rb +142 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/ruby_compat.rb +43 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/service/forward.rb +288 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test.rb +89 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/channel.rb +129 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/extensions.rb +152 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/kex.rb +44 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/local_packet.rb +51 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/packet.rb +81 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/remote_packet.rb +38 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/script.rb +157 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/test/socket.rb +64 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/algorithms.rb +384 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/cipher_factory.rb +97 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/constants.rb +30 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac.rb +31 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/abstract.rb +79 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/md5.rb +12 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/md5_96.rb +11 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/none.rb +15 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/sha1.rb +13 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/hmac/sha1_96.rb +11 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/identity_cipher.rb +55 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/kex.rb +13 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/kex/diffie_hellman_group1_sha1.rb +208 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/kex/diffie_hellman_group_exchange_sha1.rb +77 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/openssl.rb +127 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/packet_stream.rb +235 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/server_version.rb +71 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/session.rb +276 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/transport/state.rb +206 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/verifiers/lenient.rb +30 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/verifiers/null.rb +12 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/verifiers/strict.rb +53 -0
- data/lib/tpkg/thirdparty/net-ssh-2.1.0/lib/net/ssh/version.rb +62 -0
- data/lib/tpkg/version.rb +3 -0
- data/man/man1/cpan2tpkg.1 +82 -0
- data/man/man1/gem2tpkg.1 +120 -0
- data/man/man1/tpkg.1 +411 -0
- data/pkginfo +8 -0
- data/postinstall.solaris +11 -0
- data/postremove.solaris +16 -0
- data/schema/schema-1.0.5.yml +0 -0
- data/schema/schema-1.0.6.yml +0 -0
- data/schema/schema-1.0.7.yml +0 -0
- data/schema/schema-1.0.8.yml +0 -0
- data/schema/schema-1.0.9.yml +0 -0
- data/schema/schema.yml +0 -0
- data/schema/tpkg-1.0.0.dtd +0 -0
- data/schema/tpkg-1.0.1.dtd +0 -0
- data/schema/tpkg-1.0.2.dtd +0 -0
- data/schema/tpkg-1.0.3.dtd +0 -0
- data/schema/tpkg-1.0.4.dtd +0 -0
- data/schema/tpkg-1.0.5.dtd +0 -0
- data/schema/tpkg-1.0.6.dtd +0 -0
- data/schema/tpkg-1.0.7.dtd +0 -0
- data/schema/tpkg-1.0.8.dtd +0 -0
- data/schema/tpkg-1.0.9.dtd +0 -0
- data/schema/tpkg.dtd +0 -0
- data/test/TODO +30 -0
- data/test/premadetestpkg/pkg_without_file_metadata-1.0-1.tpkg +0 -0
- data/test/test_checksum.rb +53 -0
- data/test/test_compress.rb +55 -0
- data/test/test_conflict.rb +41 -0
- data/test/test_crontabs.rb +398 -0
- data/test/test_dependency.rb +1113 -0
- data/test/test_downgrade.rb +80 -0
- data/test/test_download.rb +95 -0
- data/test/test_encrypt.rb +136 -0
- data/test/test_filemetadata.rb +131 -0
- data/test/test_initscript.rb +93 -0
- data/test/test_install.rb +186 -0
- data/test/test_lock.rb +82 -0
- data/test/test_make.rb +410 -0
- data/test/test_metadata.rb +805 -0
- data/test/test_misc.rb +379 -0
- data/test/test_options.rb +1711 -0
- data/test/test_os.rb +193 -0
- data/test/test_os_debian.rb +99 -0
- data/test/test_os_freebsd.rb +89 -0
- data/test/test_os_macosx.rb +79 -0
- data/test/test_os_redhat.rb +124 -0
- data/test/test_os_solaris.rb +85 -0
- data/test/test_os_windows.rb +26 -0
- data/test/test_query.rb +134 -0
- data/test/test_remove.rb +539 -0
- data/test/test_tar.rb +99 -0
- data/test/test_unpack.rb +977 -0
- data/test/test_upgrade.rb +398 -0
- data/test/test_version.rb +54 -0
- data/test/testcmds/crontab +14 -0
- data/test/testcmds/debian/apt-cache +145 -0
- data/test/testcmds/debian/dpkg-query +16 -0
- data/test/testcmds/freebsd/pkg_info +13 -0
- data/test/testcmds/macosx/port +35 -0
- data/test/testcmds/redhat/rpmbuild +6 -0
- data/test/testcmds/redhat/yum +90 -0
- data/test/testcmds/solaris/pkginfo +25 -0
- data/test/testcmds/solaris/pkgutil +36 -0
- data/test/testpkg/reloc/encfile +2 -0
- data/test/testpkg/reloc/file +2 -0
- data/test/testpkg/reloc/precryptfile +1 -0
- data/test/testpkg/reloc/precryptfile.plaintext +3 -0
- data/test/testpkg/tpkg-bad-ownergroup.xml +25 -0
- data/test/testpkg/tpkg-bad-ownergroup.yml +18 -0
- data/test/testpkg/tpkg-default-perms.xml +28 -0
- data/test/testpkg/tpkg-default-perms.yml +20 -0
- data/test/testpkg/tpkg-good-ownergroup.xml +25 -0
- data/test/testpkg/tpkg-good-ownergroup.yml +18 -0
- data/test/testpkg/tpkg-nativedeps.yml +13 -0
- data/test/testpkg/tpkg-nofiles.xml +14 -0
- data/test/testpkg/tpkg-nofiles.yml +9 -0
- data/test/testpkg/tpkg.xml +35 -0
- data/test/testpkg/tpkg.yml +25 -0
- data/test/tpkgtest.rb +300 -0
- data/tpkg.conf +16 -0
- data/tpkg.gemspec +24 -0
- data/tpkg.spec +28 -0
- data/tpkg.xml +17 -0
- data/tpkg_profile.sh +32 -0
- metadata +306 -31
@@ -0,0 +1,28 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE tpkg SYSTEM "http://tpkg.sourceforge.net/tpkg-1.0.dtd">
|
3
|
+
<tpkg>
|
4
|
+
<name>testpkg</name>
|
5
|
+
<version>1.0</version>
|
6
|
+
<package_version>1</package_version>
|
7
|
+
<maintainer>Maintainer</maintainer>
|
8
|
+
<operatingsystem>OS</operatingsystem>
|
9
|
+
<architecture>Architecture</architecture>
|
10
|
+
<description>Description</description>
|
11
|
+
<bugreporting>Bugreporting info</bugreporting>
|
12
|
+
<files>
|
13
|
+
<file_defaults>
|
14
|
+
<posix>
|
15
|
+
<owner>root</owner>
|
16
|
+
<group>root</group>
|
17
|
+
<perms>0444</perms>
|
18
|
+
</posix>
|
19
|
+
</file_defaults>
|
20
|
+
<dir_defaults>
|
21
|
+
<posix>
|
22
|
+
<owner>root</owner>
|
23
|
+
<group>root</group>
|
24
|
+
<perms>0555</perms>
|
25
|
+
</posix>
|
26
|
+
</dir_defaults>
|
27
|
+
</files>
|
28
|
+
</tpkg>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
name: testpkg
|
2
|
+
version: 1.0
|
3
|
+
package_version: 1
|
4
|
+
maintainer: Maintainer
|
5
|
+
operatingsystem: OS
|
6
|
+
architecture: Architecture
|
7
|
+
description: Description
|
8
|
+
bugreporting: Bugreporting info
|
9
|
+
files:
|
10
|
+
file_defaults:
|
11
|
+
posix:
|
12
|
+
owner: root
|
13
|
+
group: 0
|
14
|
+
perms: 0444
|
15
|
+
dir_defaults:
|
16
|
+
posix:
|
17
|
+
owner: root
|
18
|
+
group: 0
|
19
|
+
perms: 0555
|
20
|
+
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE tpkg SYSTEM "http://tpkg.sourceforge.net/tpkg-1.0.dtd">
|
3
|
+
<tpkg>
|
4
|
+
<name>testpkg</name>
|
5
|
+
<version>1.0</version>
|
6
|
+
<package_version>1</package_version>
|
7
|
+
<maintainer>Maintainer</maintainer>
|
8
|
+
<operatingsystem>OS</operatingsystem>
|
9
|
+
<architecture>Architecture</architecture>
|
10
|
+
<description>Description</description>
|
11
|
+
<bugreporting>Bugreporting info</bugreporting>
|
12
|
+
<files>
|
13
|
+
<file_defaults>
|
14
|
+
<posix>
|
15
|
+
<owner>0</owner>
|
16
|
+
<group>0</group>
|
17
|
+
<perms>0444</perms>
|
18
|
+
</posix>
|
19
|
+
</file_defaults>
|
20
|
+
<file>
|
21
|
+
<path>file</path>
|
22
|
+
<crontab/>
|
23
|
+
</file>
|
24
|
+
</files>
|
25
|
+
</tpkg>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
name: testpkg
|
2
|
+
version: 1.0
|
3
|
+
package_version: 1
|
4
|
+
maintainer: Maintainer
|
5
|
+
operatingsystem: OS
|
6
|
+
architecture: Architecture
|
7
|
+
description: Description
|
8
|
+
bugreporting: Bugreporting info
|
9
|
+
files:
|
10
|
+
file_defaults:
|
11
|
+
posix:
|
12
|
+
owner: 0
|
13
|
+
group: 0
|
14
|
+
perms: 0444
|
15
|
+
files:
|
16
|
+
- path: file
|
17
|
+
crontab: {}
|
18
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
name: testpkg
|
2
|
+
version: 1.0
|
3
|
+
package_version: 1
|
4
|
+
maintainer: Maintainer
|
5
|
+
operatingsystem: OS
|
6
|
+
architecture: Architecture
|
7
|
+
description: Description
|
8
|
+
bugreporting: Bugreporting info
|
9
|
+
dependencies:
|
10
|
+
- name: dep1
|
11
|
+
native: true
|
12
|
+
- name: dep2
|
13
|
+
native: true
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE tpkg SYSTEM "http://tpkg.sourceforge.net/tpkg-1.0.dtd">
|
3
|
+
<tpkg>
|
4
|
+
<name>testpkg</name>
|
5
|
+
<version>1.0</version>
|
6
|
+
<package_version>1</package_version>
|
7
|
+
<maintainer>Maintainer</maintainer>
|
8
|
+
<operatingsystem>OS</operatingsystem>
|
9
|
+
<architecture>Architecture</architecture>
|
10
|
+
<description>Description</description>
|
11
|
+
<bugreporting>Bugreporting info</bugreporting>
|
12
|
+
<files>
|
13
|
+
</files>
|
14
|
+
</tpkg>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<!DOCTYPE tpkg SYSTEM "http://tpkg.sourceforge.net/tpkg-1.0.dtd">
|
3
|
+
<tpkg>
|
4
|
+
<name>testpkg</name>
|
5
|
+
<version>1.0</version>
|
6
|
+
<package_version>1</package_version>
|
7
|
+
<maintainer>Maintainer</maintainer>
|
8
|
+
<operatingsystem>OS</operatingsystem>
|
9
|
+
<architecture>Architecture</architecture>
|
10
|
+
<description>Description</description>
|
11
|
+
<bugreporting>Bugreporting info</bugreporting>
|
12
|
+
<files>
|
13
|
+
<file_defaults>
|
14
|
+
<posix>
|
15
|
+
<owner>root</owner>
|
16
|
+
<group>root</group>
|
17
|
+
<perms>0444</perms>
|
18
|
+
</posix>
|
19
|
+
</file_defaults>
|
20
|
+
<file>
|
21
|
+
<path>encfile</path>
|
22
|
+
<encrypt/>
|
23
|
+
<posix>
|
24
|
+
<perms>0400</perms>
|
25
|
+
</posix>
|
26
|
+
</file>
|
27
|
+
<file>
|
28
|
+
<path>precryptfile</path>
|
29
|
+
<encrypt precrypt="true"/>
|
30
|
+
<posix>
|
31
|
+
<perms>0400</perms>
|
32
|
+
</posix>
|
33
|
+
</file>
|
34
|
+
</files>
|
35
|
+
</tpkg>
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: testpkg
|
2
|
+
version: 1.0
|
3
|
+
package_version: 1
|
4
|
+
maintainer: Maintainer
|
5
|
+
operatingsystem: OS
|
6
|
+
architecture: Architecture
|
7
|
+
description: Description
|
8
|
+
bugreporting: Bugreporting info
|
9
|
+
files:
|
10
|
+
file_defaults:
|
11
|
+
posix:
|
12
|
+
owner: root
|
13
|
+
group: 0
|
14
|
+
perms: 0444
|
15
|
+
files:
|
16
|
+
- path: encfile
|
17
|
+
encrypt: {}
|
18
|
+
posix:
|
19
|
+
perms: 0400
|
20
|
+
- path: precryptfile
|
21
|
+
encrypt:
|
22
|
+
precrypt: true
|
23
|
+
posix:
|
24
|
+
perms: 0400
|
25
|
+
|
data/test/tpkgtest.rb
ADDED
@@ -0,0 +1,300 @@
|
|
1
|
+
#
|
2
|
+
# Module of code shared by all of the tpkg test cases
|
3
|
+
#
|
4
|
+
|
5
|
+
# Ensure that we're pulling in the local copy of the tpkg libraries, it
|
6
|
+
# doesn't do us any good to test copies that are already installed on the
|
7
|
+
# system.
|
8
|
+
$:.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
|
9
|
+
require 'test/unit'
|
10
|
+
require 'fileutils'
|
11
|
+
require 'tpkg'
|
12
|
+
require 'tempfile'
|
13
|
+
require 'tmpdir'
|
14
|
+
require 'facter'
|
15
|
+
require 'mocha/setup'
|
16
|
+
|
17
|
+
Tpkg::set_debug(true) if ENV['debug']
|
18
|
+
|
19
|
+
require 'stringio'
|
20
|
+
|
21
|
+
module Kernel
|
22
|
+
|
23
|
+
def capture_stdout
|
24
|
+
out = StringIO.new
|
25
|
+
$stdout = out
|
26
|
+
yield
|
27
|
+
return out
|
28
|
+
ensure
|
29
|
+
$stdout = STDOUT
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
# Ruby 1.8.7 and newer have a Dir.mktmpdir
|
35
|
+
# "Backport" it for earlier versions. This is copied straight out of the
|
36
|
+
# 1.8.7 tmpdir.rb
|
37
|
+
unless Dir.respond_to?(:mktmpdir)
|
38
|
+
module Dir
|
39
|
+
def Dir.mktmpdir(prefix_suffix=nil, tmpdir=nil)
|
40
|
+
case prefix_suffix
|
41
|
+
when nil
|
42
|
+
prefix = "d"
|
43
|
+
suffix = ""
|
44
|
+
when String
|
45
|
+
prefix = prefix_suffix
|
46
|
+
suffix = ""
|
47
|
+
when Array
|
48
|
+
prefix = prefix_suffix[0]
|
49
|
+
suffix = prefix_suffix[1]
|
50
|
+
else
|
51
|
+
raise ArgumentError, "unexpected prefix_suffix: #{prefix_suffix.inspect}"
|
52
|
+
end
|
53
|
+
tmpdir ||= Dir.tmpdir
|
54
|
+
t = Time.now.strftime("%Y%m%d")
|
55
|
+
n = nil
|
56
|
+
begin
|
57
|
+
path = "#{tmpdir}/#{prefix}#{t}-#{$$}-#{rand(0x100000000).to_s(36)}"
|
58
|
+
path << "-#{n}" if n
|
59
|
+
path << suffix
|
60
|
+
Dir.mkdir(path, 0700)
|
61
|
+
rescue Errno::EEXIST
|
62
|
+
n ||= 0
|
63
|
+
n += 1
|
64
|
+
retry
|
65
|
+
end
|
66
|
+
|
67
|
+
if block_given?
|
68
|
+
begin
|
69
|
+
yield path
|
70
|
+
ensure
|
71
|
+
FileUtils.remove_entry_secure path
|
72
|
+
end
|
73
|
+
else
|
74
|
+
path
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
module TpkgTests
|
81
|
+
# Directory with test package contents
|
82
|
+
TESTPKGDIR = File.expand_path('testpkg', File.dirname(__FILE__))
|
83
|
+
# Fake command used in place of system commands
|
84
|
+
TESTCMDDIR = File.expand_path('testcmds', File.dirname(__FILE__))
|
85
|
+
TESTCMD = File.join(TESTCMDDIR, 'testcmd')
|
86
|
+
# Passphrase used for encrypting/decrypting packages
|
87
|
+
PASSPHRASE = 'password'
|
88
|
+
|
89
|
+
def create_metadata_file(filename, options={})
|
90
|
+
format = :xml
|
91
|
+
if options[:format]
|
92
|
+
format = options[:format]
|
93
|
+
# FIXME
|
94
|
+
if format != :xml
|
95
|
+
raise "Support for metadata file formats other than XML not yet implemented"
|
96
|
+
end
|
97
|
+
end
|
98
|
+
change = {}
|
99
|
+
if options[:change]
|
100
|
+
change = options[:change]
|
101
|
+
end
|
102
|
+
remove = []
|
103
|
+
if options[:remove]
|
104
|
+
remove = options[:remove]
|
105
|
+
end
|
106
|
+
file_defaults = {}
|
107
|
+
if options[:file_defaults]
|
108
|
+
file_defaults = options[:file_defaults]
|
109
|
+
end
|
110
|
+
files = {}
|
111
|
+
if options[:files]
|
112
|
+
files = options[:files]
|
113
|
+
end
|
114
|
+
dependencies = {}
|
115
|
+
if options[:dependencies]
|
116
|
+
dependencies = options[:dependencies]
|
117
|
+
end
|
118
|
+
conflicts = {}
|
119
|
+
if options[:conflicts]
|
120
|
+
conflicts = options[:conflicts]
|
121
|
+
end
|
122
|
+
externals = {}
|
123
|
+
if options[:externals]
|
124
|
+
externals = options[:externals]
|
125
|
+
end
|
126
|
+
|
127
|
+
# FIXME: We currently assume the specified filename exists and is a valid
|
128
|
+
# template file that we make changes to. We should create the metadata
|
129
|
+
# file from scratch. That would eliminate the need for :remove, which
|
130
|
+
# seems hacky. And eliminate the need for this half-baked parsing and
|
131
|
+
# manipulation, which is super hacky.
|
132
|
+
tpkgdst = Tempfile.new(File.basename(filename), File.dirname(filename))
|
133
|
+
IO.foreach(filename) do |line|
|
134
|
+
if line =~ /^\s*<(\w+)>/
|
135
|
+
field = $1
|
136
|
+
if change.has_key?(field)
|
137
|
+
line.sub!(/^(\s*<\w+>).*(<\/\w+>)/, '\1' + change[$1] + '\2')
|
138
|
+
elsif remove.include?(field)
|
139
|
+
line = ''
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
# Insert dependencies right before the files section
|
144
|
+
if line =~ /^\s*<files>/ && !dependencies.empty?
|
145
|
+
tpkgdst.puts(' <dependencies>')
|
146
|
+
dependencies.each do |name, opts|
|
147
|
+
tpkgdst.puts(' <dependency>')
|
148
|
+
tpkgdst.puts(" <name>#{name}</name>")
|
149
|
+
['minimum_version', 'maximum_version', 'minimum_package_version', 'maximum_package_version'].each do |opt|
|
150
|
+
if opts[opt]
|
151
|
+
tpkgdst.puts(" <#{opt}>#{opts[opt]}</#{opt}>")
|
152
|
+
end
|
153
|
+
end
|
154
|
+
if opts['native']
|
155
|
+
tpkgdst.puts(' <native/>')
|
156
|
+
end
|
157
|
+
tpkgdst.puts(' </dependency>')
|
158
|
+
end
|
159
|
+
tpkgdst.puts(' </dependencies>')
|
160
|
+
end
|
161
|
+
|
162
|
+
# Insert conflicts right before the files section
|
163
|
+
if line =~ /^\s*<files>/ && !conflicts.empty?
|
164
|
+
tpkgdst.puts(' <conflicts>')
|
165
|
+
conflicts.each do |name, opts|
|
166
|
+
tpkgdst.puts(' <conflict>')
|
167
|
+
tpkgdst.puts(" <name>#{name}</name>")
|
168
|
+
['minimum_version', 'maximum_version', 'minimum_package_version', 'maximum_package_version'].each do |opt|
|
169
|
+
if opts[opt]
|
170
|
+
tpkgdst.puts(" <#{opt}>#{opts[opt]}</#{opt}>")
|
171
|
+
end
|
172
|
+
end
|
173
|
+
if opts['native']
|
174
|
+
tpkgdst.puts(' <native/>')
|
175
|
+
end
|
176
|
+
tpkgdst.puts(' </conflict>')
|
177
|
+
end
|
178
|
+
tpkgdst.puts(' </conflicts>')
|
179
|
+
end
|
180
|
+
|
181
|
+
# Insert externals right before the files section
|
182
|
+
if line =~ /^\s*<files>/ && !externals.empty?
|
183
|
+
tpkgdst.puts(' <externals>')
|
184
|
+
externals.each do |name, opts|
|
185
|
+
tpkgdst.puts(' <external>')
|
186
|
+
tpkgdst.puts(" <name>#{name}</name>")
|
187
|
+
if opts['data']
|
188
|
+
tpkgdst.puts(" <data>#{opts['data']}</data>")
|
189
|
+
elsif opts['datafile']
|
190
|
+
tpkgdst.puts(" <datafile>#{opts['datafile']}</datafile>")
|
191
|
+
elsif opts['datascript']
|
192
|
+
tpkgdst.puts(" <datascript>#{opts['datascript']}</datascript>")
|
193
|
+
end
|
194
|
+
tpkgdst.puts(' </external>')
|
195
|
+
end
|
196
|
+
tpkgdst.puts(' </externals>')
|
197
|
+
end
|
198
|
+
|
199
|
+
# Insert file_defaults settings at the end of the files section
|
200
|
+
if line =~ /^\s*<\/files>/ && !file_defaults.empty?
|
201
|
+
tpkgdst.puts(' <file_defaults>')
|
202
|
+
if file_defaults['owner'] || file_defaults['group'] || file_defaults['perms']
|
203
|
+
tpkgdst.puts(' <posix>')
|
204
|
+
['owner', 'group', 'perms'].each do |opt|
|
205
|
+
if file_defaults[opt]
|
206
|
+
tpkgdst.puts(" <#{opt}>#{file_defaults[opt]}</#{opt}>")
|
207
|
+
end
|
208
|
+
end
|
209
|
+
tpkgdst.puts(' </posix>')
|
210
|
+
end
|
211
|
+
tpkgdst.puts(' </file_defaults>')
|
212
|
+
end
|
213
|
+
|
214
|
+
# Insert additional file entries at the end of the files section
|
215
|
+
if line =~ /^\s*<\/files>/ && !files.empty?
|
216
|
+
files.each do |path, opts|
|
217
|
+
tpkgdst.puts(' <file>')
|
218
|
+
tpkgdst.puts(" <path>#{path}</path>")
|
219
|
+
if opts['owner'] || opts['group'] || opts['perms']
|
220
|
+
tpkgdst.puts(' <posix>')
|
221
|
+
['owner', 'group', 'perms'].each do |opt|
|
222
|
+
if opts[opt]
|
223
|
+
tpkgdst.puts(" <#{opt}>#{opts[opt]}</#{opt}>")
|
224
|
+
end
|
225
|
+
end
|
226
|
+
tpkgdst.puts(' </posix>')
|
227
|
+
end
|
228
|
+
if opts['config']
|
229
|
+
tpkgdst.puts(' <config/>')
|
230
|
+
end
|
231
|
+
if opts['encrypt']
|
232
|
+
if opts['encrypt'] = 'precrypt'
|
233
|
+
tpkgdst.puts(' <encrypt precrypt="true"/>')
|
234
|
+
else
|
235
|
+
tpkgdst.puts(' <encrypt/>')
|
236
|
+
end
|
237
|
+
end
|
238
|
+
if opts['init']
|
239
|
+
tpkgdst.puts(' <init>')
|
240
|
+
if opts['init']['start']
|
241
|
+
tpkgdst.puts(" <start>#{opts['init']['start']}</start>")
|
242
|
+
end
|
243
|
+
if opts['init']['levels']
|
244
|
+
tpkgdst.puts(" <levels>#{opts['init']['levels']}</levels>")
|
245
|
+
end
|
246
|
+
tpkgdst.puts(' </init>')
|
247
|
+
end
|
248
|
+
if opts['crontab']
|
249
|
+
if opts['crontab']['user']
|
250
|
+
tpkgdst.puts(" <crontab><user>#{opts['crontab']['user']}</user></crontab>")
|
251
|
+
else
|
252
|
+
tpkgdst.puts(' <crontab/>')
|
253
|
+
end
|
254
|
+
end
|
255
|
+
tpkgdst.puts(' </file>')
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
tpkgdst.write(line)
|
260
|
+
end
|
261
|
+
tpkgdst.close
|
262
|
+
File.rename(tpkgdst.path, filename)
|
263
|
+
end
|
264
|
+
|
265
|
+
# Make up our regular test package, substituting any fields and adding
|
266
|
+
# dependencies as requested by the caller
|
267
|
+
def make_package(options={})
|
268
|
+
source_directory = TESTPKGDIR
|
269
|
+
if options[:source_directory]
|
270
|
+
source_directory = options[:source_directory]
|
271
|
+
end
|
272
|
+
output_directory = nil
|
273
|
+
if options[:output_directory]
|
274
|
+
output_directory = options[:output_directory]
|
275
|
+
end
|
276
|
+
passphrase = PASSPHRASE
|
277
|
+
if options[:passphrase]
|
278
|
+
passphrase = options[:passphrase]
|
279
|
+
end
|
280
|
+
|
281
|
+
pkgfile = nil
|
282
|
+
Dir.mktmpdir('pkgdir') do |pkgdir|
|
283
|
+
# Copy package contents into working directory
|
284
|
+
system("#{Tpkg::find_tar} -C #{source_directory} --exclude .svn --exclude 'tpkg-*.xml' --exclude 'tpkg*.yml' -cf - . | #{Tpkg::find_tar} -C #{pkgdir} -xpf -")
|
285
|
+
create_metadata_file(File.join(pkgdir, 'tpkg.xml'), options)
|
286
|
+
pkgfile = Tpkg.make_package(pkgdir, passphrase, options)
|
287
|
+
end
|
288
|
+
|
289
|
+
# move the pkgfile to designated directory (if user specifies it)
|
290
|
+
if output_directory
|
291
|
+
FileUtils.mkdir_p(output_directory)
|
292
|
+
FileUtils.move(pkgfile, output_directory)
|
293
|
+
pkgfile = File.join(output_directory, File.basename(pkgfile))
|
294
|
+
end
|
295
|
+
|
296
|
+
pkgfile
|
297
|
+
end
|
298
|
+
|
299
|
+
end
|
300
|
+
|