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

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

trans-coord/gnun/server/gnun ChangeLog GNUmakef...


From: Pavel Kharitonov
Subject: trans-coord/gnun/server/gnun ChangeLog GNUmakef...
Date: Thu, 19 Apr 2012 04:50:21 +0000

CVSROOT:        /sources/trans-coord
Module name:    trans-coord
Changes by:     Pavel Kharitonov <ineiev>       12/04/19 04:50:21

Modified files:
        gnun/server/gnun: ChangeLog GNUmakefile NEWS 

Log message:
        Prevent committing incomplete and invalid translations.
        Fix a minor limitation of `extract-title'.
        
        * GNUmakefile (extract-title): Correctly process titles that don't
        fit into single line.
        (touch-hook): Don't touch $PO when $@ is absent.
        (draft-suffix): New variable.
        (validate-article): Validate draft rather than target itself;
        remove draft if it doesn't validates when VCS is enabled.
        (output-article-html): Don't announce, it should be done after
        validation; output to temporary draft file rather than to address@hidden
        (home-rules, article-rules): Only add files that pass validation.
        (article-rules): Only announce when the file has passed
        validation.  Check whether the target is present before marking it
        outdated.
        (home-rules): Use `validate-article'.
        * NEWS: Update.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/ChangeLog?cvsroot=trans-coord&r1=1.262&r2=1.263
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/GNUmakefile?cvsroot=trans-coord&r1=1.119&r2=1.120
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/NEWS?cvsroot=trans-coord&r1=1.48&r2=1.49

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/ChangeLog,v
retrieving revision 1.262
retrieving revision 1.263
diff -u -b -r1.262 -r1.263
--- ChangeLog   25 Mar 2012 05:19:13 -0000      1.262
+++ ChangeLog   19 Apr 2012 04:50:20 -0000      1.263
@@ -1,3 +1,23 @@
+2012-04-19  Pavel Kharitonov  <address@hidden>
+
+       Prevent committing incomplete and invalid translations.
+       Fix a minor limitation of `extract-title'.
+
+       * GNUmakefile (extract-title): Correctly process titles that don't
+       fit into single line.
+       (touch-hook): Don't touch $PO when $@ is absent.
+       (draft-suffix): New variable.
+       (validate-article): Validate draft rather than target itself;
+       remove draft if it doesn't validates when VCS is enabled.
+       (output-article-html): Don't announce, it should be done after
+       validation; output to temporary draft file rather than to address@hidden
+       (home-rules, article-rules): Only add files that pass validation.
+       (article-rules): Only announce when the file has passed
+       validation.  Check whether the target is present before marking it
+       outdated.
+       (home-rules): Use `validate-article'.
+       * NEWS: Update.
+
 2012-03-25  Pavel Kharitonov  <address@hidden>
 
        * GNUmakefile (report): Don't take into account compendia.

Index: GNUmakefile
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/GNUmakefile,v
retrieving revision 1.119
retrieving revision 1.120
diff -u -b -r1.119 -r1.120
--- GNUmakefile 25 Mar 2012 05:19:13 -0000      1.119
+++ GNUmakefile 19 Apr 2012 04:50:21 -0000      1.120
@@ -624,20 +624,28 @@
 # that will update the timestamp based on the timestamp of the target.
 define touch-hook
 sleep 1 ; touch $$PO ; \
-echo "touch --reference=$@ --date='+1 seconds' $$PO" > $(@F).hook ; \
+if test -f $@ ; then \
+  echo "touch --reference=$@ --date='+1 seconds' $$PO" > $(@F).hook ; \
+else \
+  echo "echo; echo $@ has never been built." > $(@F).hook ; \
+fi; \
 exit 1
 endef
 
 # The command to extract a meaningful human-readable title from a
 # .LANG.html.  Some HTML entities that are sometimes used in titles
