www-commits
[Top][All Lists]
Advanced

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

www/server/gnun GNUmakefile


From: Yavor Doganov
Subject: www/server/gnun GNUmakefile
Date: Wed, 18 Jun 2008 18:35:53 +0000

CVSROOT:        /web/www
Module name:    www
Changes by:     Yavor Doganov <yavor>   08/06/18 18:35:53

Modified files:
        server/gnun    : GNUmakefile 

Log message:
        Implement `triggers' to cope with validation errors that don't
        trigger a rebuild of the faulty targets in the automatic builds.
        (touch-hook): New variable containing a canned command sequence.
        ($(template-dir)/po/whatsnew.%.html, $(rootdir)/home.$(1).shtml)
        ($(subst /po/,/,$(1).html)): Use it instead of the `sleep ... ;
        touch ...' sequence.
        (triggers): New Phony target.

CVSWeb URLs:
http://web.cvs.savannah.gnu.org/viewcvs/www/server/gnun/GNUmakefile?cvsroot=www&r1=1.3&r2=1.4

Patches:
Index: GNUmakefile
===================================================================
RCS file: /web/www/www/server/gnun/GNUmakefile,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- GNUmakefile 15 Jun 2008 08:17:29 -0000      1.3
+++ GNUmakefile 18 Jun 2008 18:35:30 -0000      1.4
@@ -187,6 +187,30 @@
 chmod +w $@
 endef
 
+# The command to touch the prerequisite $PO if HTML validation fails.
+# Unfortunately, merely touching it does not work for the automatic
+# build, because `cvs commit' is invoked after `make' and it resets
+# the `Date' keyword of the faulty target (thus resetting its
+# timestamp), so it becomes newer than the prerequisite.  `touch-hook'
+# creates an unique file in $(CURDIR) based on the target, which is
+# then processed by the `triggers' rule.  In a normal situation, the
+# filename shouldn't be unique as `make' fails on the first
+# encountered error.  However, this is necessary for `make -j' so it
+# has to be parallel safe like all the rules.  Also for `make -k'.
+# Touching the prerequisite is still needed for local non-VCS builds
+# to DTRT and halt when $PO is not rectified.
+# After a commit, cvs updates the working copy expanding all keywords
+# on the way and sets the timestamp as per the server time.  When the
+# client is not synchronized -- i.e. fencepost is currently lagging 2
+# minutes -- the timestamp is in the future so touching it after `cvs
+# commit' does not work.  The solution is to record a command sequence
+# that will update the timestamp based on the timestamp of the target.
+define touch-hook
+sleep 1 ; touch $$PO ; \
+echo "touch --reference=$@ --date='+5 minutes' $$PO" > $(@F).hook ; \
+exit 1
+endef
+
 # Ensure that generic.LANG.html is always present for the homepage and
 # articles' generation.
 
@@ -354,7 +378,7 @@
          $(template-dir)/po/whatsnew.$*.m4
        $(M4) $(template-dir)/po/whatsnew.$*.m4 > $@
        $(VALIDATESKIP) ./validate-html-notify $(NOTIFYSKIP) $(transl-addr) \
-         $@ || (sleep 1 ; touch $(template-dir)/po/whatsnew.$*.po ; exit 1)
+         $@ || (PO=$(template-dir)/po/whatsnew.$*.po ; $(touch-hook))
 # Copy the target where it belongs.
        cp $@ $(template-dir)
 ### End of the whatsnew-specific rules ###
@@ -411,11 +435,8 @@
          "s/\(<!--#include file=\"gnusflashes*\)\(.include\" 
-->\)/\1.$(1)\2/g" \
          $(rootdir)/po/home.$(1).m4
        $(M4) $(rootdir)/po/home.$(1).m4 > $$@
-# Touching the prerequisite does not help for the automatic build,
-# since `cvs commit' run from the cronjob after make modifies the
-# target and thus it becomes newer than the prerequisite.
        $(VALIDATESKIP) ./validate-html-notify $(NOTIFYSKIP) $(transl-addr) \
-         $$@ || (sleep 1 ; touch $(rootdir)/po/home.$(1).po ; exit 1)
+         $$@ || (PO=$(rootdir)/po/home.$(1).po ; $$(touch-hook))
 endef
 
 $(foreach h-lang,$(HOME_LINGUAS),$(eval $(call home-rules,$(h-lang))))
@@ -482,7 +503,7 @@
        done
        $(M4) $(1).m4 > $$@
        $(VALIDATESKIP) ./validate-html-notify $(NOTIFYSKIP) $(transl-addr) \
-         $$@ || (sleep 1 ; touch $(1).po ; exit 1)
+         $$@ || (PO=$(1).po ; $$(touch-hook))
 endef
 
 $(foreach base,$(ALL_BASE),$(eval $(call article-pot-rules,$(base))))
@@ -566,3 +587,22 @@
          -exec $(MSGFMT) --statistics -o /dev/null '{}' \; 2>&1 \
            | sort | egrep '(fuzzy|untranslated)' \
          || echo "All translations seem to be up-to-date."
+
+# Special target to touch all the prerequisites of the targets that
+# failed HTML validation and thus to trigger a rebuild in the next
+# run.
+.PHONY: triggers
+triggers:
+ifeq (,$(wildcard *.hook))
+       @echo "No triggers to process; build apparently successful."
+else
+# Execute the command recorded in every .hook file.
+       @for t in *.hook ; do \
+         echo -n "Processing $$t... " && bash $$t && echo done. ; \
+       done
+# Delete all *.hook files, or else there will be useless rebuilds
+# every time updating the `Date' timestamp in .LANG.html.
+       $(RM) *.hook
+endif
+
+### Everything that has a beginning has an end. ###




reply via email to

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