From ffd30205a5b8949a1a6f40230c0f71eff46261e8 Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Thu, 12 Dec 2024 21:57:21 +1300 Subject: [PATCH 1/2] [scripts][dependency] Add case for when we update via repository.lic --- dependency.lic | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dependency.lic b/dependency.lic index 5296f6ace..da2130620 100644 --- a/dependency.lic +++ b/dependency.lic @@ -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 @@ -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'])) } From 69198cd1114d7b819ab45a4c0fbb05fe7bcdbc6f Mon Sep 17 00:00:00 2001 From: Mahtra <93822896+MahtraDR@users.noreply.github.com> Date: Thu, 12 Dec 2024 21:59:27 +1300 Subject: [PATCH 2/2] removing un-used --- dependency.lic | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/dependency.lic b/dependency.lic index da2130620..b96c4cdf8 100644 --- a/dependency.lic +++ b/dependency.lic @@ -495,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