archive_r_ruby 0.1.7 → 0.1.9

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.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -0
  3. data/NOTICE +71 -0
  4. data/VERSION +1 -0
  5. data/ext/archive_r/archive_r_ext.cc +9 -8
  6. data/ext/archive_r/vendor/archive_r/LICENSE +21 -0
  7. data/ext/archive_r/vendor/archive_r/NOTICE +71 -0
  8. data/ext/archive_r/vendor/archive_r/include/archive_r/data_stream.h +2 -2
  9. data/ext/archive_r/vendor/archive_r/include/archive_r/entry.h +8 -8
  10. data/ext/archive_r/vendor/archive_r/include/archive_r/multi_volume_stream_base.h +2 -2
  11. data/ext/archive_r/vendor/archive_r/include/archive_r/path_hierarchy_utils.h +0 -1
  12. data/ext/archive_r/vendor/archive_r/include/archive_r/platform_compat.h +8 -8
  13. data/ext/archive_r/vendor/archive_r/include/archive_r/traverser.h +2 -2
  14. data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.cc +10 -34
  15. data/ext/archive_r/vendor/archive_r/src/archive_stack_cursor.h +1 -3
  16. data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.cc +5 -6
  17. data/ext/archive_r/vendor/archive_r/src/archive_stack_orchestrator.h +2 -3
  18. data/ext/archive_r/vendor/archive_r/src/archive_type.cc +6 -13
  19. data/ext/archive_r/vendor/archive_r/src/archive_type.h +3 -3
  20. data/ext/archive_r/vendor/archive_r/src/entry.cc +2 -17
  21. data/ext/archive_r/vendor/archive_r/src/entry_fault_error.cc +23 -23
  22. data/ext/archive_r/vendor/archive_r/src/entry_impl.h +1 -2
  23. data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.cc +3 -8
  24. data/ext/archive_r/vendor/archive_r/src/multi_volume_manager.h +2 -4
  25. data/ext/archive_r/vendor/archive_r/src/multi_volume_stream_base.cc +23 -14
  26. data/ext/archive_r/vendor/archive_r/src/path_hierarchy.cc +1 -4
  27. data/ext/archive_r/vendor/archive_r/src/path_hierarchy_utils.cc +14 -36
  28. data/ext/archive_r/vendor/archive_r/src/simple_profiler.h +64 -75
  29. data/ext/archive_r/vendor/archive_r/src/system_file_stream.cc +21 -26
  30. data/ext/archive_r/vendor/archive_r/src/system_file_stream.h +2 -2
  31. data/ext/archive_r/vendor/archive_r/src/traverser.cc +18 -42
  32. data/lib/archive_r.rb +5 -1
  33. metadata +11 -5
  34. data/LICENSE.txt +0 -97
  35. data/ext/archive_r/vendor/archive_r/LICENSE.txt +0 -97
@@ -3,9 +3,9 @@
3
3
 
4
4
  #include "archive_r/traverser.h"
5
5
  #include "archive_r/entry.h"
6
+ #include "archive_r/entry_fault.h"
6
7
  #include "archive_r/path_hierarchy.h"
7
8
  #include "archive_r/path_hierarchy_utils.h"
8
- #include "archive_r/entry_fault.h"
9
9
  #include "archive_stack_orchestrator.h"
10
10
  #include "archive_type.h"
11
11
  #include "entry_fault_error.h"
@@ -31,7 +31,7 @@ archive_r::ArchiveOption to_archive_option(const TraverserOptions &options) {
31
31
  archive_r::ArchiveOption converted;
32
32
  converted.passphrases = options.passphrases;
33
33
  converted.formats = options.formats;
34
- converted.metadata_keys = options.metadata_keys;
34
+ converted.metadata_keys.insert(options.metadata_keys.begin(), options.metadata_keys.end());
35
35
  return converted;
36
36
  }
37
37
 
@@ -48,14 +48,13 @@ Traverser::Traverser(std::vector<PathHierarchy> paths, TraverserOptions options)
48
48
  throw std::invalid_argument("path hierarchy cannot be empty");
49
49
  }
50
50
  }
51
-
52
51
  }
53
52
 
54
53
  Traverser::Traverser(PathHierarchy path, TraverserOptions options)
