Files
RedBear-OS/recipes/libs/nghttp2/source/third-party/mruby/lib/mruby/lockfile.rb
T
vasilito ff4ff35918 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

82 lines
1.5 KiB
Ruby

autoload :YAML, 'yaml'
module MRuby
autoload :Source, 'mruby/source'
class Lockfile
class << self
def enable
@enabled = true
end
def disable
@enabled = false
end
def enabled?
@enabled
end
def build(target_name)
instance.build(target_name)
end
def write
instance.write if enabled?
end
def instance
@instance ||= new("#{MRUBY_CONFIG}.lock")
end
end
def initialize(filename)
@filename = filename
end
def build(target_name)
read[target_name] ||= {}
end
def write
locks = {"mruby" => mruby}
locks["builds"] = @builds if @builds
File.write(@filename, YAML.dump(locks))
end
private
def read
@builds ||= if File.exist?(@filename)
YAML.load_file(@filename)["builds"] || {}
else
{}
end
end
def shellquote(s)
if ENV['OS'] == 'Windows_NT'
"\"#{s}\""
else
"'#{s}'"
end
end
def mruby
mruby = {
'version' => MRuby::Source::MRUBY_VERSION,
'release_no' => MRuby::Source::MRUBY_RELEASE_NO,
}
git_dir = "#{MRUBY_ROOT}/.git"
if File.directory?(git_dir)
mruby['git_commit'] = `git --git-dir #{shellquote(git_dir)} --work-tree #{shellquote(MRUBY_ROOT)} rev-parse --verify HEAD`.strip
end
mruby
end
enable
end
end