Welcome to mirror list, hosted at ThFree Co, Russian Federation.

json_top.awk « awk « poudriere « share « src - github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a70ef8565f3535f1c9581a8ed3c93e992e59e7b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function get_value(key) {
  match($0, "\"" key "\":\"[^\"]*\"")
  key_group = substr($0, RSTART, RLENGTH)
  match(key_group, /:"[^"]*"/)
  value = substr(key_group, RSTART+2, RLENGTH-3)
  return value
}
function print_value(key, end) {
  printf "\"" key "\":\"" get_value(key) "\"" end
}
{
  split(FILENAME, paths, "/")
  jail=paths[1]
  printf "\"" jail "\":{"
  printf "\"latest\":" $0 ","
  print_value("mastername", ",")
  print_value("jailname", ",")
  print_value("ptname", ",")
  print_value("setname", ",")
  print_value("started", ",")
  print_value("ended", ",")
  print_value("status")
  print "}"
}