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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88c9faecd0176c16d9a8c9be2bf29a5c5c5494dff2a39619f737a1645de5d7f8
4
- data.tar.gz: df09fbf43755203e3304ed59c0638c8026cc63bda4e0eb6d01d8a8902188f1ba
3
+ metadata.gz: 3b41470c179a9d7eeea7abf647de6fa9ae136315e3d340b7aa15df32947eb736
4
+ data.tar.gz: 8ff27c2b4cec2e3b4eae238f7f03f5349f81c19c00a69ca09342fa9517280474
5
5
  SHA512:
6
- metadata.gz: f719504356cab1c4681526e0073a947b6ac9d37f6d83a498d5dbd4304843e2024b66d266580c9114f6865ce7675892ed25a0e7555bfda81b898ec99fb59c9e41
7
- data.tar.gz: bc53389196bc0ecda043f52c279ce5dec501959cb76c4ea82e4d935311ec2ac3675f2441024a173d5fb18c732a915e457f736affd088a459ffdffd300f23601b
6
+ metadata.gz: 9e74e49ebb1930667976828920f843f1470dbab7221da5b32bc8005b95dbf74bff330840f9e668aa02b975a2d272f81de644fb6269014079c5c016b8abad7041
7
+ data.tar.gz: 59fda3db5878eee943b404128c6be3e13e0c95565694cc9e33479e140666474b82d888a2773d03a16020581dcfbb6b93f845181a5a3f378c216567d385f37dc6
@@ -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 legacy cached gems where binaries were
33
- # packaged from gem_dir build artifacts instead of extension_dir.
34
- # ext/<name>/<name>.so → <name>.so (build artifact path)
35
- # lib/<name>/<name>.so → <name>/<name>.so (gem lib path)
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
- Dir.glob(File.join(ext_dir, "**/*.{so,bundle,dll}")).each do |binary|
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))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: prebake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.6
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thejus Paul