prebake 0.3.4 → 0.3.6
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/async_publisher.rb +3 -1
- data/lib/prebake/elf_inspector.rb +4 -4
- data/lib/prebake/ext_builder_patch.rb +5 -9
- data/lib/prebake/{extension_validator.rb → extension_layout.rb} +5 -5
- data/lib/prebake/extractor.rb +1 -1
- data/lib/prebake/glibc.rb +2 -2
- data/lib/prebake/hooks.rb +3 -3
- data/lib/prebake/platform.rb +3 -3
- data/lib/prebake/platform_gem_builder.rb +7 -1
- data/lib/prebake/static_ruby.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 161b7e1eed05964edde295c9cc1aaa60a7ed90f82c44c14fdd37c9e5cc494a0b
|
|
4
|
+
data.tar.gz: be30dacaea00707f20fe812ef14239df3040a9770a333c70bf469cb01f66a11d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7572d756db73f2518fa95e885bd89456f55b71c27dab1fa52c51ed0459617b2dd19950e64a286147759fd613ce30f9560a28d1ade8500d2ef9badf105a75c6e6
|
|
7
|
+
data.tar.gz: 10f5df9f52a3f23af1c875eaabd2de0dcb3ea24e14fee4cc60f6e223b244596e4c728444f3d6318d8279041d132cf51ecb2af3eca95587aaaa240eb1fb538e14
|
|
@@ -20,7 +20,7 @@ module Prebake
|
|
|
20
20
|
@mutex.synchronize { @pending_specs << [spec, backend] }
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
-
def self.
|
|
23
|
+
def self.publish_pending(timeout: 120)
|
|
24
24
|
specs = @mutex.synchronize { @pending_specs.dup }
|
|
25
25
|
return if specs.empty?
|
|
26
26
|
|
|
@@ -54,6 +54,8 @@ module Prebake
|
|
|
54
54
|
end
|
|
55
55
|
|
|
56
56
|
def self.build_gem(spec, backend)
|
|
57
|
+
return nil unless spec.build_args.empty? # consumers expect a cache entry to be a default build
|
|
58
|
+
|
|
57
59
|
platform = Platform.generalized
|
|
58
60
|
cache_key = CacheKey.for(spec.name, spec.version.to_s, platform)
|
|
59
61
|
|
|
@@ -51,19 +51,19 @@ module Prebake
|
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
def self.needed_libraries(path)
|
|
54
|
-
|
|
54
|
+
output, status = Open3.capture2e("objdump", "-p", path)
|
|
55
55
|
return [] unless status.success?
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
output.scan(/NEEDED\s+(\S+)/).flatten
|
|
58
58
|
rescue Errno::ENOENT
|
|
59
59
|
[]
|
|
60
60
|
end
|
|
61
61
|
|
|
62
62
|
def self.run_objdump(path)
|
|
63
|
-
|
|
63
|
+
output, status = Open3.capture2e("objdump", "-T", path)
|
|
64
64
|
return nil unless status.success?
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
output
|
|
67
67
|
rescue Errno::ENOENT
|
|
68
68
|
nil
|
|
69
69
|
end
|
|
@@ -27,7 +27,7 @@ module Prebake
|
|
|
27
27
|
|
|
28
28
|
if Prebake.optional_native_extension?(@spec.name) && !Prebake.libruby_available?
|
|
29
29
|
Logger.warn "#{@spec.name}: native extension skipped (optional gem, libruby.so absent on static Ruby build)"
|
|
30
|
-
|
|
30
|
+
mark_build_complete
|
|
31
31
|
return
|
|
32
32
|
end
|
|
33
33
|
|
|
@@ -53,7 +53,7 @@ module Prebake
|
|
|
53
53
|
return super
|
|
54
54
|
end
|
|
55
55
|
|
|
56
|
-
if
|
|
56
|
+
if checksum_matches?(cache_key, expected_checksum, cached_gem)
|
|
57
57
|
unless PortabilityGuard.portable_for_host?(cached_gem, spec_name: @spec.name)
|
|
58
58
|
# Binary is valid for other hosts; don't delete from backend.
|
|
59
59
|
return super
|
|
@@ -85,11 +85,11 @@ module Prebake
|
|
|
85
85
|
Logger.warn "No checksum available for #{cache_key}, removing cached gem"
|
|
86
86
|
Prebake.backend.delete(cache_key)
|
|
87
87
|
# GET triggers the worker to dispatch a rebuild via GH Actions on cache miss
|
|
88
|
-
|
|
89
|
-
FileUtils.rm_f(
|
|
88
|
+
leftover = Prebake.backend.fetch(cache_key)
|
|
89
|
+
FileUtils.rm_f(leftover) if leftover
|
|
90
90
|
end
|
|
91
91
|
|
|
92
|
-
def
|
|
92
|
+
def checksum_matches?(cache_key, expected, gem_path)
|
|
93
93
|
return true if expected.nil?
|
|
94
94
|
|
|
95
95
|
actual = Digest::SHA256.file(gem_path).hexdigest
|
|
@@ -101,10 +101,6 @@ module Prebake
|
|
|
101
101
|
end
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
def install_without_native_extension
|
|
105
|
-
mark_build_complete
|
|
106
|
-
end
|
|
107
|
-
|
|
108
104
|
def install_from_cache(gem_path)
|
|
109
105
|
count = Extractor.install(gem_path, @spec)
|
|
110
106
|
|
|
@@ -4,14 +4,14 @@ require "fileutils"
|
|
|
4
4
|
require_relative "logger"
|
|
5
5
|
|
|
6
6
|
module Prebake
|
|
7
|
-
module
|
|
7
|
+
module ExtensionLayout
|
|
8
8
|
BINARY_GLOB = "*.{so,bundle,dll}"
|
|
9
9
|
|
|
10
|
-
def self.
|
|
11
|
-
Bundler.definition.specs.each { |spec|
|
|
10
|
+
def self.repair_all
|
|
11
|
+
Bundler.definition.specs.each { |spec| repair(spec) }
|
|
12
12
|
end
|
|
13
13
|
|
|
14
|
-
def self.
|
|
14
|
+
def self.repair(spec)
|
|
15
15
|
ext_dir = spec.extension_dir
|
|
16
16
|
return unless File.exist?(File.join(ext_dir, ".prebake"))
|
|
17
17
|
|
|
@@ -30,7 +30,7 @@ module Prebake
|
|
|
30
30
|
next if File.exist?(dest)
|
|
31
31
|
|
|
32
32
|
FileUtils.cp(binary, dest)
|
|
33
|
-
Logger.info "
|
|
33
|
+
Logger.info "Restored #{File.basename(binary)} to #{ext_dir}"
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
36
|
end
|
data/lib/prebake/extractor.rb
CHANGED
|
@@ -27,7 +27,7 @@ module Prebake
|
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
# Mark this extension_dir as prebake-managed for post-install
|
|
30
|
+
# Mark this extension_dir as prebake-managed for post-install layout repair
|
|
31
31
|
FileUtils.touch(File.join(spec.extension_dir, ".prebake")) if extracted_count.positive?
|
|
32
32
|
|
|
33
33
|
Logger.info "Installed precompiled #{File.basename(gem_path)} " \
|
data/lib/prebake/glibc.rb
CHANGED
|
@@ -37,10 +37,10 @@ module Prebake
|
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def self.run_ldd
|
|
40
|
-
|
|
40
|
+
output, status = Open3.capture2e("ldd", "--version")
|
|
41
41
|
return nil unless status.success?
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
output
|
|
44
44
|
rescue Errno::ENOENT
|
|
45
45
|
nil
|
|
46
46
|
end
|
data/lib/prebake/hooks.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative "async_publisher"
|
|
4
|
-
require_relative "
|
|
4
|
+
require_relative "extension_layout"
|
|
5
5
|
require_relative "logger"
|
|
6
6
|
|
|
7
7
|
module Prebake
|
|
@@ -22,11 +22,11 @@ module Prebake
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
Bundler::Plugin::API.hook("after-install-all") do |_deps|
|
|
25
|
-
|
|
25
|
+
ExtensionLayout.repair_all
|
|
26
26
|
|
|
27
27
|
next unless Prebake.push_enabled?
|
|
28
28
|
|
|
29
|
-
AsyncPublisher.
|
|
29
|
+
AsyncPublisher.publish_pending
|
|
30
30
|
end
|
|
31
31
|
|
|
32
32
|
Logger.debug "Hooks registered"
|
data/lib/prebake/platform.rb
CHANGED
|
@@ -9,12 +9,12 @@ module Prebake
|
|
|
9
9
|
[/\Aaarch64-linux(-gnu)?\z/, "aarch64-linux"]
|
|
10
10
|
].freeze
|
|
11
11
|
|
|
12
|
-
def self.normalize(
|
|
12
|
+
def self.normalize(platform)
|
|
13
13
|
NORMALIZATIONS.each do |pattern, normalized|
|
|
14
|
-
return normalized if
|
|
14
|
+
return normalized if platform.match?(pattern)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
platform
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
def self.generalized
|
|
@@ -44,7 +44,7 @@ module Prebake
|
|
|
44
44
|
private
|
|
45
45
|
|
|
46
46
|
def build_platform_spec(build_dir)
|
|
47
|
-
platform_spec =
|
|
47
|
+
platform_spec = gemspec.dup
|
|
48
48
|
platform_spec.platform = Gem::Platform.new(Platform.generalized)
|
|
49
49
|
platform_spec.extensions = []
|
|
50
50
|
|
|
@@ -64,6 +64,12 @@ module Prebake
|
|
|
64
64
|
platform_spec
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
+
# Bundler's spec for a compact-index gem has no summary, authors or files,
|
|
68
|
+
# so read the full gemspec from the downloaded .gem. Path and git gems have none.
|
|
69
|
+
def gemspec
|
|
70
|
+
File.exist?(@spec.cache_file) ? Gem::Package.new(@spec.cache_file).spec : @spec
|
|
71
|
+
end
|
|
72
|
+
|
|
67
73
|
def copy_installed_binaries(ext_dir, build_dir)
|
|
68
74
|
installed_binaries(ext_dir).each do |binary|
|
|
69
75
|
next if File.symlink?(binary)
|
data/lib/prebake/static_ruby.rb
CHANGED
|
@@ -10,14 +10,14 @@ module Prebake
|
|
|
10
10
|
# instead of installing a broken .so. Extend via PREBAKE_OPTIONAL_NATIVE_EXTENSIONS=gem1,gem2.
|
|
11
11
|
# Intentionally empty: bootsnap 1.18+ requires its native extension unconditionally;
|
|
12
12
|
# skipping the build produces a broken install.
|
|
13
|
-
|
|
13
|
+
DEFAULT_OPTIONAL_NATIVE_EXTENSIONS = %w[].freeze
|
|
14
14
|
|
|
15
15
|
class << self
|
|
16
16
|
def optional_native_extensions
|
|
17
17
|
@optional_native_extensions ||= begin
|
|
18
18
|
extra = ENV.fetch("PREBAKE_OPTIONAL_NATIVE_EXTENSIONS", "")
|
|
19
19
|
.split(",").map(&:strip).reject(&:empty?)
|
|
20
|
-
(
|
|
20
|
+
(DEFAULT_OPTIONAL_NATIVE_EXTENSIONS + extra).uniq
|
|
21
21
|
end
|
|
22
22
|
end
|
|
23
23
|
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: prebake
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thejus Paul
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Prebake speeds up bundle install by skipping native gem compilation.
|
|
14
14
|
It fetches precompiled binaries for gems like puma, nokogiri, pg, grpc, and bootsnap
|
|
@@ -33,7 +33,7 @@ files:
|
|
|
33
33
|
- lib/prebake/cache_key.rb
|
|
34
34
|
- lib/prebake/elf_inspector.rb
|
|
35
35
|
- lib/prebake/ext_builder_patch.rb
|
|
36
|
-
- lib/prebake/
|
|
36
|
+
- lib/prebake/extension_layout.rb
|
|
37
37
|
- lib/prebake/extractor.rb
|
|
38
38
|
- lib/prebake/glibc.rb
|
|
39
39
|
- lib/prebake/hooks.rb
|