trans-coord-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Error handling


From: Yavor Doganov
Subject: Re: Error handling
Date: Wed, 20 Feb 2008 18:28:31 +0200

On ср, 2008-02-20 at 18:04 +0200, Yavor Doganov wrote:
> I'll amend the commands accordingly.

Here's the updated patch.
--- GNUmakefile 20 фев 2008 11:11:07 +0200      1.1
+++ GNUmakefile 20 фев 2008 18:20:42 +0200      
@@ -48,8 +48,19 @@
 VALIDATESKIP := echo "SKIP:"
 endif
 
+# Do not send warning mails by default unless NOTIFY=yes.
+ifneq (,$(findstring yes,$(NOTIFY)))
+NOTIFYSKIP :=
+else
+NOTIFYSKIP := echo "SKIP:"
+endif
+
 # Email addresses for notifications.
 devel_addr := address@hidden
+# FIXME: Change to www-discuss in the official instance.
+web_addr := address@hidden
+# FIXME: Change to trans-coord-discuss in the official instance.
+transl_addr := address@hidden
 
 rootdir := ../..
 
@@ -178,7 +189,9 @@
 # in order to prevent further messing up in the chain.  For
 # extra safety, exit with an error so that make does not
 # proceed to the next command.
-       $(VALIDATESKIP) $(VALIDATE-HTML) $<
+       $(VALIDATESKIP) $(VALIDATE-HTML) $< &> err.log \
+         || ($(NOTIFYSKIP) mail -s "[GNUN error] $(<F) is not valid XHTML" \
+               $(web_addr) < err.log ; cat err.log ; exit 1)
        $(MAKE-PROTOTYPE) --home --input=$< --generic=generic.html --output=$@ 
|| ($(RM) $@ ; exit 1)
        $(SED) --in-place "s/\$$Date.*\$$/<gnun>\0<\/gnun>/g" $@
 
@@ -216,7 +229,11 @@
 # FIXME: Remove this conditional when GNUN operates in `www', where we
 # want to validate everything.
 ifneq (,$(findstring $(1),bg))
-       $(VALIDATESKIP) $(VALIDATE-HTML) $$@
+       $(VALIDATESKIP) $(VALIDATE-HTML) $$@ &> err.log \
+         || sleep 1 ; touch $(rootdir)/po/home.$(1).po \
+               && ($(NOTIFYSKIP) mail -s \
+                 "[GNUN error] $$(@F) is not valid XHTML" \
+                 $(transl_addr) < err.log ; cat err.log ; exit 1)
 endif
 endef
 
@@ -226,7 +243,10 @@
 ### Rules for all other articles ###
 define article_pot_rules
 $(1).proto $(1).translinks: $(subst /po/,/,$(1).html)
-       $(VALIDATESKIP) $(VALIDATE-HTML) $$<
+       $(VALIDATESKIP) $(VALIDATE-HTML) $$< &> err.log \
+         || ($(NOTIFYSKIP) mail -s \
+               "[GNUN error] $$(subst $(rootdir),,$$<) is not valid XHTML" \
+               $(web_addr) < err.log ; cat err.log ; exit 1)
        $(MAKE-PROTOTYPE) --input=$$< --generic=generic.html 
--output=$(1).proto --translinks=$(1).translinks || \
          ($(RM) $(1).proto $(1).translinks ; exit 1)
        $(SED) --in-place "s/\$$$$Date.*\$$$$/<gnun>\0<\/gnun>/g" $(1).proto
@@ -252,7 +272,10 @@
                $(SED) --in-place "s/\(<!--#include 
virtual=\".*$$$$replaceable\)\(.html\" -->\)/\1.$(2)\2/g" $(1).m4; \
        done;
        $(M4) $(1).m4 > $$@
-       $(VALIDATESKIP) $(VALIDATE-HTML) $$@
+       $(VALIDATESKIP) $(VALIDATE-HTML) $$@ &> err.log \
+         || sleep 1 ; touch $(1).po && ($(NOTIFYSKIP) mail -s \
+               "[GNUN error] $$(subst $(rootdir),,$$@) is not valid XHTML" \
+               $(transl_addr) < err.log ; cat err.log ; exit 1)
 endef
 
 $(foreach base,$(ALL_BASE),$(eval $(call article_pot_rules,$(base))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]