prebake 0.2.6 → 0.2.7
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/prebake/extractor.rb +8 -5
- data/lib/prebake/platform_gem_builder.rb +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3b41470c179a9d7eeea7abf647de6fa9ae136315e3d340b7aa15df32947eb736
|
|
4
|
+
data.tar.gz: 8ff27c2b4cec2e3b4eae238f7f03f5349f81c19c00a69ca09342fa9517280474
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9e74e49ebb1930667976828920f843f1470dbab7221da5b32bc8005b95dbf74bff330840f9e668aa02b975a2d272f81de644fb6269014079c5c016b8abad7041
|
|
7
|
+
data.tar.gz: 59fda3db5878eee943b404128c6be3e13e0c95565694cc9e33479e140666474b82d888a2773d03a16020581dcfbb6b93f845181a5a3f378c216567d385f37dc6
|
data/lib/prebake/extractor.rb
CHANGED
|
@@ -19,8 +19,9 @@ module Prebake
|
|
|
19
19
|
|
|
20
20
|
# Copy only binary files (.so, .bundle, .dll) to extension_dir
|
|
21
21
|
Dir.glob(File.join(tmpdir, "**/*.{so,bundle,dll}")).each do |binary|
|
|
22
|
-
# Reject symlinks
|
|
22
|
+
# Reject symlinks and empty files
|
|
23
23
|
next if File.symlink?(binary)
|
|
24
|
+
next if File.size(binary).zero?
|
|
24
25
|
|
|
25
26
|
# Verify path is within tmpdir (prevent traversal)
|
|
26
27
|
real_binary = File.realpath(binary)
|
|
@@ -29,12 +30,14 @@ module Prebake
|
|
|
29
30
|
|
|
30
31
|
relative = binary.sub("#{tmpdir}/", "")
|
|
31
32
|
|
|
32
|
-
# Normalize paths from
|
|
33
|
-
#
|
|
34
|
-
# ext/<name>/<name>.so
|
|
35
|
-
# lib/<name>/<name>.so
|
|
33
|
+
# Normalize paths from cached gems where binaries were packaged
|
|
34
|
+
# from gem_dir build artifacts or dirty extension_dirs.
|
|
35
|
+
# ext/<name>/<name>.so → <name>.so (build artifact)
|
|
36
|
+
# lib/<name>/<name>.so → <name>/<name>.so (gem lib path)
|
|
37
|
+
# extension/<platform>/<ver>/<name>.so → <name>.so (extension_dir artifact)
|
|
36
38
|
relative = relative.sub(%r{\Aext/[^/]+/}, "") if relative.start_with?("ext/")
|
|
37
39
|
relative = relative.sub(%r{\Alib/}, "") if relative.start_with?("lib/")
|
|
40
|
+
relative = relative.sub(%r{\Aextensions?/[^/]+/[^/]+/}, "") if relative.start_with?("extension/", "extensions/")
|
|
38
41
|
|
|
39
42
|
dest = File.join(spec.extension_dir, relative)
|
|
40
43
|
FileUtils.mkdir_p(File.dirname(dest))
|
|
@@ -55,8 +55,14 @@ module Prebake
|
|
|
55
55
|
|
|
56
56
|
ext_dir = @spec.extension_dir
|
|
57
57
|
if ext_dir && File.directory?(ext_dir)
|
|
58
|
-
|
|
58
|
+
# Collect binaries at root and one level deep (e.g., nokogiri/nokogiri.so).
|
|
59
|
+
# Skip deeper paths which are platform artifacts from dirty extension_dirs
|
|
60
|
+
# (e.g., extension/x86_64-linux/4.0.0/gem.so left by prior extractions).
|
|
61
|
+
binaries = Dir.glob(File.join(ext_dir, "*.{so,bundle,dll}")) +
|
|
62
|
+
Dir.glob(File.join(ext_dir, "*/*.{so,bundle,dll}"))
|
|
63
|
+
binaries.each do |binary|
|
|
59
64
|
next if File.symlink?(binary)
|
|
65
|
+
next if File.size(binary).zero?
|
|
60
66
|
relative = binary.delete_prefix("#{ext_dir}/")
|
|
61
67
|
dest = File.join(build_dir, relative)
|
|
62
68
|
FileUtils.mkdir_p(File.dirname(dest))
|