libddprof 0.2.0.beta1
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 +7 -0
- data/.rspec +3 -0
- data/.standard.yml +3 -0
- data/Rakefile +140 -0
- data/gems.rb +12 -0
- data/lib/libddprof/version.rb +9 -0
- data/lib/libddprof.rb +30 -0
- data/libddprof.gemspec +36 -0
- metadata +55 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f7d6f24e3511e2560edb611e06fae670921fcbcda86eeaf4475b6432c17d395a
|
4
|
+
data.tar.gz: 270084987103083b79fb0ad99bd15b64bfa44351460e0b43ce504ea7d7e94890
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 89aa189f92a623a51785c098e4358f97ec8b955e22dc0c008afb6eaf9388cce6559acc9390986252da1fab23058ee47803a15d078b00c68b872dd07bd7253483
|
7
|
+
data.tar.gz: d8309cfec327b55f159c13a76e8ff32b18040720a545e6496270472145db54a089506183d362264a07cdc211d31f53ed3af630896411bb5d95d2df22a7fcc058
|
data/.rspec
ADDED
data/.standard.yml
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,140 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rspec/core/rake_task"
|
5
|
+
require "standard/rake" unless RUBY_VERSION < "2.5"
|
6
|
+
|
7
|
+
require "fileutils"
|
8
|
+
require "http"
|
9
|
+
require "pry"
|
10
|
+
require "rubygems/package"
|
11
|
+
|
12
|
+
RSpec::Core::RakeTask.new(:spec)
|
13
|
+
|
14
|
+
LIB_GITHUB_RELEASES = {
|
15
|
+
"0.2.0" => [
|
16
|
+
{
|
17
|
+
file: "libddprof-x86_64-unknown-linux-gnu.tar.gz",
|
18
|
+
sha256: "cba0f24074d44781d7252b912faff50d330957e84a8f40a172a8138e81001f27",
|
19
|
+
ruby_platform: "x86_64-linux"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
file: "libddprof-x86_64-alpine-linux-musl.tar.gz",
|
23
|
+
sha256: "d519a6241d78260522624b8e79e98502510f11d5d9551f5f80fc1134e95fa146",
|
24
|
+
ruby_platform: "x86_64-linux-musl"
|
25
|
+
}
|
26
|
+
]
|
27
|
+
# Add more versions here
|
28
|
+
}
|
29
|
+
|
30
|
+
task default: [
|
31
|
+
:spec,
|
32
|
+
(:'standard:fix' unless RUBY_VERSION < "2.5")
|
33
|
+
].compact
|
34
|
+
|
35
|
+
desc "Download lib release from github"
|
36
|
+
task :fetch do
|
37
|
+
Helpers.each_github_release_variant do |file:, sha256:, target_directory:, target_file:, **_|
|
38
|
+
target_url = "https://github.com/DataDog/libddprof/releases/download/v#{Libddprof::LIB_VERSION}/#{file}"
|
39
|
+
|
40
|
+
if File.exist?(target_file)
|
41
|
+
if Digest::SHA256.hexdigest(File.read(target_file)) == sha256
|
42
|
+
puts "Found #{target_file} matching the expected sha256, skipping download"
|
43
|
+
next
|
44
|
+
else
|
45
|
+
puts "Found #{target_file} BUT IT DID NOT MATCH THE EXPECTED sha256, skipping download"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
puts "Going to download #{target_url} into #{target_file}"
|
50
|
+
|
51
|
+
File.open(target_file, "wb") do |file|
|
52
|
+
HTTP.follow.get(target_url).body.each { |chunk| file.write(chunk) }
|
53
|
+
end
|
54
|
+
|
55
|
+
if Digest::SHA256.hexdigest(File.read(target_file)) == sha256
|
56
|
+
puts "Success!"
|
57
|
+
else
|
58
|
+
raise "Downloaded file is corrupt, does not match expected sha256"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
desc "Extract lib downloaded releases"
|
64
|
+
task extract: [:fetch] do
|
65
|
+
Helpers.each_github_release_variant do |target_directory:, target_file:, **_|
|
66
|
+
puts "Extracting #{target_file}"
|
67
|
+
File.open(target_file, "rb") do |file|
|
68
|
+
Gem::Package.new("").extract_tar_gz(file, target_directory)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
desc "Package lib downloaded releases as gems"
|
74
|
+
task package: [:extract] do
|
75
|
+
gemspec = eval(File.read("libddprof.gemspec"), nil, "libddprof.gemspec") # standard:disable Security/Eval
|
76
|
+
FileUtils.mkdir_p("pkg")
|
77
|
+
|
78
|
+
Helpers.package_without_binaries(gemspec)
|
79
|
+
Helpers.package_linux_x86_64(gemspec)
|
80
|
+
end
|
81
|
+
|
82
|
+
desc "Release all packaged gems"
|
83
|
+
task package: [
|
84
|
+
:package,
|
85
|
+
:'release:guard_clean',
|
86
|
+
] do
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
module Helpers
|
91
|
+
def self.each_github_release_variant(version: Libddprof::LIB_VERSION)
|
92
|
+
LIB_GITHUB_RELEASES.fetch(version).each do |file:, sha256:, ruby_platform:|
|
93
|
+
# These two are so common that we just centralize them here
|
94
|
+
target_directory = "vendor/libddprof-#{version}/#{ruby_platform}"
|
95
|
+
target_file = "#{target_directory}/#{file}"
|
96
|
+
|
97
|
+
FileUtils.mkdir_p(target_directory)
|
98
|
+
|
99
|
+
yield(file: file, sha256: sha256, ruby_platform: ruby_platform, target_directory: target_directory, target_file: target_file)
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def self.package_without_binaries(gemspec)
|
104
|
+
target_gemspec = gemspec.dup
|
105
|
+
|
106
|
+
puts "Building a variant without binaries including: (this can take a while)"
|
107
|
+
pp target_gemspec.files
|
108
|
+
|
109
|
+
package = Gem::Package.build(target_gemspec)
|
110
|
+
FileUtils.mv(package, "pkg")
|
111
|
+
puts("-" * 80)
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.package_linux_x86_64(gemspec)
|
115
|
+
# We include both glibc and musl variants in the same binary gem to avoid the issues
|
116
|
+
# documented in https://github.com/rubygems/rubygems/issues/3174
|
117
|
+
target_gemspec = gemspec.dup
|
118
|
+
target_gemspec.files += files_for("x86_64-linux", "x86_64-linux-musl")
|
119
|
+
target_gemspec.platform = "x86_64-linux"
|
120
|
+
|
121
|
+
puts "Building for x86_64-linux including:"
|
122
|
+
pp target_gemspec.files
|
123
|
+
|
124
|
+
package = Gem::Package.build(target_gemspec)
|
125
|
+
FileUtils.mv(package, "pkg")
|
126
|
+
puts("-" * 80)
|
127
|
+
end
|
128
|
+
|
129
|
+
def self.files_for(*included_platforms, version: Libddprof::LIB_VERSION)
|
130
|
+
files = []
|
131
|
+
|
132
|
+
each_github_release_variant(version: version) do |ruby_platform:, target_directory:, target_file:, **_|
|
133
|
+
next unless included_platforms.include?(ruby_platform)
|
134
|
+
|
135
|
+
files += Dir.glob("#{target_directory}/**/*").select { |path| File.file?(path) } - [target_file]
|
136
|
+
end
|
137
|
+
|
138
|
+
files
|
139
|
+
end
|
140
|
+
end
|
data/gems.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in libddprof.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "rake", "~> 13.0"
|
9
|
+
gem "rspec", "~> 3.10"
|
10
|
+
gem "standard", "~> 1.3" unless RUBY_VERSION < "2.5"
|
11
|
+
gem "http", "~> 5.0"
|
12
|
+
gem "pry"
|
data/lib/libddprof.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "libddprof/version"
|
4
|
+
|
5
|
+
module Libddprof
|
6
|
+
# Is this a no-op libddprof release without binaries?
|
7
|
+
def self.no_binaries?
|
8
|
+
available_binaries.empty?
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.available_binaries
|
12
|
+
Dir.children(vendor_directory)
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.pkgconfig_folder
|
16
|
+
current_platform = Gem::Platform.local.to_s
|
17
|
+
|
18
|
+
return unless available_binaries.include?(current_platform)
|
19
|
+
|
20
|
+
pkgconfig_file = Dir.glob("#{vendor_directory}/#{current_platform}/**/ddprof_ffi.pc").first
|
21
|
+
|
22
|
+
return unless pkgconfig_file
|
23
|
+
|
24
|
+
File.absolute_path(File.dirname(pkgconfig_file))
|
25
|
+
end
|
26
|
+
|
27
|
+
private_class_method def self.vendor_directory
|
28
|
+
ENV["LIBDDPROF_VENDOR_OVERRIDE"] || "#{__dir__}/../vendor/libddprof-#{Libddprof::LIB_VERSION}/"
|
29
|
+
end
|
30
|
+
end
|
data/libddprof.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path("../lib", __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require "libddprof/version"
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "libddprof"
|
9
|
+
spec.version = Libddprof::VERSION
|
10
|
+
spec.authors = ["Datadog, Inc."]
|
11
|
+
spec.email = ["dev@datadoghq.com"]
|
12
|
+
|
13
|
+
spec.summary = "Library of common code used by Datadog Continuous Profiler for Ruby"
|
14
|
+
spec.description =
|
15
|
+
"libddprof contains implementation bits used by Datadog's ddtrace gem as part of its Continuous Profiler feature."
|
16
|
+
spec.homepage = "https://docs.datadoghq.com/tracing/profiler/"
|
17
|
+
spec.license = "Apache-2.0"
|
18
|
+
spec.required_ruby_version = ">= 2.1.0"
|
19
|
+
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
|
22
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
23
|
+
spec.metadata["source_code_uri"] = "https://github.com/DataDog/libddprof/tree/main/ruby"
|
24
|
+
|
25
|
+
# Require releases on rubygems.org to be coming from multi-factor-auth-authenticated accounts
|
26
|
+
spec.metadata["rubygems_mfa_required"] = "true"
|
27
|
+
|
28
|
+
# Specify which files should be added to the gem when it is released.
|
29
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
30
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
31
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
32
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
|
33
|
+
end
|
34
|
+
end
|
35
|
+
spec.require_paths = ["lib"]
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: libddprof
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0.beta1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Datadog, Inc.
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-02-01 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: libddprof contains implementation bits used by Datadog's ddtrace gem
|
14
|
+
as part of its Continuous Profiler feature.
|
15
|
+
email:
|
16
|
+
- dev@datadoghq.com
|
17
|
+
executables: []
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files: []
|
20
|
+
files:
|
21
|
+
- ".rspec"
|
22
|
+
- ".standard.yml"
|
23
|
+
- Rakefile
|
24
|
+
- gems.rb
|
25
|
+
- lib/libddprof.rb
|
26
|
+
- lib/libddprof/version.rb
|
27
|
+
- libddprof.gemspec
|
28
|
+
homepage: https://docs.datadoghq.com/tracing/profiler/
|
29
|
+
licenses:
|
30
|
+
- Apache-2.0
|
31
|
+
metadata:
|
32
|
+
allowed_push_host: https://rubygems.org
|
33
|
+
homepage_uri: https://docs.datadoghq.com/tracing/profiler/
|
34
|
+
source_code_uri: https://github.com/DataDog/libddprof/tree/main/ruby
|
35
|
+
rubygems_mfa_required: 'true'
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options: []
|
38
|
+
require_paths:
|
39
|
+
- lib
|
40
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ">="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 2.1.0
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.3.1
|
50
|
+
requirements: []
|
51
|
+
rubygems_version: 3.1.6
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: Library of common code used by Datadog Continuous Profiler for Ruby
|
55
|
+
test_files: []
|