55
- : Traverser(std::vector<PathHierarchy>{std::move(path)}, std::move(options)) {}
54
+ : Traverser(std::vector<PathHierarchy>{ std::move(path) }, std::move(options)) {}
56
55
 
57
56
  Traverser::Traverser(const std::string &path, TraverserOptions options)
58
- : Traverser(std::vector<PathHierarchy>{make_single_path(path)}, std::move(options)) {}
57
+ : Traverser(std::vector<PathHierarchy>{ make_single_path(path) }, std::move(options)) {}
59
58
 
60
59
  Traverser::~Traverser() = default;
61
60
 
@@ -65,7 +64,7 @@ Traverser::~Traverser() = default;
65
64
 
66
65
  class Traverser::Iterator::Impl {
67
66
  public:
68
- Impl(std::vector<PathHierarchy> paths, bool at_end, const TraverserOptions &traverser_options)
67
+ Impl(std::vector<PathHierarchy> paths, bool at_end, const TraverserOptions &traverser_options)
69
68
  : _paths(std::move(paths))
70
69
  , _at_end(at_end)
71
70
  , _archive_options(to_archive_option(traverser_options))
@@ -73,14 +72,9 @@ public:
73
72
  if (_at_end) {
74
73
  return;
75
74
  }
76
- if (_paths.empty()) {
77
- throw std::invalid_argument("paths cannot be empty");
78
- }
79
75
  ensure_shared_orchestrator();
80
-
81
- if (!advance_to_next_root()) {
82
- _at_end = true;
83
- }
76
+
77
+ _at_end = !advance_to_next_root();
84
78
  }
85
79
 
86
80
  Entry &get_entry() {
@@ -100,7 +94,7 @@ public:
100
94
  if (_current_entry->depth() == 0 && request_descend_into_archive && !_current_entry->is_directory()) {
101
95
  request_descend_into_archive = false;
102
96
  attempt_descend_into_root(_current_entry->path_hierarchy());
103
- }
97
+ }
104
98
  _current_entry.reset();
105
99
 
106
100
  if (fetch_from_archive(request_descend_into_archive)) {
@@ -114,13 +108,13 @@ public:
114
108
  if (advance_to_next_root()) {
115
109
  return;
116
110
  }
117
-
111
+
118
112
  descend_pending_multi_volumes();
119
-
113
+
120
114
  if (fetch_from_archive(false)) {
121
115
  return;
122
116
  }
123
-
117
+
124
118
  _at_end = true;
125
119
  }
126
120
 
@@ -128,10 +122,7 @@ public:
128
122
  if (this == other) {
129
123
  return true;
130
124
  }
131
- if (!other) {
132
- return false;
133
- }
134
- return _at_end && other->_at_end;
125
+ return other && _at_end && other->_at_end;
135
126
  }
136
127
 
137
128
  private:
@@ -143,9 +134,6 @@ private:
143
134
  }
144
135
 
145
136
  std::string normalize_path_string(const std::string &value) {
146
- if (value.empty()) {
147
- return value;
148
- }
149
137
  std::filesystem::path path_value(value);
150
138
  return path_value.lexically_normal().string();
151
139
  }
@@ -169,14 +157,9 @@ private:
169
157
  }
170
158
  ArchiveStackOrchestrator &orchestrator = *ensure_shared_orchestrator();
171
159
 
172
- try {
173
- if (orchestrator.advance(request_descend_into_archive)) {
174
- set_current_entry(orchestrator.current_entry_hierarchy());
175
- return true;
176
- }
177
- } catch (const EntryFaultError &error) {
178
- EntryFault fault = enrich_orchestrator_error(error, orchestrator);
179
- handle_orchestrator_error(fault);
160
+ if (orchestrator.advance(request_descend_into_archive)) {
161
+ set_current_entry(orchestrator.current_entry_hierarchy());
162
+ return true;
180
163
  }
181
164
  return false;
182
165
  }
@@ -224,13 +207,9 @@ private:
224
207
  }
225
208
  }
226
209
 
227
- void set_current_entry(PathHierarchy hierarchy) {
228
- _current_entry = Entry::create(std::move(hierarchy), ensure_shared_orchestrator(), _default_descent);
229
- }
210
+ void set_current_entry(PathHierarchy hierarchy) { _current_entry = Entry::create(std::move(hierarchy), ensure_shared_orchestrator(), _default_descent); }
230
211
 