-# are transformed, to avoid annoying stuff in email subjects.  The
-# title is base64-encoded as the Subject header must comply with RFC
-# 2822, otherwise the message is rejected by the gnu.org servers
+# are transformed, to avoid annoying stuff in email subjects.  When
+# the title doesn't fit into single line, the first line with
+# an ellipsis is used.
+#
+# The title is base64-encoded as the Subject header must comply with
+# RFC 2822, otherwise the message is rejected by the gnu.org servers
 # (sysadmin RT #600797).  Used only in article-rules, and only if
 # ANNOUNCE=yes.
 define extract-title
 echo -n \`$(GREP) --max-count=1 '<h2' address@hidden \
-  | $(SED) 's/<h2[^>]*>\(.*\)<\/h2>/\1/' | $(SED) 's/\&mdash;/--/g' \
+  | $(SED) '/<\/h2>/!s/$$$$/.../;s/.*<h2[^>]*>\(.*\)\(<\/h2>.*\)\?/\1/' \
+  | $(SED) 's/\&mdash;/--/g' \
   | $(SED) 's/\&..quo;/"/g' | base64 --wrap=0
 endef
 
@@ -654,11 +662,16 @@
 fi
 endef
 
-# The command to validate an ordinary article, and create a hook in
-# case validation fails.  Used only in article-rules.
+# Suffix for preliminarily generated HTML files.
+draft-suffix := .humbly-drafted-by-GNUN
+
+# The command to validate an ordinary article; remove the generated file
+# (when VCS operations are enabled) and create a hook in case validation
+# fails.
 define validate-article
 $(VALIDATESKIP) $(VALIDATE-HTML-NOTIFY) $(NOTIFYSKIP) $(transl-addr) \
-  $$@ || (PO=$(1).po ; $$(touch-hook))
+  address@hidden || ($(VCSSKIP) $(RM) address@hidden; \
+                        PO=$(1).po ; $$(touch-hook))
 endef
 
 # Ensure that generic.LANG.html is always present for the homepage and
@@ -932,8 +945,6 @@
 # for the reader.  Ensure that the build still barfs next time if the
 # translator doesn't fix it quickly.
        PO=$(rootdir)/po/$(2).$(1).po ; $(check-po) || (touch $$$$PO ; exit 1)
-       $$(addfile)
-       $$(fixperm)
        $(call generate-html,$(1), \
          $(rootdir)/po/$(2).$(1).po,$(rootdir)/po/$(2).$(1).m4)
        $(SED) --in-place \
@@ -950,9 +961,12 @@
        $(call extract-outdated-date,$(rootdir)/po/$(2).$(1).po) > /dev/null \
        || ($(call add-file,$(rootdir)/po/$(2).$(1)-en.html); \
            cp $(rootdir)/$(2).html $(rootdir)/po/$(2).$(1)-en.html)
-       $(M4) $(rootdir)/po/$(2).$(1).m4 > $$@
-       $(VALIDATESKIP) $(VALIDATE-HTML-NOTIFY) $(NOTIFYSKIP) $(transl-addr) \
-         $$@ || (PO=$(rootdir)/po/$(2).$(1).po ; $$(touch-hook))
+       -$(RM) address@hidden
+       $(M4) $(rootdir)/po/$(2).$(1).m4 > address@hidden
+       $(call validate-article,$(rootdir)/po/$(2).$(1))
+       $(call add-file,$$@)
+       $$(fixperm)
+       mv address@hidden $$@
 endef
 
 $(foreach h-name,home home-staged, \
@@ -980,11 +994,11 @@
        $$(generate-pot)
 endef
 
-# Produce article HTML file, announce and validate it if needed
+# Produce article HTML file and validate it if needed.
 define output-article-html
-$(M4) $(1).m4 > $$@ \
+$(M4) $(1).m4 > address@hidden \
 $(if $(findstring $(basename $(1)),$(no-validate-articles)), , \
-  && $(announce) && $(validate-article))
+  && $(call validate-article,$(1)))
 endef
 
 define grace-is-over
@@ -1018,24 +1032,7 @@
 endif
        exit 1
 endif
-# A slightly modified version of $(addfile) that takes care to create
-# a .hook-ann file if ANNOUNCE is enabled and it is a new translation.
-ifeq (yes,$(ANNOUNCE))
-       [ -f $$@ ] || (touch $$@ $$(@F).hook-ann; $(VCSSKIP) $(vcs) add $$@)
-else
-       $$(addfile)
-endif
-# If a new PO file is invalid, an empty .LANG.html will be committed
-# so it is not appropriate to announce it as a "new translation".
-# Record a magic string in the .hook-ann file to make the `triggers'
-# rule DTRT.
-       PO=$(1).po; $(check-po) || (touch $$$$PO; \
-         if test -f $$(@F).hook-ann; then \
-           echo "gnun-do-not-delete-me" > $$(@F).hook-ann; \
-         fi; exit 1)
-# This is needed for only a few articles, but as it is harmless there
-# is no real need to determine them and run the command conditionally.
-       $$(fixperm)
+       PO=$(1).po; $(check-po) || (touch $$$$PO; exit 1)
        $(call generate-html,$(2),$(1).po,$(1).m4)
        $(SED) --in-place \
          "s/\(<gnun>m4_include(\`.*\)\([.]html')<\/gnun>\)/\1.$(2)\2/g" $(1).m4
