builds.dcgi - gophercgis - Collection of gopher CGI/DCGI for geomyidae
 (HTM) hg clone https://bitbucket.org/iamleot/gophercgis
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       builds.dcgi
       ---
            1 #!/bin/sh
            2 
            3 . ../common/config.sh
            4 
            5 
            6 #
            7 # Parse the <table> containing builds status information
            8 #
            9 filter_table()
           10 {
           11 
           12         awk '
           13         /<th class="tag"/ {
           14                 if (match($0, />[^<]+<\/th>/)) {
           15                         tag = substr($0, RSTART + 1, RLENGTH - 6)
           16                 }
           17         }
           18         /<td><a/ {
           19                 if (match($0, />[^<]+<\/a>/)) {
           20                         date = substr($0, RSTART + 1, RLENGTH - 5)
           21                 }
           22         }
           23         /<td class="totals">/ {
           24                 if (match($0, />[^<]+<\/td>/)) {
           25                         totals = substr($0, RSTART + 1, RLENGTH - 6)
           26                 }
           27         }
           28         /<td class="(partial|good)">/ {
           29                 if (match($0, />[^<]+<\/td>/)) {
           30                         passes = substr($0, RSTART + 1, RLENGTH - 6)
           31                 }
           32         }
           33         /<td class="(fails|all-ok)">/ {
           34                 if (match($0, />[^<]+<\/td>/)) {
           35                         fails = substr($0, RSTART + 1, RLENGTH - 6)
           36                 }
           37         }
           38         /<td class="build-time">/ {
           39                 if (match($0, />[^<]+<\/td>/)) {
           40                         build_time = substr($0, RSTART + 1, RLENGTH - 6)
           41                 }
           42         }
           43 
           44         tag && date && totals && passes && fails && build_time {
           45                 printf("t%12s | %s | %2d | %2d | %2d | %s\n",
           46                         tag, date, totals, passes, fails, build_time)
           47                 date = totals = passes = fails = build_time = ""
           48         }
           49         '
           50 
           51 }
           52 
           53 echo ""
           54 echo "NetBSD daily snapshot builds status"
           55 echo ""
           56 
           57 url="http://releng.NetBSD.org/cgi-bin/builds.cgi"
           58 curl -Lgs -- "${url}" |
           59     filter_table