[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
trans-coord/gnun/server/gnun GNUmakefile Change...
From: |
Kaloian Doganov |
Subject: |
trans-coord/gnun/server/gnun GNUmakefile Change... |
Date: |
Wed, 27 Feb 2008 10:49:31 +0000 |
CVSROOT: /sources/trans-coord
Module name: trans-coord
Changes by: Kaloian Doganov <kaloian> 08/02/27 10:49:31
Modified files:
gnun/server/gnun: GNUmakefile ChangeLog
Added files:
gnun/server/gnun: validate-html-notify mailfail
Log message:
* GNUmakefile (VALIDATE-HTML): Deleted.
(VALIDATE-HTML-NOTIFY, NOTIFYSKIP, web_addr, transl_addr): New
variables.
($(rootdir)/po/home.proto, $(1).proto $(1).translinks)
($(rootdir)/home.$(1).shtml, $(subst /po/,/,$(1).html)): Mail
output on validation error.
* validate-html-notify: New file: mails output of a failed
command.
* mailfail: New file: runs `validate-html' through `mailfail'.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/GNUmakefile?cvsroot=trans-coord&r1=1.2&r2=1.3
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/ChangeLog?cvsroot=trans-coord&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/validate-html-notify?cvsroot=trans-coord&rev=1.1
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/mailfail?cvsroot=trans-coord&rev=1.1
Patches:
Index: GNUmakefile
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/GNUmakefile,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- GNUmakefile 26 Feb 2008 16:12:21 -0000 1.2
+++ GNUmakefile 27 Feb 2008 10:49:30 -0000 1.3
@@ -20,7 +20,7 @@
PO4A-GETTEXTIZE = po4a-gettextize
PO4A-TRANSLATE = po4a-translate
MAKE-PROTOTYPE = ./make-prototype
-VALIDATE-HTML = ./validate-html
+VALIDATE-HTML-NOTIFY = ./validate-html-notify
SED = sed
M4 = m4
@@ -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 := --dry-run
+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,7 @@
# 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-NOTIFY) $(NOTIFYSKIP) $(web_addr) $<
$(MAKE-PROTOTYPE) --home --input=$< --generic=generic.html --output=$@
|| ($(RM) $@ ; exit 1)
$(SED) --in-place "s/\$$Date.*\$$/<gnun>\0<\/gnun>/g" $@
@@ -216,7 +227,8 @@
# FIXME: Remove this conditional when GNUN operates in `www', where we
# want to validate everything.
ifneq (,$(findstring $(1),bg ru))
- $(VALIDATESKIP) $(VALIDATE-HTML) $$@
+ $(VALIDATESKIP) $(VALIDATE-HTML-NOTIFY) $(NOTIFYSKIP) $(transl_addr) \
+ $$@ || (sleep 1 ; touch $(rootdir)/po/home.$(1).po ; exit 1)
endif
endef
@@ -226,7 +238,7 @@
### Rules for all other articles ###
define article_pot_rules
$(1).proto $(1).translinks: $(subst /po/,/,$(1).html)
- $(VALIDATESKIP) $(VALIDATE-HTML) $$<
+ $(VALIDATESKIP) $(VALIDATE-HTML-NOTIFY) $(NOTIFYSKIP) $(transl_addr) $$<
$(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 +264,8 @@
$(SED) --in-place "s/\(<!--#include
virtual=\".*$$$$replaceable\)\(.html\" -->\)/\1.$(2)\2/g" $(1).m4; \
done;
$(M4) $(1).m4 > $$@
- $(VALIDATESKIP) $(VALIDATE-HTML) $$@
+ $(VALIDATESKIP) $(VALIDATE-HTML-NOTIFY) $(NOTIFYSKIP) $(transl_addr) \
+ $$@ || (sleep 1 ; touch $(1).po ; exit 1)
endef
$(foreach base,$(ALL_BASE),$(eval $(call article_pot_rules,$(base))))
Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/ChangeLog,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- ChangeLog 27 Feb 2008 10:22:28 -0000 1.10
+++ ChangeLog 27 Feb 2008 10:49:30 -0000 1.11
@@ -1,3 +1,15 @@
+2008-02-27 Kaloian Doganov <address@hidden>
+
+ * GNUmakefile (VALIDATE-HTML): Deleted.
+ (VALIDATE-HTML-NOTIFY, NOTIFYSKIP, web_addr, transl_addr): New
+ variables.
+ ($(rootdir)/po/home.proto, $(1).proto $(1).translinks)
+ ($(rootdir)/home.$(1).shtml, $(subst /po/,/,$(1).html)): Mail
+ output on validation error.
+ * validate-html-notify: New file: mails output of a failed
+ command.
+ * mailfail: New file: runs `validate-html' through `mailfail'.
+
2008-02-27 Yavor Doganov <address@hidden>
* gnun.mk (fun/jokes): New variable to test sub-directories
Index: validate-html-notify
===================================================================
RCS file: validate-html-notify
diff -N validate-html-notify
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ validate-html-notify 27 Feb 2008 10:49:30 -0000 1.1
@@ -0,0 +1,52 @@
+#!/bin/bash
+
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This file is part of GNUnited Nations.
+
+# GNUnited Nations is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# GNUnited Nations is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNUnited Nations. If not, see <http://www.gnu.org/licenses/>.
+
+# Usage:
+#
+# ./validate-html-notify [--dry-run] RCPT FILE
+#
+# Example:
+#
+# ./validate-html-notify address@hidden article.html
+
+function usage() {
+ echo 1>&2 Usage: ./validate-html-notify [--dry-run] RCPT FILE
+ exit 1
+}
+
+[ $# -gt 0 ] || usage
+
+# Read arguments
+DRY_RUN=""
+if [[ "$1" == "--dry-run" ]]; then
+ [ $# -eq 3 ] || usage
+ DRY_RUN="$1"
+ RCPT="$2"
+ FILE="$3"
+ shift 3
+else
+ [ $# -eq 2 ] || usage
+ RCPT="$1"
+ FILE="$2"
+ shift 2
+fi
+
+SUBJ="[GNUN Error] ${FILE#../../} is not valid XHTML"
+
+./mailfail $DRY_RUN "$RCPT" "$SUBJ" ./validate-html "$FILE"
Index: mailfail
===================================================================
RCS file: mailfail
diff -N mailfail
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ mailfail 27 Feb 2008 10:49:30 -0000 1.1
@@ -0,0 +1,65 @@
+#!/bin/bash
+
+# Copyright (C) 2008 Free Software Foundation, Inc.
+
+# This file is part of GNUnited Nations.
+
+# GNUnited Nations is free software: you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+
+# GNUnited Nations is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNUnited Nations. If not, see <http://www.gnu.org/licenses/>.
+
+# Usage:
+#
+# ./mailfail [--dry-run] RCPT SUBJECT CMD [ARG ...]
+#
+# Example:
+#
+# ./mailfail address@hidden "Invalid XHTML" ./validate article.html
+
+function usage() {
+ echo 1>&2 Usage: ./mailfail [--dry-run] RCPT SUBJECT CMD [ARG ...]
+ exit 1
+}
+
+[ $# -gt 0 ] || usage
+
+# Read arguments
+DRY_RUN=""
+if [[ "$1" == "--dry-run" ]]; then
+ [ $# -ge 4 ] || usage
+ DRY_RUN="yes"
+ RCPT="$2"
+ SUBJECT="$3"
+ shift 3
+else
+ [ $# -ge 3 ] || usage
+ RCPT="$1"
+ SUBJECT="$2"
+ shift 2
+fi
+
+# Create tempfile and mark it for deletion on exit.
+TMP=`mktemp -t gnun.mailfail.XXXXXX`
+trap "rm -f $TMP" EXIT
+
+# Execute the command and capture it's output
+"$@" &>"$TMP"
+CMDSTATUS=$?
+cat "$TMP"
+
+# Mail the captured output, if needed
+if [[ ( -z "$DRY_RUN" ) && ( "$CMDSTATUS" -ne 0 ) ]]; then
+ mail "$RCPT" --subj "$SUBJECT" < "$TMP"
+fi
+
+# Exit with command's original exit status.
+exit $CMDSTATUS
- trans-coord/gnun/server/gnun GNUmakefile Change...,
Kaloian Doganov <=