Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[scripts][dependency] Add case for when we update via repository.lic #7021

Merged
merged 2 commits into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions dependency.lic
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require 'ostruct'
require 'digest/sha1'
require 'monitor'

$DEPENDENCY_VERSION = '2.0.4'
$DEPENDENCY_VERSION = '2.0.5'
$MIN_RUBY_VERSION = '3.2.2'
DRINFOMON_IN_CORE_LICH ||= false
DRINFOMON_CORE_LICH_DEFINES ||= Array.new
Expand Down Expand Up @@ -387,6 +387,13 @@ class ScriptManager
return unless info
return if get_versions[filename] == info['sha'] && !force

if filename == 'dependency.lic' && File.exist?(File.join(SCRIPT_DIR, filename))
body = File.open(File.join(SCRIPT_DIR, filename), 'r').readlines.join('')
@versions[filename] = Digest::SHA1.hexdigest('blob' + " #{body.size}" + "\0" + body)

return if info['sha'] == @versions[filename]
end

echo("info:#{info}") if @debug
blob = make_request(info['url'])
File.open(File.join(SCRIPT_DIR, "#{filename}"), 'w') { |file| file.print(Base64.decode64(blob['content'])) }
Expand Down Expand Up @@ -488,19 +495,6 @@ class ScriptManager
start_script(filename)
end

def file_outdated?(filename)
echo("file_outdated?:#{filename}") if @debug
local_version = get_versions[filename]
echo("local:#{local_version}") if @debug
info = get_file_status(filename)
unless info
echo("file not found in repository: #{filename}")
return false
end
echo("remote:#{info['sha']}") if @debug
info['sha'] != local_version
end

def get_file_status(filename)
get_status['tree'].find { |element| element['path'] == filename }
end
Expand Down
Loading