231
- void handle_orchestrator_error(const EntryFault &fault) {
232
- dispatch_registered_fault(fault);
233
- }
212
+ void handle_orchestrator_error(const EntryFault &fault) { dispatch_registered_fault(fault); }
234
213
 
235
214
  void reset_source_state() {
236
215
  reset_directory_traversal();
@@ -251,9 +230,6 @@ private:
251
230
  if (fault.hierarchy.empty()) {
252
231
  fault.hierarchy = orchestrator.current_entry_hierarchy();
253
232
  }
254
- if (fault.message.empty() && error.what()) {
255
- fault.message = error.what();
256
- }
257
233
  return fault;
258
234
  }
259
235
 
@@ -273,7 +249,7 @@ private:
273
249
  // ============================================================================
274
250
 
275
251
  Traverser::Iterator::Iterator(std::unique_ptr<Impl> impl)
276
- : _impl(std::move(impl)) {}
252
+ : _impl(std::move(impl)) {}
277
253
 
278
254
  Traverser::Iterator::~Iterator() = default;
279
255
 
data/lib/archive_r.rb CHANGED
@@ -35,7 +35,11 @@ rescue LoadError
35
35
  end
36
36
 
37
37
  module Archive_r
38
- VERSION = "0.1.7"
38
+ version_path = File.expand_path('../VERSION', __dir__)
39
+ unless File.exist?(version_path)
40
+ version_path = File.expand_path('../../../VERSION', __dir__)
41
+ end
42
+ VERSION = File.read(version_path).strip
39
43
  # Common archive formats excluding libarchive's mtree/raw pseudo formats
