summaryrefslogtreecommitdiff
path: root/lib/license/finder/ext/conan.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/license/finder/ext/conan.rb')
-rw-r--r--lib/license/finder/ext/conan.rb27
1 files changed, 23 insertions, 4 deletions
diff --git a/lib/license/finder/ext/conan.rb b/lib/license/finder/ext/conan.rb
index 1369e6a..ca2ee03 100644
--- a/lib/license/finder/ext/conan.rb
+++ b/lib/license/finder/ext/conan.rb
@@ -7,11 +7,10 @@ module LicenseFinder
end
def current_packages
- Dir.chdir(project_path) do
- shell.execute([:conan, :install, '.'])
- end
stdout, _stderr, status = Dir.chdir(project_path) do
- shell.execute([:conan, :info, '-j', '/dev/stdout', '.'])
+ shell.execute([:conan, :install, '--build=missing', '.'], env: default_env)
+ shell.execute([:conan, :inspect, '.'], env: default_env)
+ shell.execute([:conan, :info, '-j', '/dev/stdout', '.'], env: default_env)
end
return [] unless status.success?
@@ -38,5 +37,25 @@ module LicenseFinder
def parse(line)
JSON.parse(line)
end
+
+ def default_env
+ @default_env ||= {
+ 'CONAN_CACERT_PATH' => ENV.fetch('CONAN_CACERT_PATH', '/etc/ssl/certs/ca-certificates.crt'),
+ 'CONAN_LOGGING_LEVEL' => ENV['LOG_LEVEL'],
+ 'CONAN_LOGIN_USERNAME' => ENV.fetch('CONAN_LOGIN_USERNAME', 'ci_user'),
+ 'CONAN_LOG_RUN_TO_OUTPUT' => '1',
+ 'CONAN_NON_INTERACTIVE' => '1',
+ 'CONAN_PASSWORD' => ENV.fetch('CONAN_PASSWORD', ENV['CI_JOB_TOKEN']),
+ 'CONAN_PRINT_RUN_COMMANDS' => '1',
+ 'CONAN_REQUEST_TIMEOUT' => '5',
+ 'CONAN_RETRY' => '1',
+ 'CONAN_RETRY_WAIT' => jitter,
+ 'CONAN_USER_HOME' => Dir.pwd
+ }
+ end
+
+ def jitter
+ rand(5).to_s
+ end
end
end