update: fix indent leading whitespace; implement update_hosts_meta, but not used - commit workflow becomes a little weird
authorTero Marttila <terom@paivola.fi>
Mon, 19 Mar 2012 12:13:04 +0200
changeset 26 d2fdfe98b7b9
parent 25 3d35d0eef197
child 27 773c91a7547a
update: fix indent leading whitespace; implement update_hosts_meta, but not used - commit workflow becomes a little weird
bin/update
--- a/bin/update	Mon Mar 19 11:40:06 2012 +0200
+++ b/bin/update	Mon Mar 19 12:13:04 2012 +0200
@@ -190,11 +190,7 @@
 
     log_cmd "$@"
 
-    "$@" | (
-        while read line; do
-            echo "$indent$line"
-        done
-    ) || return $?
+    "$@" | sed "s/^/$indent/"
 }
 
 function abspath () {
@@ -384,6 +380,23 @@
     fi
 }
 
+# feed `hg annotate -qd`'d version of input to process-zone --input-line-date
+# only applies commit'd data
+function update_hosts_meta {
+    local dst=$1; shift
+    local src=$1; shift
+
+    if check_update $dst $src; then
+        log_info "Generating $dst..."
+        
+        # via stdin
+        $HG -R $DATA annotate -qd $src | \
+            do_update $dst $PROCESS_ZONE $PROCESS_ARGS --input-line-date --meta-zone "$@"
+    else
+        log_info "Generating $dst: not changed"
+    fi
+}
+
 function check_hosts {
     local hosts=$1; shift 1
 
@@ -478,8 +491,8 @@
         check_hosts     $DATA/paivola.txt --check-exempt ufc
 
     log "Generating host zones..."
+        update_hosts    $ZONES/internal/paivola.zone.hosts  $DATA/paivola.txt --forward-zone --forward-txt --forward-mx $FORWARD_MX
         update_hosts    $ZONES/external/paivola.zone.hosts  $DATA/paivola.txt --forward-zone
-        update_hosts    $ZONES/internal/paivola.zone.hosts  $DATA/paivola.txt --forward-zone --forward-txt --forward-mx $FORWARD_MX
         update_hosts    $ZONES/paivola-reverse.zone.hosts   $DATA/paivola.txt --reverse-zone $REVERSE_ZONE --reverse-domain $REVERSE_DOMAIN
 
     log "Copying zone parts..."