@@ -1043,10 +1040,11 @@
        $(SED) --in-place \
          ':egin;N;$$$$!begin;s/\([ \t]*\n[ \t]*\)\{3,\}<!--/\n\n<!--/g' \
          $(1).m4
+       -$(RM) address@hidden
 # If GRACE is not defined, which is the usual case for local manual
 # builds, update the target and validate the result.
 ifndef GRACE
-       $(output-article-html);
+       $(output-article-html)
 # Check if the article is not in `no-grace-items'.
 else ifneq ($(basename $(1)), \
            $(findstring $(basename $(1)),$(no-grace-items)))
@@ -1056,11 +1054,7 @@
 # of the $(GRACE) period and invoke regeneration only if the grace period
 # is over. Likewise, check against $(OUTDATED-GRACE) and insert a notice
 # into the HTML file when the grace period is over.
-# If the target is of zero size, it means that it was just touched by
-# $(addfile) -- GRACE is ignored in this case to avoid committing
-# empty files to the repository.
-       if ! $(call extract-outdated-date,$(1).po) > /dev/null \
-             || ! test -s $$@; then \
+       if ! $(call extract-outdated-date,$(1).po) > /dev/null ; then \
          $(output-article-html); \
        elif $(call grace-is-over,$(1).po,$(GRACE)) ; then \
          $(output-article-html); \
@@ -1069,11 +1063,21 @@
        fi
 else
        @echo 'Ignoring grace period for article "$(notdir $(basename $(1)))"'
-       $(output-article-html);
+       $(output-article-html)
 endif
+       if test -f address@hidden ; then \
+           $(if $(and $(findstring $(ANNOUNCE),yes), \
+                      $(findstring yes,$(ANNOUNCE))), \
+             $(call add-file,$$@,$$(@F).hook-ann), \
+             $(call add-file,$$@)); \
+             $$(fixperm); \
+             mv address@hidden $$@; \
+        fi
+       $(announce) 
        $(if $(findstring $(basename $(1)),$(no-grace-items)), \
            echo 'Ignoring delay for article "$(notdir $(basename $(1)))"', \
-           if $(call grace-is-over,$(1).po,$(OUTDATED-GRACE)); then \
+           if test -f $$@ \
+                && $(call grace-is-over,$(1).po,$(OUTDATED-GRACE)); then \
              PO=$(1).po; $(call mark-outdated,$$@,$(2)); \
            fi)
        $(call generate-translinks,$(basename $(1)))

Index: NEWS
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/NEWS,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- NEWS        17 Mar 2012 15:00:23 -0000      1.48
+++ NEWS        19 Apr 2012 04:50:21 -0000      1.49
@@ -11,6 +11,15 @@
 *** When adding language suffix to the URLs of localized templates,
     the full string is checked, not just the end of it.
 
+*** When a PO file was initially committed, GNUN committed
+    the translation even if it was not complete; now incomplete
+    translations are only committed when GRACE is over.
+
+*** GNUN committed HTML files even when they were invalid.
+
+*** When the title didn't fit into single line, it weren't extracted
+    correctly for announcements.
+
 * Changes in GNUnited Nations 0.5 (2012-01-30)
 
 ** Multivews support.



reply via email to

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