mixlib-archive 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -3
- data/VERSION +1 -1
- data/lib/mixlib/archive.rb +2 -0
- data/lib/mixlib/archive/tar.rb +22 -5
- data/lib/mixlib/archive/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fc6683cb1ac7178e4fb261923f6a5c1849e2e8a73b7ab95afbb28af5e30b7496
|
4
|
+
data.tar.gz: fde910fa8c62984f215bbea2b0dabc97f039d56268fc2de5b75a52b5541170a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d515dcc2ae6b37114e3abb384af186eab308317d5356782e6b4e48a25fa91592f4a8b6eaa4378191202ebce96d3f9d2ee853d43debd224d41ec79c20b539f3e0
|
7
|
+
data.tar.gz: 515ee38251f667317dfb88d3ea4df349d8c5d640508f534e7c71628b1d3654e9e406a6a8b661dae2cd7e488eb11ec0792babb18a73d64278aa99d30649a58ab0
|
data/CHANGELOG.md
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
<!-- usage documentation: http://expeditor-docs.es.chef.io/configuration/changelog/ -->
|
2
2
|
# Change Log
|
3
3
|
|
4
|
-
<!-- latest_release 0.4.
|
5
|
-
## [v0.4.
|
4
|
+
<!-- latest_release 0.4.5 -->
|
5
|
+
## [v0.4.5](https://github.com/chef/mixlib-archive/tree/v0.4.5) (2018-05-04)
|
6
6
|
|
7
7
|
#### Merged Pull Requests
|
8
|
-
- Fix up
|
8
|
+
- Fix up writing tar archives with the rubygems tar [#19](https://github.com/chef/mixlib-archive/pull/19) ([thommay](https://github.com/thommay))
|
9
9
|
<!-- latest_release -->
|
10
10
|
|
11
11
|
<!-- release_rollup since=0.4.2 -->
|
12
12
|
### Changes not yet released to rubygems.org
|
13
13
|
|
14
14
|
#### Merged Pull Requests
|
15
|
+
- Fix up writing tar archives with the rubygems tar [#19](https://github.com/chef/mixlib-archive/pull/19) ([thommay](https://github.com/thommay)) <!-- 0.4.5 -->
|
15
16
|
- Fix up creating archives [#18](https://github.com/chef/mixlib-archive/pull/18) ([thommay](https://github.com/thommay)) <!-- 0.4.4 -->
|
16
17
|
<!-- release_rollup -->
|
17
18
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.5
|
data/lib/mixlib/archive.rb
CHANGED
data/lib/mixlib/archive/tar.rb
CHANGED
@@ -34,7 +34,7 @@ module Mixlib
|
|
34
34
|
Mixlib::Archive::Log.warn "ignoring entry #{entry.full_name}"
|
35
35
|
next
|
36
36
|
end
|
37
|
-
dest ||= File.join(destination, entry.full_name)
|
37
|
+
dest ||= File.expand_path(File.join(destination, entry.full_name))
|
38
38
|
parent = File.dirname(dest)
|
39
39
|
FileUtils.mkdir_p(parent)
|
40
40
|
|
@@ -76,11 +76,18 @@ module Mixlib
|
|
76
76
|
Gem::Package::TarWriter.new(target) do |tar|
|
77
77
|
files.each do |fn|
|
78
78
|
mode = File.stat(fn).mode
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
if File.symlink?(fn)
|
80
|
+
target = File.readlink(fn)
|
81
|
+
tar.add_symlink(fn, target, mode)
|
82
|
+
elsif File.directory?(fn)
|
83
|
+
tar.mkdir(fn, mode)
|
84
|
+
elsif File.file?(fn)
|
85
|
+
file = File.open(fn, "rb")
|
86
|
+
tar.add_file(fn, mode) do |io|
|
87
|
+
io.write(file.read)
|
88
|
+
end
|
89
|
+
file.close
|
82
90
|
end
|
83
|
-
file.close
|
84
91
|
end
|
85
92
|
end
|
86
93
|
|
@@ -110,6 +117,14 @@ module Mixlib
|
|
110
117
|
IO.binread(path, 2) == [0x1F, 0x8B].pack("C*")
|
111
118
|
end
|
112
119
|
|
120
|
+
# tar's magic is at byte 257 and is "ustar\0"
|
121
|
+
def is_tar_archive?(io)
|
122
|
+
io.rewind
|
123
|
+
magic = io.read[257..262]
|
124
|
+
io.rewind
|
125
|
+
magic == "ustar\0"
|
126
|
+
end
|
127
|
+
|
113
128
|
def reader(&block)
|
114
129
|
raw = File.open(archive, "rb")
|
115
130
|
|
@@ -120,6 +135,8 @@ module Mixlib
|
|
120
135
|
raw
|
121
136
|
end
|
122
137
|
|
138
|
+
raise Mixlib::Archive::TarError, "Unrecognized archive format" unless is_tar_archive?(file)
|
139
|
+
|
123
140
|
Gem::Package::TarReader.new(file, &block)
|
124
141
|
ensure
|
125
142
|
if file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixlib-archive
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|