omnizip 0.3.49 → 0.3.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/lib/omnizip/converter/conversion_registry.rb +1 -0
- data/lib/omnizip/converter/extract_repack_strategy.rb +61 -0
- data/lib/omnizip/converter.rb +2 -0
- data/lib/omnizip/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6aa49d6ab2a370eda775a80206da80220936025ece39c3e121471815b309adbd
|
|
4
|
+
data.tar.gz: 60ab5eb1c7bcd3243f71aed658a85e84b2b37a02d061bf09156f0dd82c18d536
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8e4cc8c3b167c07112ad5f45f3a870eb24b8ffd946cc7f9fe6c4b10bfe376e7efc5a0c975287027646d9bc7aef3f419e67eb1bd40e38824eb3e93219a3f78603
|
|
7
|
+
data.tar.gz: 7fe55f7e975c40eff0c2109167a0e23fa99f11949489a29f7555632a340b3ea16983091f09bfa6cd948e3351501fd66fb438d3ad90a40953ef514721fc0138f0
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.3.49] - 2026-08-31
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Read routes for `.rpm`, `.xar`, and `.msi`: the formats had
|
|
14
|
+
verified readers but no handler and no extension route, so
|
|
15
|
+
`list_archive('pkg.rpm')` silently fell through to the ZIP
|
|
16
|
+
reader. Three read-only handlers register them (extraction,
|
|
17
|
+
listing, entry reading; creation raises truthfully). `.msi`
|
|
18
|
+
streams are listed exactly as stored — MSI table-stream names
|
|
19
|
+
are mangled in an MSI-domain encoding the handler does not guess
|
|
20
|
+
at. The CLI `decompress` command learns the new extensions
|
|
21
|
+
(`.rpm` previously fell into the single-file LZMA path and failed
|
|
22
|
+
with `Invalid pb`).
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
- The 7z writer silently ignored its documented `filters:` option
|
|
26
|
+
(preprocessing filters are decode-side only); it now warns that
|
|
27
|
+
it writes unfiltered data instead of pretending.
|
|
28
|
+
|
|
10
29
|
## [0.3.48] - 2026-08-31
|
|
11
30
|
|
|
12
31
|
### Changed
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# frozen_string: true
|
|
2
|
+
|
|
3
|
+
require "tmpdir"
|
|
4
|
+
|
|
5
|
+
module Omnizip
|
|
6
|
+
module Converter
|
|
7
|
+
# Fallback conversion strategy: extract any routed source format
|
|
8
|
+
# and repack the tree into any writable target format, both
|
|
9
|
+
# through the handler registry. Registered after the direct
|
|
10
|
+
# entry-copy strategies, which keep precedence for their pairs.
|
|
11
|
+
class ExtractRepackStrategy < ConversionStrategy
|
|
12
|
+
WRITABLE_FORMATS = %i[zip seven_zip tar rar].freeze
|
|
13
|
+
|
|
14
|
+
# Any routed source extension converts to any writable target
|
|
15
|
+
def self.can_convert?(source, _target)
|
|
16
|
+
!source_format_for(source).nil? &&
|
|
17
|
+
WRITABLE_FORMATS.include?(target_format_for(_target))
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Routed read-side format for an extension, or nil
|
|
21
|
+
def self.source_format_for(path)
|
|
22
|
+
ext = File.extname(path).downcase
|
|
23
|
+
Convenience::ARCHIVE_FORMAT_EXTENSIONS[ext] ||
|
|
24
|
+
Convenience::READ_ARCHIVE_FORMAT_EXTENSIONS[ext]
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Writable format for a target extension, or nil
|
|
28
|
+
def self.target_format_for(path)
|
|
29
|
+
Convenience::ARCHIVE_FORMAT_EXTENSIONS[File.extname(path).downcase]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def convert
|
|
33
|
+
start_time = Time.now
|
|
34
|
+
|
|
35
|
+
Dir.mktmpdir("omnizip_convert_repack") do |tmp|
|
|
36
|
+
extracted = Omnizip.extract_archive(source_path, tmp)
|
|
37
|
+
|
|
38
|
+
Omnizip::Archive.create(target_path,
|
|
39
|
+
format: self.class.target_format_for(target_path)) do |b|
|
|
40
|
+
Dir.glob(File.join(tmp, "**", "*")).each do |path|
|
|
41
|
+
next if File.directory?(path)
|
|
42
|
+
|
|
43
|
+
b.add_file(path, path.delete_prefix("#{tmp}/"))
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
entry_count = extracted.size
|
|
48
|
+
create_result(start_time, entry_count)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
def source_format
|
|
53
|
+
self.class.source_format_for(source_path) || :unknown
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def target_format
|
|
57
|
+
self.class.target_format_for(target_path) || :unknown
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
data/lib/omnizip/converter.rb
CHANGED
|
@@ -11,6 +11,8 @@ module Omnizip
|
|
|
11
11
|
autoload :SevenZipToZipStrategy,
|
|
12
12
|
"omnizip/converter/seven_zip_to_zip_strategy"
|
|
13
13
|
autoload :ConversionRegistry, "omnizip/converter/conversion_registry"
|
|
14
|
+
autoload :ExtractRepackStrategy,
|
|
15
|
+
"omnizip/converter/extract_repack_strategy"
|
|
14
16
|
|
|
15
17
|
class << self
|
|
16
18
|
# Convert archive from one format to another
|
data/lib/omnizip/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omnizip
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.50
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
@@ -371,6 +371,7 @@ files:
|
|
|
371
371
|
- lib/omnizip/converter.rb
|
|
372
372
|
- lib/omnizip/converter/conversion_registry.rb
|
|
373
373
|
- lib/omnizip/converter/conversion_strategy.rb
|
|
374
|
+
- lib/omnizip/converter/extract_repack_strategy.rb
|
|
374
375
|
- lib/omnizip/converter/seven_zip_to_zip_strategy.rb
|
|
375
376
|
- lib/omnizip/converter/zip_to_seven_zip_strategy.rb
|
|
376
377
|
- lib/omnizip/crypto.rb
|