share/rbbt_commands/workflow/prov in rbbt-util-5.23.35 vs share/rbbt_commands/workflow/prov in rbbt-util-5.23.36

- old
+ new

@@ -20,10 +20,11 @@ -h--help Help -p--plot* draw the dependency plot into <file.png> -i--inputs* List of inputs to print -if--info_fields* List of info fields to print +-t--touch Update modification times to be consistent EOF SOPT.usage if options[:help] $inputs = (options[:inputs] || "").split(",") @@ -104,10 +105,22 @@ end str << "\n" end +def touch(step) + return unless File.exists?(step.path) + step.dependencies.each do |dep| + next unless Open.exists?(dep.path) + touch(dep) + if Open.mtime(step.path) < Open.mtime(dep.path) + Log.debug("Updating #{step.path} to #{dep.path}") + CMD.cmd("touch -r '#{dep.path}' '#{step.path}'") + end + end if step.dependencies +end + def report(step, offset = 0, task = nil) info = step.info || {} info[:task_name] = task path = step.path status = info[:status] || :missing @@ -160,9 +173,13 @@ node_info.merge!(_node_info) end end [id, edges, node_info] +end + +if options[:touch] + touch(step) end if options[:plot] id, edges, node_info = adjacency(step) node_info[id][:color] = 'red'