www-commits
[Top][All Lists]
Advanced

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

www/server/gnun GNUmakefile gnun.mk


From: Yavor Doganov
Subject: www/server/gnun GNUmakefile gnun.mk
Date: Sun, 03 Aug 2008 18:33:54 +0000

CVSROOT:        /web/www
Module name:    www
Changes by:     Yavor Doganov <yavor>   08/08/03 18:33:54

Modified files:
        server/gnun    : GNUmakefile gnun.mk 

Log message:
        Implement deferred generation of ordinary articles when there are
        fuzzy strings based on the value of the GRACE variable.  Requested
        by the Italian team; seconded by the Serbian and Russian teams.
        * gnun.mk (no-grace-articles): New variable.
        * GNUmakefile (AWK, validate-article): New variables.
        ($(subst /po/,/,$(1).html)): Use a complex conditional to compare
        the date of the last revision of the PO file and regenerate the
        translation only if there are no fuzzy strings, or if the grace
        period is over.

CVSWeb URLs:
http://web.cvs.savannah.gnu.org/viewcvs/www/server/gnun/GNUmakefile?cvsroot=www&r1=1.5&r2=1.6
http://web.cvs.savannah.gnu.org/viewcvs/www/server/gnun/gnun.mk?cvsroot=www&r1=1.49&r2=1.50

Patches:
Index: GNUmakefile
===================================================================
RCS file: /web/www/www/server/gnun/GNUmakefile,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- GNUmakefile 29 Jun 2008 09:28:57 -0000      1.5
+++ GNUmakefile 3 Aug 2008 18:33:37 -0000       1.6
@@ -21,6 +21,7 @@
 PO4A-TRANSLATE := po4a-translate
 SED := sed
 M4 := m4
+AWK := gawk
 
 PO4A-GETTEXTIZEFLAGS :=
 PO4A-TRANSLATEFLAGS := --keep=0
@@ -211,6 +212,13 @@
 exit 1
 endef
 
+# The command to validate an ordinary article, and create a hook in
+# case validation fails.  Used only in article-rules.
+define validate-article
+$(VALIDATESKIP) ./validate-html-notify $(NOTIFYSKIP) $(transl-addr) \
+  $$@ || (PO=$(1).po ; $$(touch-hook))
+endef
+
 # Ensure that generic.LANG.html is always present for the homepage and
 # articles' generation.
 
@@ -501,9 +509,36 @@
          "s/\(<!--#include virtual=\".*$$$$inc\)\(.html\" -->\)/\1.$(2)\2/g" \
          $(1).m4; \
        done
+# If GRACE is not defined, which is the usual case for local manual
+# builds, update the target and validate the result.
+ifndef GRACE
        $(M4) $(1).m4 > $$@
-       $(VALIDATESKIP) ./validate-html-notify $(NOTIFYSKIP) $(transl-addr) \
-         $$@ || (PO=$(1).po ; $$(touch-hook))
+       $(validate-article)
+# Check if the article is not in `no-grace-articles'.
+else ifneq ($(basename $(1)), \
+           $(findstring $(basename $(1)),$(no-grace-articles)))
+# If there are no fuzzy strings, there might be untranslated or
+# obsolete, so proceed as usual.  If there are fuzzy strings, compare
+# the POT-Creation-Date in the PO with the current value of the grace
+# period and invoke regeneration only if the grace period is over.
+       if ! grep --quiet "^#, fuzzy" $(1).po ; \
+         then \
+           ($(M4) $(1).m4 > $$@ ; $(validate-article)) ; \
+         else \
+         if [ "`date --date="$(GRACE) days ago" +%Y%m%d`" -ge \
+              "`$(AWK) '/POT-Creation-Date/ { gsub(/-/, ""); print $$$$2 }' \
+                $(1).po`" ] ; \
+           then \
+             $(M4) $(1).m4 > $$@ && $(validate-article) ; \
+           else \
+             sleep 1 ; touch $(1).po ; \
+         fi ; \
+       fi
+else
+       @echo 'Ignoring grace period for article "$(notdir $(basename $(1)))"'
+       $(M4) $(1).m4 > $$@
+       $(validate-article)
+endif
 endef
 
 $(foreach base,$(ALL_BASE),$(eval $(call article-pot-rules,$(base))))

Index: gnun.mk
===================================================================
RCS file: /web/www/www/server/gnun/gnun.mk,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- gnun.mk     30 Jul 2008 20:18:59 -0000      1.49
+++ gnun.mk     3 Aug 2008 18:33:37 -0000       1.50
@@ -25,6 +25,11 @@
 
 ### The variables below are edited by GNUN maintainers. ###
 
+# List of articles for which GRACE do not apply; i.e. they are
+# regenerated even if there are fuzzy strings.
+no-grace-articles := $(addprefix $(rootdir)/, \
+                       server/po/takeaction)
+
 ALL_DIRS :=    copyleft \
                gnu \
                help \




reply via email to

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