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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f2d2eb9632ecf11d24224648408b2ca0bb56ed99b3a0ad6b077edbf84930ad52
4
- data.tar.gz: 243668f7a95b77377911efcc686dec8f5d43a47b625aca6a30795b4d4d66a49a
3
+ metadata.gz: 6aa49d6ab2a370eda775a80206da80220936025ece39c3e121471815b309adbd
4
+ data.tar.gz: 60ab5eb1c7bcd3243f71aed658a85e84b2b37a02d061bf09156f0dd82c18d536
5
5
  SHA512:
6
- metadata.gz: fa7a60a3b4fba564f7b76786969699a446f46e72a7610065113c5fdcb02404b4d7ec3e9b6430d2ab48550ad19061341af5d29286786e1f833bb5b8a246735434
7
- data.tar.gz: d2f4375f10f9922ca466d9c154d2bfbd42ccb3a376e58be025299af1d3dafdbcc6d43175dd3fe9d76c87057d7f067e1ff01900968982b8ed193833e9f7819405
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
@@ -45,5 +45,6 @@ module Omnizip
45
45
  # Register built-in strategies
46
46
  ConversionRegistry.register(ZipToSevenZipStrategy)
47
47
  ConversionRegistry.register(SevenZipToZipStrategy)
48
+ ConversionRegistry.register(ExtractRepackStrategy)
48
49
  end
49
50
  end
@@ -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
@@ -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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Omnizip
4
- VERSION = "0.3.49"
4
+ VERSION = "0.3.50"
5
5
  end
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.49
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