omnizip 0.3.13 → 0.3.14
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/lib/omnizip/algorithm.rb +36 -1
- data/lib/omnizip/algorithms/bzip2.rb +1 -3
- data/lib/omnizip/algorithms/deflate.rb +1 -3
- data/lib/omnizip/algorithms/deflate64.rb +2 -2
- data/lib/omnizip/algorithms/lzma.rb +1 -1
- data/lib/omnizip/algorithms/lzma2.rb +4 -12
- data/lib/omnizip/algorithms/zstandard.rb +1 -3
- data/lib/omnizip/algorithms.rb +14 -1
- data/lib/omnizip/commands/archive_list_command.rb +9 -7
- data/lib/omnizip/entry.rb +44 -0
- data/lib/omnizip/extraction/selective_extractor.rb +2 -10
- data/lib/omnizip/filter_pipeline.rb +1 -1
- data/lib/omnizip/filter_registry.rb +18 -16
- data/lib/omnizip/filters/bcj2.rb +1 -1
- data/lib/omnizip/filters/bcj_arm.rb +1 -1
- data/lib/omnizip/filters/bcj_arm64.rb +1 -1
- data/lib/omnizip/filters/bcj_ia64.rb +1 -1
- data/lib/omnizip/filters/bcj_ppc.rb +1 -1
- data/lib/omnizip/filters/bcj_sparc.rb +1 -1
- data/lib/omnizip/filters/bcj_x86.rb +1 -1
- data/lib/omnizip/filters.rb +0 -2
- data/lib/omnizip/formats/bzip2_file.rb +0 -7
- data/lib/omnizip/formats/cpio/entry.rb +6 -0
- data/lib/omnizip/formats/cpio.rb +0 -6
- data/lib/omnizip/formats/gzip.rb +0 -7
- data/lib/omnizip/formats/iso/directory_record.rb +7 -0
- data/lib/omnizip/formats/iso.rb +0 -5
- data/lib/omnizip/formats/lzip.rb +0 -7
- data/lib/omnizip/formats/lzma_alone.rb +0 -6
- data/lib/omnizip/formats/msi/entry.rb +6 -0
- data/lib/omnizip/formats/msi.rb +0 -9
- data/lib/omnizip/formats/ole/dirent.rb +6 -0
- data/lib/omnizip/formats/ole.rb +0 -9
- data/lib/omnizip/formats/rar.rb +0 -6
- data/lib/omnizip/formats/rar3/reader.rb +7 -0
- data/lib/omnizip/formats/rar5/reader.rb +7 -0
- data/lib/omnizip/formats/rpm/entry.rb +6 -0
- data/lib/omnizip/formats/seven_zip/models/file_entry.rb +7 -0
- data/lib/omnizip/formats/seven_zip.rb +0 -6
- data/lib/omnizip/formats/tar/entry.rb +6 -0
- data/lib/omnizip/formats/tar.rb +0 -6
- data/lib/omnizip/formats/xar/entry.rb +6 -0
- data/lib/omnizip/formats/xar.rb +0 -6
- data/lib/omnizip/formats/zip.rb +0 -6
- data/lib/omnizip/implementations.rb +18 -4
- data/lib/omnizip/metadata/entry_metadata.rb +7 -0
- data/lib/omnizip/parallel/engine.rb +48 -0
- data/lib/omnizip/parallel/parallel_compressor.rb +5 -16
- data/lib/omnizip/parallel/parallel_extractor.rb +5 -16
- data/lib/omnizip/parallel.rb +1 -0
- data/lib/omnizip/registry.rb +0 -1
- data/lib/omnizip/rubyzip_compat.rb +0 -1
- data/lib/omnizip/version.rb +1 -1
- data/lib/omnizip/zip/entry.rb +7 -0
- data/lib/omnizip.rb +1 -1
- metadata +4 -6
- data/lib/omnizip/filters/filter_base.rb +0 -6
- data/lib/omnizip/filters/registration.rb +0 -22
- data/lib/omnizip/filters/registry.rb +0 -111
- data/lib/omnizip/format_registry.rb +0 -100
data/lib/omnizip/formats/rar.rb
CHANGED
|
@@ -161,13 +161,7 @@ module Omnizip
|
|
|
161
161
|
def repair(archive_path, output_path)
|
|
162
162
|
ArchiveRepairer.new.repair(archive_path, output_path)
|
|
163
163
|
end
|
|
164
|
-
|
|
165
|
-
# Auto-register .rar format
|
|
166
|
-
def register!
|
|
167
|
-
FormatRegistry.register(".rar", "Omnizip::Formats::Rar::Reader")
|
|
168
|
-
end
|
|
169
164
|
end
|
|
170
165
|
end
|
|
171
166
|
end
|
|
172
167
|
end
|
|
173
|
-
|
|
@@ -361,10 +361,17 @@ module Omnizip
|
|
|
361
361
|
|
|
362
362
|
# RAR archive entry model
|
|
363
363
|
class Entry
|
|
364
|
+
include Omnizip::Entry
|
|
365
|
+
|
|
364
366
|
attr_accessor :name, :compressed_size, :uncompressed_size, :crc32,
|
|
365
367
|
:compression_method, :modified_time, :attributes,
|
|
366
368
|
:encrypted, :data_offset, :host_os, :salt
|
|
367
369
|
|
|
370
|
+
def entry_name = name
|
|
371
|
+
def entry_directory? = false
|
|
372
|
+
def entry_size = uncompressed_size
|
|
373
|
+
def entry_mtime = modified_time
|
|
374
|
+
|
|
368
375
|
def initialize(name: nil, compressed_size: nil, uncompressed_size: nil,
|
|
369
376
|
crc32: nil, compression_method: nil, modified_time: nil,
|
|
370
377
|
attributes: nil, encrypted: nil, data_offset: nil,
|
|
@@ -316,10 +316,17 @@ module Omnizip
|
|
|
316
316
|
|
|
317
317
|
# RAR v5 archive entry model
|
|
318
318
|
class Entry
|
|
319
|
+
include Omnizip::Entry
|
|
320
|
+
|
|
319
321
|
attr_accessor :name, :compressed_size, :uncompressed_size, :crc32,
|
|
320
322
|
:compression_method, :modified_time, :attributes,
|
|
321
323
|
:encrypted, :data_offset, :host_os, :is_directory
|
|
322
324
|
|
|
325
|
+
def entry_name = name
|
|
326
|
+
def entry_directory? = is_directory
|
|
327
|
+
def entry_size = uncompressed_size
|
|
328
|
+
def entry_mtime = modified_time
|
|
329
|
+
|
|
323
330
|
def initialize(name: nil, compressed_size: nil, uncompressed_size: nil,
|
|
324
331
|
crc32: nil, compression_method: nil, modified_time: nil,
|
|
325
332
|
attributes: nil, encrypted: nil, data_offset: nil,
|
|
@@ -8,8 +8,14 @@ module Omnizip
|
|
|
8
8
|
# Represents a single file within an RPM package.
|
|
9
9
|
# File information is assembled from multiple header tags.
|
|
10
10
|
class Entry
|
|
11
|
+
include Omnizip::Entry
|
|
11
12
|
include Omnizip::Formats::Rpm::Constants
|
|
12
13
|
|
|
14
|
+
def entry_name = path
|
|
15
|
+
def entry_directory? = mode && ::File.directory?(mode)
|
|
16
|
+
def entry_size = size
|
|
17
|
+
def entry_mtime = mtime
|
|
18
|
+
|
|
13
19
|
# @return [String] File path
|
|
14
20
|
attr_accessor :path
|
|
15
21
|
|
|
@@ -7,11 +7,18 @@ module Omnizip
|
|
|
7
7
|
# Represents a file entry in .7z archive
|
|
8
8
|
# Contains file metadata, attributes, and extraction information
|
|
9
9
|
class FileEntry
|
|
10
|
+
include Omnizip::Entry
|
|
11
|
+
|
|
10
12
|
attr_accessor :name, :size, :compressed_size, :crc, :is_dir,
|
|
11
13
|
:is_empty, :is_anti, :has_stream, :mtime, :atime,
|
|
12
14
|
:ctime, :attributes, :folder_index, :file_index,
|
|
13
15
|
:source_path, :inline_data, :compression_options
|
|
14
16
|
|
|
17
|
+
def entry_name = name
|
|
18
|
+
def entry_directory? = is_dir
|
|
19
|
+
def entry_size = size
|
|
20
|
+
def entry_mtime = mtime
|
|
21
|
+
|
|
15
22
|
# Initialize file entry
|
|
16
23
|
def initialize
|
|
17
24
|
@name = nil
|
|
@@ -7,12 +7,18 @@ module Omnizip
|
|
|
7
7
|
#
|
|
8
8
|
# Represents a single entry (file, directory, link) in a TAR archive
|
|
9
9
|
class Entry
|
|
10
|
+
include Omnizip::Entry
|
|
10
11
|
include Omnizip::Formats::Tar::Constants
|
|
11
12
|
|
|
12
13
|
attr_accessor :name, :mode, :uid, :gid, :size, :mtime, :typeflag,
|
|
13
14
|
:linkname, :uname, :gname, :devmajor, :devminor, :prefix
|
|
14
15
|
attr_reader :data
|
|
15
16
|
|
|
17
|
+
def entry_name = name
|
|
18
|
+
def entry_directory? = directory?
|
|
19
|
+
def entry_size = size
|
|
20
|
+
def entry_mtime = mtime
|
|
21
|
+
|
|
16
22
|
# Initialize a new TAR entry
|
|
17
23
|
#
|
|
18
24
|
# @param name [String] Entry name/path
|
data/lib/omnizip/formats/tar.rb
CHANGED
|
@@ -8,8 +8,14 @@ module Omnizip
|
|
|
8
8
|
# Represents a single file/directory/link in a XAR archive.
|
|
9
9
|
# Each entry has metadata and optional data.
|
|
10
10
|
class Entry
|
|
11
|
+
include Omnizip::Entry
|
|
11
12
|
include Omnizip::Formats::Xar::Constants
|
|
12
13
|
|
|
14
|
+
def entry_name = name
|
|
15
|
+
def entry_directory? = type == :directory
|
|
16
|
+
def entry_size = size
|
|
17
|
+
def entry_mtime = mtime
|
|
18
|
+
|
|
13
19
|
attr_accessor :id, :name, :type, :mode, :uid, :gid, :user, :group,
|
|
14
20
|
:size, :ctime, :mtime, :atime,
|
|
15
21
|
:data_offset, :data_length, :data_size, :data_encoding,
|
data/lib/omnizip/formats/xar.rb
CHANGED
|
@@ -139,13 +139,7 @@ module Omnizip
|
|
|
139
139
|
def info(path)
|
|
140
140
|
open(path, &:info) # rubocop:disable Security/Open
|
|
141
141
|
end
|
|
142
|
-
|
|
143
|
-
# Auto-register XAR format when loaded
|
|
144
|
-
def register!
|
|
145
|
-
FormatRegistry.register(".xar", Reader)
|
|
146
|
-
end
|
|
147
142
|
end
|
|
148
143
|
end
|
|
149
144
|
end
|
|
150
145
|
end
|
|
151
|
-
|
data/lib/omnizip/formats/zip.rb
CHANGED
|
@@ -1,11 +1,25 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
module Omnizip
|
|
4
|
+
# Bit-level SDK ports: state machines, range coders, match finders,
|
|
5
|
+
# raw LZMA/LZMA2 encoders and decoders.
|
|
6
|
+
#
|
|
7
|
+
# This namespace owns the *primitives*; +Omnizip::Algorithms+ owns
|
|
8
|
+
# the *streaming contract*. The boundary is: +Algorithms+ calls
|
|
9
|
+
# +Implementations+, never the reverse. Files under this tree
|
|
10
|
+
# should never reach across into format-specific concerns (no
|
|
11
|
+
# .7z header parsing, no ZIP central directory, no tar entry
|
|
12
|
+
# metadata).
|
|
13
|
+
#
|
|
14
|
+
# The two top-level sub-namespaces mirror the upstream SDK split:
|
|
15
|
+
# - +SevenZip+ : ports of 7-Zip's LZMA/LZMA2 encoder + decoder
|
|
16
|
+
# - +XZUtils+ : ports of XZ Utils' LZMA/LZMA2 encoder + decoder
|
|
17
|
+
#
|
|
18
|
+
# Despite the LZMA name, the two SDKs diverge in subtle ways (no
|
|
19
|
+
# EOS marker, different chunk padding, different property-byte
|
|
20
|
+
# handling); keeping them in separate trees makes those
|
|
21
|
+
# divergences visible rather than hidden in flag parameters.
|
|
4
22
|
module Implementations
|
|
5
|
-
# Implementation namespace for various algorithm ports
|
|
6
|
-
# This module contains reference implementations ported from external projects
|
|
7
|
-
|
|
8
|
-
# Base classes for implementation inheritance
|
|
9
23
|
autoload :Base, "omnizip/implementations/base"
|
|
10
24
|
end
|
|
11
25
|
end
|
|
@@ -5,8 +5,15 @@ module Omnizip
|
|
|
5
5
|
# Model for file entry metadata
|
|
6
6
|
# Wraps CentralDirectoryHeader with a cleaner metadata API
|
|
7
7
|
class EntryMetadata
|
|
8
|
+
include Omnizip::Entry
|
|
9
|
+
|
|
8
10
|
attr_reader :entry
|
|
9
11
|
|
|
12
|
+
def entry_name = entry.name
|
|
13
|
+
def entry_directory? = entry.directory?
|
|
14
|
+
def entry_size = entry.size
|
|
15
|
+
def entry_mtime = entry.time
|
|
16
|
+
|
|
10
17
|
# Initialize metadata for an entry
|
|
11
18
|
# @param entry [Omnizip::Zip::Entry] The entry to manage metadata for
|
|
12
19
|
def initialize(entry)
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "fractor"
|
|
4
|
+
|
|
5
|
+
module Omnizip
|
|
6
|
+
module Parallel
|
|
7
|
+
# Engine owns the Fractor worker-pool dance: build the pool, submit
|
|
8
|
+
# a batch of work, run it to completion, return successful and
|
|
9
|
+
# failed results. Callers (ParallelCompressor, ParallelExtractor,
|
|
10
|
+
# future operations) supply the worker class and the work items;
|
|
11
|
+
# Engine handles the threading.
|
|
12
|
+
#
|
|
13
|
+
# This is the deep module behind the parallel API: the threading
|
|
14
|
+
# shape is identical across every consumer, so it lives here once.
|
|
15
|
+
# Domain-specific concerns (which file to read, which archive to
|
|
16
|
+
# open, what stats to track) stay with the caller.
|
|
17
|
+
class Engine
|
|
18
|
+
# @param worker_class [Class] a +Fractor::Worker+ subclass whose
|
|
19
|
+
# +#process(work)+ turns one work item into a result.
|
|
20
|
+
# @param threads [Integer] worker count.
|
|
21
|
+
def initialize(worker_class:, threads:)
|
|
22
|
+
@worker_class = worker_class
|
|
23
|
+
@threads = threads
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Run +work_items+ through the pool and yield each successful
|
|
27
|
+
# +Fractor::WorkResult+ to the caller-supplied block.
|
|
28
|
+
#
|
|
29
|
+
# @param work_items [Array<Fractor::Work>] batch to submit.
|
|
30
|
+
# @yieldparam result [Fractor::WorkResult] a successful result.
|
|
31
|
+
# @return [Array<Fractor::WorkResult>] the failed results, for
|
|
32
|
+
# the caller to decide how to surface.
|
|
33
|
+
def run(work_items)
|
|
34
|
+
pool = Fractor::WorkerPool.new(
|
|
35
|
+
worker_class: @worker_class,
|
|
36
|
+
num_workers: @threads,
|
|
37
|
+
continuous: false,
|
|
38
|
+
)
|
|
39
|
+
pool.start
|
|
40
|
+
pool.submit_batch(work_items)
|
|
41
|
+
pool.run
|
|
42
|
+
|
|
43
|
+
pool.successful_results.each { |r| yield r if block_given? }
|
|
44
|
+
pool.failed_results
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
@@ -212,20 +212,11 @@ level: 6)
|
|
|
212
212
|
)
|
|
213
213
|
end
|
|
214
214
|
|
|
215
|
-
#
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
)
|
|
221
|
-
|
|
222
|
-
pool.start
|
|
223
|
-
pool.submit_batch(work_items)
|
|
224
|
-
pool.run
|
|
225
|
-
|
|
226
|
-
# Collect results
|
|
227
|
-
results = pool.successful_results
|
|
228
|
-
errors = pool.failed_results
|
|
215
|
+
# Run the worker pool through the shared engine.
|
|
216
|
+
engine = Engine.new(worker_class: CompressionWorker,
|
|
217
|
+
threads: @options.threads)
|
|
218
|
+
results = []
|
|
219
|
+
errors = engine.run(work_items) { |r| results << r }
|
|
229
220
|
|
|
230
221
|
# Handle errors
|
|
231
222
|
unless errors.empty?
|
|
@@ -238,8 +229,6 @@ level: 6)
|
|
|
238
229
|
# Write archive sequentially (thread-safe)
|
|
239
230
|
write_archive(output, results, compression: compression)
|
|
240
231
|
|
|
241
|
-
pool.shutdown
|
|
242
|
-
|
|
243
232
|
@stats[:end_time] = Time.now
|
|
244
233
|
@stats[:files_processed] = results.size
|
|
245
234
|
|
|
@@ -201,20 +201,11 @@ module Omnizip
|
|
|
201
201
|
)
|
|
202
202
|
end
|
|
203
203
|
|
|
204
|
-
#
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
)
|
|
210
|
-
|
|
211
|
-
pool.start
|
|
212
|
-
pool.submit_batch(work_items)
|
|
213
|
-
pool.run
|
|
214
|
-
|
|
215
|
-
# Collect results
|
|
216
|
-
results = pool.successful_results
|
|
217
|
-
errors = pool.failed_results
|
|
204
|
+
# Run the worker pool through the shared engine.
|
|
205
|
+
engine = Engine.new(worker_class: ExtractionWorker,
|
|
206
|
+
threads: @options.threads)
|
|
207
|
+
results = []
|
|
208
|
+
errors = engine.run(work_items) { |r| results << r }
|
|
218
209
|
|
|
219
210
|
# Handle errors
|
|
220
211
|
unless errors.empty?
|
|
@@ -227,8 +218,6 @@ module Omnizip
|
|
|
227
218
|
# Write files to disk (thread-safe)
|
|
228
219
|
extracted_paths = write_extracted_files(results, overwrite: overwrite)
|
|
229
220
|
|
|
230
|
-
pool.shutdown
|
|
231
|
-
|
|
232
221
|
@stats[:end_time] = Time.now
|
|
233
222
|
@stats[:files_extracted] = results.size
|
|
234
223
|
|
data/lib/omnizip/parallel.rb
CHANGED
|
@@ -26,6 +26,7 @@ module Omnizip
|
|
|
26
26
|
autoload :JobQueue, "omnizip/parallel/job_queue"
|
|
27
27
|
autoload :JobScheduler, "omnizip/parallel/job_scheduler"
|
|
28
28
|
autoload :WorkerPool, "omnizip/parallel/worker_pool"
|
|
29
|
+
autoload :Engine, "omnizip/parallel/engine"
|
|
29
30
|
autoload :ParallelCompressor, "omnizip/parallel/parallel_compressor"
|
|
30
31
|
autoload :ParallelExtractor, "omnizip/parallel/parallel_extractor"
|
|
31
32
|
|
data/lib/omnizip/registry.rb
CHANGED
data/lib/omnizip/version.rb
CHANGED
data/lib/omnizip/zip/entry.rb
CHANGED
|
@@ -5,8 +5,15 @@ module Omnizip
|
|
|
5
5
|
# Rubyzip-compatible Entry class
|
|
6
6
|
# Wraps CentralDirectoryHeader with rubyzip API
|
|
7
7
|
class Entry
|
|
8
|
+
include Omnizip::Entry
|
|
9
|
+
|
|
8
10
|
attr_reader :header, :ftype, :filepath
|
|
9
11
|
|
|
12
|
+
def entry_name = name
|
|
13
|
+
def entry_directory? = directory?
|
|
14
|
+
def entry_size = size
|
|
15
|
+
def entry_mtime = time
|
|
16
|
+
|
|
10
17
|
# Create entry from CentralDirectoryHeader
|
|
11
18
|
def initialize(header, filepath: nil)
|
|
12
19
|
@header = header
|
data/lib/omnizip.rb
CHANGED
|
@@ -43,7 +43,6 @@ module Omnizip
|
|
|
43
43
|
autoload :Registry, "omnizip/registry"
|
|
44
44
|
autoload :Algorithm, "omnizip/algorithm"
|
|
45
45
|
autoload :AlgorithmRegistry, "omnizip/algorithm_registry"
|
|
46
|
-
autoload :FormatRegistry, "omnizip/format_registry"
|
|
47
46
|
autoload :OptimizationRegistry, "omnizip/optimization_registry"
|
|
48
47
|
autoload :ChecksumRegistry, "omnizip/checksum_registry"
|
|
49
48
|
autoload :FilterRegistry, "omnizip/filter_registry"
|
|
@@ -60,6 +59,7 @@ module Omnizip
|
|
|
60
59
|
autoload :ETA, "omnizip/eta"
|
|
61
60
|
autoload :Progress, "omnizip/progress"
|
|
62
61
|
autoload :Metadata, "omnizip/metadata"
|
|
62
|
+
autoload :Entry, "omnizip/entry"
|
|
63
63
|
autoload :Converter, "omnizip/converter"
|
|
64
64
|
autoload :LinkHandler, "omnizip/link_handler"
|
|
65
65
|
autoload :Parity, "omnizip/parity"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
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.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-07-
|
|
11
|
+
date: 2026-07-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|
|
@@ -364,6 +364,7 @@ files:
|
|
|
364
364
|
- lib/omnizip/crypto/aes256/cipher.rb
|
|
365
365
|
- lib/omnizip/crypto/aes256/constants.rb
|
|
366
366
|
- lib/omnizip/crypto/aes256/key_derivation.rb
|
|
367
|
+
- lib/omnizip/entry.rb
|
|
367
368
|
- lib/omnizip/error.rb
|
|
368
369
|
- lib/omnizip/eta.rb
|
|
369
370
|
- lib/omnizip/eta/exponential_smoothing_estimator.rb
|
|
@@ -397,12 +398,8 @@ files:
|
|
|
397
398
|
- lib/omnizip/filters/bcj_sparc.rb
|
|
398
399
|
- lib/omnizip/filters/bcj_x86.rb
|
|
399
400
|
- lib/omnizip/filters/delta.rb
|
|
400
|
-
- lib/omnizip/filters/filter_base.rb
|
|
401
|
-
- lib/omnizip/filters/registration.rb
|
|
402
|
-
- lib/omnizip/filters/registry.rb
|
|
403
401
|
- lib/omnizip/filters/xz_delta.rb
|
|
404
402
|
- lib/omnizip/format_detector.rb
|
|
405
|
-
- lib/omnizip/format_registry.rb
|
|
406
403
|
- lib/omnizip/formats.rb
|
|
407
404
|
- lib/omnizip/formats/.keep
|
|
408
405
|
- lib/omnizip/formats/bzip2_file.rb
|
|
@@ -630,6 +627,7 @@ files:
|
|
|
630
627
|
- lib/omnizip/models/split_options.rb
|
|
631
628
|
- lib/omnizip/optimization_registry.rb
|
|
632
629
|
- lib/omnizip/parallel.rb
|
|
630
|
+
- lib/omnizip/parallel/engine.rb
|
|
633
631
|
- lib/omnizip/parallel/job_queue.rb
|
|
634
632
|
- lib/omnizip/parallel/job_scheduler.rb
|
|
635
633
|
- lib/omnizip/parallel/parallel_compressor.rb
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# FilterBase is a historical alias for Omnizip::Filter. New code should
|
|
4
|
-
# inherit from Omnizip::Filter directly; FilterBase is kept for
|
|
5
|
-
# backward compatibility with existing subclasses (BcjX86, BcjArm, …).
|
|
6
|
-
Omnizip::Filters::FilterBase = Omnizip::Filter
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# Filter registration - triggers autoload and registers all filters
|
|
4
|
-
# This file should be required after filters.rb which sets up autoloads
|
|
5
|
-
|
|
6
|
-
module Omnizip
|
|
7
|
-
module Filters
|
|
8
|
-
# Touch constants to trigger autoload
|
|
9
|
-
BCJ
|
|
10
|
-
BcjX86
|
|
11
|
-
Bcj2
|
|
12
|
-
BcjArm
|
|
13
|
-
BcjArm64
|
|
14
|
-
BcjPpc
|
|
15
|
-
BcjSparc
|
|
16
|
-
BcjIa64
|
|
17
|
-
Delta
|
|
18
|
-
end
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# Filter registration is handled by each filter class in their initialize methods
|
|
22
|
-
# via FilterRegistry.register calls
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
#
|
|
4
|
-
# Copyright (C) 2024 Ribose Inc.
|
|
5
|
-
#
|
|
6
|
-
# This file is part of Omnizip.
|
|
7
|
-
#
|
|
8
|
-
# Omnizip is a pure Ruby port of 7-Zip compression algorithms.
|
|
9
|
-
# Based on the 7-Zip LZMA SDK by Igor Pavlov.
|
|
10
|
-
#
|
|
11
|
-
# This library is free software; you can redistribute it and/or
|
|
12
|
-
# modify it under the terms of the GNU Lesser General Public
|
|
13
|
-
# License as published by the Free Software Foundation; either
|
|
14
|
-
# version 2.1 of the License, or (at your option) any later version.
|
|
15
|
-
#
|
|
16
|
-
# See the COPYING file for the complete text of the license.
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
module Omnizip
|
|
20
|
-
module Filters
|
|
21
|
-
# Registry for auto-registering all preprocessing filters.
|
|
22
|
-
#
|
|
23
|
-
# This module centralizes filter registration, ensuring all filters
|
|
24
|
-
# are properly registered with their supported formats.
|
|
25
|
-
module Registry
|
|
26
|
-
# Register all BCJ filters with appropriate format support.
|
|
27
|
-
#
|
|
28
|
-
# BCJ filters are architecture-specific filters for executable code.
|
|
29
|
-
# XZ format supports a subset of architectures (no ARM64),
|
|
30
|
-
# while 7z supports all.
|
|
31
|
-
#
|
|
32
|
-
# @return [void]
|
|
33
|
-
def self.register_bcj_filters
|
|
34
|
-
# Individual BCJ architecture filters (use hyphens to match existing convention)
|
|
35
|
-
register_bcj_filter(:"bcj-x86", BcjX86, architecture: :x86)
|
|
36
|
-
register_bcj_filter(:"bcj-arm", BcjArm, architecture: :arm)
|
|
37
|
-
register_bcj_filter(:"bcj-arm64", BcjArm64, architecture: :arm64,
|
|
38
|
-
xz_supported: false)
|
|
39
|
-
register_bcj_filter(:"bcj-ia64", BcjIa64, architecture: :ia64)
|
|
40
|
-
register_bcj_filter(:"bcj-ppc", BcjPpc, architecture: :powerpc)
|
|
41
|
-
register_bcj_filter(:"bcj-sparc", BcjSparc, architecture: :sparc)
|
|
42
|
-
|
|
43
|
-
# Unified BCJ filter (Task 2) - supports all architectures
|
|
44
|
-
# Note: We register it as 'bcj' without architecture suffix
|
|
45
|
-
Omnizip::FilterRegistry.register_with_formats(
|
|
46
|
-
:bcj,
|
|
47
|
-
Omnizip::Filters::BCJ,
|
|
48
|
-
formats: [:seven_zip], # Only 7z for now (uses architecture parameter)
|
|
49
|
-
)
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
# Register a BCJ filter with format support.
|
|
53
|
-
#
|
|
54
|
-
# @param name [Symbol] Filter name identifier
|
|
55
|
-
# @param filter_class [Class] Filter class to register
|
|
56
|
-
# @param architecture [Symbol] Target architecture
|
|
57
|
-
# @param xz_supported [Boolean] Whether XZ format supports this architecture
|
|
58
|
-
# @return [void]
|
|
59
|
-
def self.register_bcj_filter(name, filter_class, architecture:,
|
|
60
|
-
xz_supported: true)
|
|
61
|
-
formats = [:seven_zip]
|
|
62
|
-
formats << :xz if xz_supported
|
|
63
|
-
Omnizip::FilterRegistry.register_with_formats(name, filter_class,
|
|
64
|
-
formats: formats)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
# Register Delta filter.
|
|
68
|
-
#
|
|
69
|
-
# Delta filter is supported by both XZ and 7z formats.
|
|
70
|
-
#
|
|
71
|
-
# @return [void]
|
|
72
|
-
def self.register_delta_filter
|
|
73
|
-
Omnizip::FilterRegistry.register_with_formats(
|
|
74
|
-
:delta,
|
|
75
|
-
Delta,
|
|
76
|
-
formats: %i[seven_zip xz],
|
|
77
|
-
)
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
# Register BCJ2 filter.
|
|
81
|
-
#
|
|
82
|
-
# BCJ2 is a 4-stream variant of BCJ, primarily used by 7z.
|
|
83
|
-
# XZ does not support BCJ2.
|
|
84
|
-
#
|
|
85
|
-
# @return [void]
|
|
86
|
-
def self.register_bcj2_filter
|
|
87
|
-
Omnizip::FilterRegistry.register_with_formats(
|
|
88
|
-
:bcj2,
|
|
89
|
-
Bcj2,
|
|
90
|
-
formats: [:seven_zip], # Only 7z supports BCJ2
|
|
91
|
-
)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
# Register all filters.
|
|
95
|
-
#
|
|
96
|
-
# This method registers all available filters with their
|
|
97
|
-
# appropriate format support. Call this during application
|
|
98
|
-
# initialization to ensure all filters are available.
|
|
99
|
-
#
|
|
100
|
-
# @return [void]
|
|
101
|
-
def self.register_all
|
|
102
|
-
register_bcj_filters
|
|
103
|
-
register_delta_filter
|
|
104
|
-
register_bcj2_filter
|
|
105
|
-
end
|
|
106
|
-
end
|
|
107
|
-
end
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
# Auto-register all filters on load
|
|
111
|
-
Omnizip::Filters::Registry.register_all
|