40
44
  STANDARD_FORMATS = %w[
41
45
  7zip ar cab cpio empty iso9660 lha rar tar warc xar zip
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: archive_r_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - raizo.tcs
8
+ autorequire:
8
9
  bindir: bin
9
10
  cert_chain: []
10
- date: 1980-01-02 00:00:00.000000000 Z
11
+ date: 2025-12-25 00:00:00.000000000 Z
11
12
  dependencies:
12
13
  - !ruby/object:Gem::Dependency
13
14
  name: rake
@@ -48,11 +49,14 @@ extensions:
48
49
  - ext/archive_r/extconf.rb
49
50
  extra_rdoc_files: []
50
51
  files:
51
- - LICENSE.txt
52
+ - LICENSE
53
+ - NOTICE
52
54
  - README.md
55
+ - VERSION
53
56
  - ext/archive_r/archive_r_ext.cc
54
57
  - ext/archive_r/extconf.rb
55
- - ext/archive_r/vendor/archive_r/LICENSE.txt
58
+ - ext/archive_r/vendor/archive_r/LICENSE
59
+ - ext/archive_r/vendor/archive_r/NOTICE
56
60
  - ext/archive_r/vendor/archive_r/include/archive_r/data_stream.h
57
61
  - ext/archive_r/vendor/archive_r/include/archive_r/entry.h
58
62
  - ext/archive_r/vendor/archive_r/include/archive_r/entry_fault.h
@@ -92,6 +96,7 @@ metadata:
92
96
  source_code_uri: https://github.com/raizo-tcs/archive_r
93
97
  bug_tracker_uri: https://github.com/raizo-tcs/archive_r/issues
94
98
  changelog_uri: https://github.com/raizo-tcs/archive_r/releases
99
+ post_install_message:
95
100
  rdoc_options: []
96
101
  require_paths:
97
102
  - lib
@@ -106,7 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
106
111
  - !ruby/object:Gem::Version
107
112
  version: '0'
108
113
  requirements: []
109
- rubygems_version: 4.0.1
114
+ rubygems_version: 3.4.20
115
+ signing_key:
110
116
  specification_version: 4
111
117
  summary: 'Ruby bindings for archive_r: libarchive-based streaming traversal for recursive
112
118
  nested archives (no temp files, no large in-memory buffers)'
data/LICENSE.txt DELETED
@@ -1,97 +0,0 @@
1
- archive_r License
2
- Version: 0.1.7 (2025-12-16)
3
-
4
- ----------------------------------------
5
- Primary License
6
- ----------------------------------------
7
-
8
- MIT License
9
-
10
- Copyright (c) 2025 archive_r Team
11
-
12
- Permission is hereby granted, free of charge, to any person obtaining a copy
13
- of this software and associated documentation files (the "Software"), to deal
14
- in the Software without restriction, including without limitation the rights
15
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- copies of the Software, and to permit persons to whom the Software is
17
- furnished to do so, subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all
20
- copies or substantial portions of the Software.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- SOFTWARE.
29
-
30
- ----------------------------------------
31
- Third-Party Notices
32
- ----------------------------------------
33
-
34
- This distribution bundles or links against the following third-party
35
- components. Their respective license terms apply in addition to the MIT
36
- License shown above.
37
-
38
- 1. libarchive
39
- - Purpose: core archive reading and writing functionality for the C++
40
- library and language bindings.
41
- - License: New BSD License (https://www.libarchive.org/)
42
-
43
- 2. pybind11
44
- - Purpose: header-only binding generator for the Python extension module.
45
- - License: BSD-style License (https://github.com/pybind/pybind11)
46
-
47
- The following components are redistributed only because libarchive (bundled with archive_r) depends on them at runtime:
48
-
49
- 3. zlib
50
- - Purpose: libarchive dependency providing DEFLATE compression; bundled inside archive_r binaries and wheels because libarchive requires it.
51
- - License: zlib License (https://zlib.net/zlib_license.html)
52
-
53
- 4. bzip2
54
- - Purpose: libarchive dependency providing bzip2 compression support; distributed with archive_r artifacts.
55
- - License: BSD-style license (https://sourceware.org/bzip2/)
56
-
57
- 5. liblzma (XZ Utils)
58
- - Purpose: libarchive dependency providing LZMA/XZ compression; included with archive_r packages.
59
- - License: Public Domain + GNU LGPLv2.1+ (https://tukaani.org/xz/)
60
-
61
- 6. libxml2
62
- - Purpose: libarchive dependency used for archive formats such as xar; distributed alongside archive_r.
63
- - License: MIT-style License (http://xmlsoft.org/)
64
-
65
- 7. zstd
66
- - Purpose: libarchive dependency providing Zstandard compression; shipped within archive_r binaries.
67
- - License: BSD License (https://github.com/facebook/zstd)
68
-
69
- 8. Nettle
70
- - Purpose: libarchive dependency providing cryptographic support (macOS/Linux); bundled with archive_r binaries.
71
- - License: GNU LGPLv3+ or GNU GPLv2+ (https://www.lysator.liu.se/~nisse/nettle/)
72
-
73
- 9. mini-gmp
74
- - Purpose: Nettle dependency for arithmetic operations (macOS/Linux); bundled with archive_r binaries.
75
- - License: GNU LGPLv3+ or GNU GPLv2+ (https://gmplib.org/)
76
-
77
- 10. OpenSSL 3
78
- - Purpose: libarchive dependency providing cryptographic support (Windows); bundled with archive_r Windows wheels.
79
- - License: Apache License 2.0 with OpenSSL exception (https://www.openssl.org/source/license.html)
80
-
81
- 11. lz4
82
- - Purpose: libarchive dependency providing LZ4 compression; shipped with archive_r artifacts when required.
83
- - License: BSD 2-Clause (https://github.com/lz4/lz4)
84
-
85
- 12. libb2 (BLAKE2)
86
- - Purpose: libarchive dependency providing BLAKE2 hashing; bundled when archive formats require it.
87
- - License: CC0 1.0 Universal (https://github.com/BLAKE2/libb2)
88
-
89
- 13. libattr
90
- - Purpose: libarchive dependency providing extended attribute support on POSIX platforms; included in POSIX builds only.
91
- - License: LGPL-2.1-or-later for the library (https://savannah.nongnu.org/projects/attr)
92
-
93
- 14. libacl
94
- - Purpose: libarchive dependency providing POSIX ACL support; included in POSIX builds only.
95
- - License: LGPL-2.1-or-later for the library (https://savannah.nongnu.org/projects/acl)
96
- Users of archive_r should review the linked third-party licenses to ensure
97
- compliance with their terms when redistributing this software.
@@ -1,97 +0,0 @@
1
- archive_r License
2
- Version: 0.1.7 (2025-12-16)
3
-
4
- ----------------------------------------
5
- Primary License
6
- ----------------------------------------
7
-
8
- MIT License
9
-
10
- Copyright (c) 2025 archive_r Team
11
-
12
- Permission is hereby granted, free of charge, to any person obtaining a copy
13
- of this software and associated documentation files (the "Software"), to deal
14
- in the Software without restriction, including without limitation the rights
15
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- copies of the Software, and to permit persons to whom the Software is
17
- furnished to do so, subject to the following conditions:
18
-
19
- The above copyright notice and this permission notice shall be included in all
20
- copies or substantial portions of the Software.
21
-
22
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- SOFTWARE.
29
-
30
- ----------------------------------------
31
- Third-Party Notices
32
- ----------------------------------------
33
-
34
- This distribution bundles or links against the following third-party
35
- components. Their respective license terms apply in addition to the MIT
36
- License shown above.
37
-
38
- 1. libarchive
39
- - Purpose: core archive reading and writing functionality for the C++
40
- library and language bindings.
41
- - License: New BSD License (https://www.libarchive.org/)
42
-
43
- 2. pybind11
44
- - Purpose: header-only binding generator for the Python extension module.
45
- - License: BSD-style License (https://github.com/pybind/pybind11)
46
-
47
- The following components are redistributed only because libarchive (bundled with archive_r) depends on them at runtime:
48
-
49
- 3. zlib
50
- - Purpose: libarchive dependency providing DEFLATE compression; bundled inside archive_r binaries and wheels because libarchive requires it.
51
- - License: zlib License (https://zlib.net/zlib_license.html)
52
-
53
- 4. bzip2
54
- - Purpose: libarchive dependency providing bzip2 compression support; distributed with archive_r artifacts.
55
- - License: BSD-style license (https://sourceware.org/bzip2/)
56
-
57
- 5. liblzma (XZ Utils)
58
- - Purpose: libarchive dependency providing LZMA/XZ compression; included with archive_r packages.
59
- - License: Public Domain + GNU LGPLv2.1+ (https://tukaani.org/xz/)
60
-
61
- 6. libxml2
62
- - Purpose: libarchive dependency used for archive formats such as xar; distributed alongside archive_r.
63
- - License: MIT-style License (http://xmlsoft.org/)
64
-
65
- 7. zstd
66
- - Purpose: libarchive dependency providing Zstandard compression; shipped within archive_r binaries.
67
- - License: BSD License (https://github.com/facebook/zstd)
68
-
69
- 8. Nettle
70
- - Purpose: libarchive dependency providing cryptographic support (macOS/Linux); bundled with archive_r binaries.
71
- - License: GNU LGPLv3+ or GNU GPLv2+ (https://www.lysator.liu.se/~nisse/nettle/)
72
-
73
- 9. mini-gmp
74
- - Purpose: Nettle dependency for arithmetic operations (macOS/Linux); bundled with archive_r binaries.
75
- - License: GNU LGPLv3+ or GNU GPLv2+ (https://gmplib.org/)
76
-
77
- 10. OpenSSL 3
78
- - Purpose: libarchive dependency providing cryptographic support (Windows); bundled with archive_r Windows wheels.
79
- - License: Apache License 2.0 with OpenSSL exception (https://www.openssl.org/source/license.html)
80
-
81
- 11. lz4
82
- - Purpose: libarchive dependency providing LZ4 compression; shipped with archive_r artifacts when required.
83
- - License: BSD 2-Clause (https://github.com/lz4/lz4)
84
-
85
- 12. libb2 (BLAKE2)
86
- - Purpose: libarchive dependency providing BLAKE2 hashing; bundled when archive formats require it.
87
- - License: CC0 1.0 Universal (https://github.com/BLAKE2/libb2)
88
-
89
- 13. libattr
90
- - Purpose: libarchive dependency providing extended attribute support on POSIX platforms; included in POSIX builds only.
91
- - License: LGPL-2.1-or-later for the library (https://savannah.nongnu.org/projects/attr)
92
-
93
- 14. libacl
94
- - Purpose: libarchive dependency providing POSIX ACL support; included in POSIX builds only.
95
- - License: LGPL-2.1-or-later for the library (https://savannah.nongnu.org/projects/acl)
96
- Users of archive_r should review the linked third-party licenses to ensure
97
- compliance with their terms when redistributing this software.