serverlessgems 0.4.1 → 0.4.2
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/CHANGELOG.md +3 -0
- data/lib/jets/gems/check.rb +6 -6
- data/lib/jets/gems/extract/gem.rb +58 -0
- data/lib/jets/gems/version.rb +1 -1
- metadata +3 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4180b95b85ce932e83e67ba621485a458e1d7cff1d673af091eee2c80fc957e5
|
4
|
+
data.tar.gz: 9b84b2f954ea096fc9a2c9b8243cd771847926c8b0b26023baa802f85d771030
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acb02e4538a245354e35904f9b4ebd308bd768d9a87273c3b8ac2bf7bf217ce8575492ef4d5d8be8a1d8fb53a9bced3ea8a17afd10446eee95596d2df4714c5b
|
7
|
+
data.tar.gz: df2bdc6db711f9d8599233e49fb8183006f6b14a41c28b93bfb4e48eea9f313e1af148d650238c8c4c2d778d68a6554069b2d931f6552a8b03f3eeb6ef3c491e
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,9 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
|
5
5
|
|
6
|
+
## [0.4.2] - 2025-10-10
|
7
|
+
- fix gem detection ffi - gnu suffix and clean up incompatible platform variants
|
8
|
+
|
6
9
|
## [0.4.1] - 2024-06-22
|
7
10
|
- standardrb and updates
|
8
11
|
|
data/lib/jets/gems/check.rb
CHANGED
@@ -56,9 +56,9 @@ module Jets::Gems
|
|
56
56
|
* Unavailable: <%= missing_gem['gem_name'] -%> Available versions: <%= available.join(' ') %>
|
57
57
|
<% end %>
|
58
58
|
Your current serverlessgems source: #{gems_source}
|
59
|
-
|
59
|
+
|
60
60
|
Jets is unable to build a deployment package that will work on AWS Lambda without the required pre-compiled gems. To remedy this, you can:
|
61
|
-
|
61
|
+
|
62
62
|
* Use another gem that does not require compilation.
|
63
63
|
* Create your own custom layer with the gem: http://rubyonjets.com/docs/extras/custom-lambda-layers/
|
64
64
|
<% if agree.yes? -%>
|
@@ -72,10 +72,10 @@ module Jets::Gems
|
|
72
72
|
* You can try redeploying again after a few minutes.
|
73
73
|
* Non-reported gems may take days or even longer to be built.
|
74
74
|
<% end -%>
|
75
|
-
|
75
|
+
|
76
76
|
Compiled gems usually take some time to figure out how to build as they each depend on different libraries and packages.
|
77
77
|
More info: http://rubyonjets.com/docs/serverlessgems/
|
78
|
-
|
78
|
+
|
79
79
|
EOL
|
80
80
|
erb = ERB.new(template, trim_mode: "-") # trim mode https://stackoverflow.com/questions/4632879/erb-template-removing-the-trailing-line
|
81
81
|
erb.result(binding)
|
@@ -156,9 +156,9 @@ module Jets::Gems
|
|
156
156
|
# On new 2021 macbook with m1 chip: the gems are being saved in a folder like so:
|
157
157
|
# nokogiri-1.12.5-arm64-darwin
|
158
158
|
# The GEM_REGEXP accounts for this case.
|
159
|
-
GEM_REGEXP = /-(arm|x)\d+.*-(darwin|linux)
|
159
|
+
GEM_REGEXP = /-(arm|x|aarch)\d+.*-(darwin|linux)(?:-gnu)?/
|
160
160
|
def other_compiled_gems
|
161
|
-
paths = Dir.glob("#{Jets.build_root}/stage/opt/ruby/gems/#{Jets::Gems.ruby_folder}/gems/*{-darwin,-linux}")
|
161
|
+
paths = Dir.glob("#{Jets.build_root}/stage/opt/ruby/gems/#{Jets::Gems.ruby_folder}/gems/*{-darwin,-linux}*")
|
162
162
|
paths.map { |p| File.basename(p).sub(GEM_REGEXP, "") }
|
163
163
|
end
|
164
164
|
|
@@ -19,6 +19,64 @@ module Jets::Gems::Extract
|
|
19
19
|
say "Unpacking into #{dest}"
|
20
20
|
FileUtils.mkdir_p(dest)
|
21
21
|
unzip(zipfile_path, dest)
|
22
|
+
cleanup_incompatible_platform_variants
|
23
|
+
end
|
24
|
+
|
25
|
+
# Removes incompatible platform variants to prevent RubyGems from choosing the wrong one
|
26
|
+
# For AWS Lambda, we want to keep only x86_64-linux variants and remove others
|
27
|
+
def cleanup_incompatible_platform_variants
|
28
|
+
gems_dir = "#{Jets.build_root}/stage/opt/ruby/gems/#{Jets::Gems.ruby_folder}/gems"
|
29
|
+
specs_dir = "#{Jets.build_root}/stage/opt/ruby/gems/#{Jets::Gems.ruby_folder}/specifications"
|
30
|
+
return unless Dir.exist?(gems_dir)
|
31
|
+
|
32
|
+
# Find all gem directories for this gem name
|
33
|
+
gem_dirs = Dir.glob("#{gems_dir}/#{gem_name}-*").select do |path|
|
34
|
+
File.directory?(path) && File.basename(path).start_with?(gem_name)
|
35
|
+
end
|
36
|
+
|
37
|
+
# Group by base gem name (without platform suffix)
|
38
|
+
gem_groups = {}
|
39
|
+
gem_dirs.each do |dir|
|
40
|
+
name = File.basename(dir)
|
41
|
+
# Handle platform-specific gem names like nokogiri-1.18.10-x86_64-linux-gnu
|
42
|
+
base_name = name.sub(/-(x86_64-linux-gnu|aarch64-linux-gnu|arm64-linux-gnu|i386-linux-gnu|powerpc-linux-gnu|sparc-linux-gnu|mips-linux-gnu|riscv-linux-gnu|loongarch-linux-gnu|sw_64-linux-gnu|hppa-linux-gnu|ia64-linux-gnu|s390-linux-gnu|x86_64|arm64|aarch64|i386|powerpc|sparc|mips|riscv|loongarch|sw_64|hppa|ia64|s390).*/, "")
|
43
|
+
gem_groups[base_name] ||= []
|
44
|
+
gem_groups[base_name] << {dir: dir, name: name}
|
45
|
+
end
|
46
|
+
|
47
|
+
# For each gem group, keep only x86_64-linux variants
|
48
|
+
gem_groups.each do |base_name, variants|
|
49
|
+
next if variants.size <= 1 # No cleanup needed if only one variant
|
50
|
+
|
51
|
+
say "Found #{variants.size} platform variants for #{base_name}:"
|
52
|
+
variants.each { |v| say " - #{v[:name]}" }
|
53
|
+
|
54
|
+
# Find x86_64-linux variants (preferred for AWS Lambda)
|
55
|
+
x86_64_variants = variants.select { |v| v[:name].include?("-x86_64-linux-gnu") || v[:name].include?("-x86_64-linux") }
|
56
|
+
|
57
|
+
if x86_64_variants.any?
|
58
|
+
# Keep x86_64-linux variants, remove others
|
59
|
+
keep_variants = x86_64_variants
|
60
|
+
remove_variants = variants - x86_64_variants
|
61
|
+
else
|
62
|
+
# If no x86_64-linux variants, keep the first one alphabetically
|
63
|
+
keep_variants = [variants.min_by { |v| v[:name] }]
|
64
|
+
remove_variants = variants - keep_variants
|
65
|
+
end
|
66
|
+
|
67
|
+
say "Keeping: #{keep_variants.map { |v| v[:name] }.join(", ")}"
|
68
|
+
say "Removing: #{remove_variants.map { |v| v[:name] }.join(", ")}"
|
69
|
+
|
70
|
+
# Remove incompatible variants
|
71
|
+
remove_variants.each do |variant|
|
72
|
+
say "Removing incompatible variant: #{variant[:name]}"
|
73
|
+
FileUtils.rm_rf(variant[:dir])
|
74
|
+
|
75
|
+
# Also remove the corresponding gemspec
|
76
|
+
gemspec_path = "#{specs_dir}/#{variant[:name]}.gemspec"
|
77
|
+
FileUtils.rm_f(gemspec_path) if File.exist?(gemspec_path)
|
78
|
+
end
|
79
|
+
end
|
22
80
|
end
|
23
81
|
|
24
82
|
# ensure that we always have the full gem name
|
data/lib/jets/gems/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: serverlessgems
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: gems
|
@@ -94,7 +93,6 @@ dependencies:
|
|
94
93
|
- - ">="
|
95
94
|
- !ruby/object:Gem::Version
|
96
95
|
version: '0'
|
97
|
-
description:
|
98
96
|
email:
|
99
97
|
- tongueroo@gmail.com
|
100
98
|
executables: []
|
@@ -131,7 +129,6 @@ homepage: https://github.com/boltops-tools/serverlessgems
|
|
131
129
|
licenses:
|
132
130
|
- MIT
|
133
131
|
metadata: {}
|
134
|
-
post_install_message:
|
135
132
|
rdoc_options: []
|
136
133
|
require_paths:
|
137
134
|
- lib
|
@@ -146,8 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
143
|
- !ruby/object:Gem::Version
|
147
144
|
version: '0'
|
148
145
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
150
|
-
signing_key:
|
146
|
+
rubygems_version: 3.6.7
|
151
147
|
specification_version: 4
|
152
148
|
summary: Client Library works with Serverless Gems API for Jets Ruby Serverless Framework
|
153
149
|
test_files: []
|