www-el-commits
[Top][All Lists]
Advanced

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

[www-el-commits] www-el LOG GNUmakefile


From: Georgios Zarkadas
Subject: [www-el-commits] www-el LOG GNUmakefile
Date: Mon, 21 Mar 2011 22:05:51 +0000

CVSROOT:        /cvsroot/www-el
Module name:    www-el
Changes by:     Georgios Zarkadas <gzarkadas>   11/03/21 22:05:51

Modified files:
        .              : LOG GNUmakefile 

Log message:
        GNUmakefile fixups

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/www-el/LOG?cvsroot=www-el&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/www-el/GNUmakefile?cvsroot=www-el&r1=1.16&r2=1.17

Patches:
Index: LOG
===================================================================
RCS file: /cvsroot/www-el/www-el/LOG,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- LOG 20 Mar 2011 23:21:02 -0000      1.9
+++ LOG 21 Mar 2011 22:05:51 -0000      1.10
@@ -13,7 +13,7 @@
                        'fuzdiff', 'obreport', 'obremove', 'logclean' targets
                        as well as logfile integration
 
-2011-03-20     TRA     re-enabled localised styles (broken by upstream)
+2011-03-20     WEB     re-enabled localised styles (broken by upstream)
 
 2011-03-19     CVS     added 'help' target to GNUmakefile
 

Index: GNUmakefile
===================================================================
RCS file: /cvsroot/www-el/www-el/GNUmakefile,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- GNUmakefile 20 Mar 2011 23:21:02 -0000      1.16
+++ GNUmakefile 21 Mar 2011 22:05:51 -0000      1.17
@@ -48,6 +48,7 @@
 MSGFMT := msgfmt
 MSGCAT := msgcat
 MSGATTRIB := msgattrib
+MSGUNIQ := msguniq
 CVS := cvs
 SVN := svn
 BZR := bzr
@@ -56,6 +57,7 @@
 TLA := tla
 VIEWFUZZY := view-fuzzy -h b -g8 --merge
 # Put as a variable to ease those preferring trash. 
+# Better use it only for files inside the repository; use rm for temp files.
 # Note that trash does not currently accept any options.
 RM := rm --force
 
@@ -189,12 +191,12 @@
 $(TLA) changes >/dev/null || $(TLA) commit -s $(log)
 endef
 
-# We record time with second accuracy to allow correct operation
-# of tags even when multiple syncs per day are performed
+# We record UTC time with second accuracy to allow correct operation of tags 
+# even when multiple syncs per day are performed from multiple users.
 
-LASTRUN := $(shell date '+%Y-%m-%d_%H-%M-%S')
+LASTRUN := $(shell date --rfc-3339=seconds | tr ' ' '_' | tr -d ':')
 
-TAG := $(join before_autocommit_,$(LASTRUN))
+TAG := $(join status_,$(LASTRUN))
 
 # The command to tag the CVS repository.
 define cvs-tag
@@ -249,11 +251,11 @@
 all: update sync report obreport fuzdiff obremove
 
 # Update the master and the team repositories.
+# Do not record www/ update in logfile to save considerable space.
 .PHONY: update
 update:
 ifeq ($(VCS),yes)
        @echo Updating the repositories... | tee -a $(LOGFILE)
-# do not record www/ update in logfile to save considerable space
        cd $(wwwdir) && $(cvs-update)
        $(repoupdate) | tee -a $(LOGFILE)
 else
@@ -261,6 +263,8 @@
 endif
 
 # Synchronize (update) the PO files from the master POTs.
+# Tagging the repository before auto commiting is a *good* idea, especially
+# while developing the tools; if something screws up we can easily restore.
 .PHONY: sync
 sync: update
        @for file in $(translations); do \
@@ -274,8 +278,6 @@
          fi; \
        done | tee -a $(LOGFILE)
 ifeq ($(VCS),yes)
-# Tagging the repository before auto commiting is a *good* idea, especially
-# while developing the tools; if something screws up we can easily restore.
        $(repotag)    | tee -a $(LOGFILE)
        $(repocommit) | tee -a $(LOGFILE)
 endif
@@ -310,6 +312,14 @@
          fi; \
        done | tee -a $(LOGFILE)
 
+# Code of awk scripts used in next two targets
+#
+CTIME := $(shell date '+%Y-%m-%d %R%:z')
+RULEBG := BEGIN{ RS=""; FS="\n"; ORS="\n\n"; OFS=FS }
+RULERP := NR > 1 { $$1=$$1; print }
+RULERM := NR > 1 { for (i=1; i<=NF; ++i) sub(/^\#~ /,"",$$i); print }
+RULEN1 := NR == 1 { $$1=$$1; for (i=1; i<=NF; ++i){ if 
($$i~/PO-Revision-Date:/){ $$i="\"PO-Revision-Date: $(CTIME)\\n\""; break } } 
print }
+
 # Helper target to report obsolete messages
 .PHONY: obreport
 obreport:
@@ -318,34 +328,45 @@
              | wc --lines` -gt 0 ]; then \
            echo "#### File: $$file"; \
            echo "########################################################"; \
-           $(MSGATTRIB) --only-obsolete $$file; \
+           echo ; \
+           $(MSGATTRIB) --only-obsolete $$file \
+             | awk '$(RULEBG) $(RULERP)'; \
          fi; \
        done | tee -a $(LOGFILE)
 
 # Helper target to remove obsolete messages and store them in a catalog
 .PHONY: obremove
 obremove:
+       @echo Removing obsolete messages to $(OBCATALOG) ... | tee -a $(LOGFILE)
+       @[ "`tail --lines=1 $(OBCATALOG)`" = "" ] || echo >> $(OBCATALOG)
        @for file in $(translations); do \
          if [ `LC_ALL=C $(MSGATTRIB) --only-obsolete $$file \
              | wc --lines` -gt 0 ]; then \
-           $(MSGATTRIB) --only-obsolete $$file | awk \
-             'BEGIN{RS="";FS="\n"} NR>1{for(i=1;i<=NF;++i) sub(/^#~ /,"",$$i); 
print}'\
-             >> $(OBCATALOG); \
+           $(MSGATTRIB) --only-obsolete $$file \
+             | awk '$(RULEBG) $(RULERM)' >> $(OBCATALOG); \
            tmpfile=`tempfile`; \
            $(MSGATTRIB) --no-obsolete $$file > $$tmpfile; \
            mv --backup $$tmpfile $$file; \
          fi; \
        done | tee -a $(LOGFILE)
+       @for dummy in 1; do \
+         tmpfile=`tempfile`; \
+         < $(OBCATALOG) awk '$(RULEBG) $(RULEN1) $(RULERP)' > $$tmpfile; \
+         $(MSGUNIQ) $$tmpfile > $(OBCATALOG); \
+         rm --force $$tmpfile; \
+       done | tee -a $(LOGFILE)
 
-# Helper target to copy all (supposedly) modified files to the `www'
-# master repository.  A warning is printed if the corresponding
-# directory in `www' cannot be found, or if the template is missing
-# (which in almost all cases means that the original article has been
-# renamed or deleted).
+# Helper target to copy all modified files to the `www' master repository.
+# A warning is printed if the corresponding directory in `www' cannot be 
+# found, or if the template is missing (which in almost all cases means that
+# the original article has been renamed or deleted).
+# An autocommit script - $(commitfile) - is also created to ease commiting
+# in a single step (good for those reviewing the commit message).
+# Files are compared regarding content only, since file date may change 
+# as a result of applying our tool-chain.
 .PHONY: publish
 publish: format
        @echo Copying edited .po files back to $(wwwdir): | tee -a $(LOGFILE)
-# Creation of a cvs auto-commit script in $(wwwdir) for published files.
        @cat <<< '$(commit_header)' | tr "._" "$$'" \
          | sed -e 's/\^ /\n/g' -e 's/\\`/`/g' > $(commitfile) | tee -a 
$(LOGFILE)
        @for file in $(translations); do \
@@ -360,10 +381,21 @@
            printf $(pubwmsg) "$${file#./}" "template $$wwwfpot"; \
            continue; \
          fi; \
-         if [ $$file -nt $$wwwfile ]; then \
+         if [ -f $$wwwfile ] ; then \
+           if [ `LC_ALL=C diff -u $$file $$wwwfile | wc --lines` -gt 0 ]; then 
\
            if cp $$file $$wwwfile; then \
              echo "  $${file#./}"; \
              echo $${wwwfile/"$(wwwdir)"} >> $(commitfile) ; \
+             else \
+               echo "ERROR: could not copy $$file to $$wwwfile"; \
+             fi; \
+           fi; \
+         elif [ "$(NEWPUB)" = "yes" ] ; then \
+           if cp $$file $$wwwfile; then \
+             echo "  $${file#./}"; \
+             echo $${wwwfile/"$(wwwdir)"} >> $(commitfile) ; \
+           else \
+             echo "ERROR: could not copy $$file to $$wwwfile"; \
            fi; \
          fi; \
        done | tee -a $(LOGFILE)
@@ -384,7 +416,7 @@
 .PHONY: logclean
 logclean:
        @echo Deleting make logfile: $(LOGFILE)
-       @rm $(LOGFILE)
+       @$(RM) $(LOGFILE)
 
 # Helper target to display accepted targets and parameters.
 .PHONY: help
@@ -403,7 +435,9 @@
        @echo '                   invokes format target'
        @echo 'logclean           delete makefile log; issue this when it gets 
big'
        @echo 'publish            copy modified PO files to the www master 
repository and'
-       @echo '                   create a commit script there; invokes format 
target;'
+       @echo '                   create a commit script there; invokes format 
target; by'
+       @echo '                   default only files that exist in www master 
repository '
+       @echo '                   are published; supply NEWPUB=yes parameter to 
override it;'
        @echo '                   to commit all changes cd to www and run 
./commit-pub'
        @echo 'obremove           remove obsolete translations from PO files; 
store them in'
        @echo '                   a backup catalog'
@@ -422,4 +456,8 @@
        @echo ''
        @echo 'VCS=yes            update master and team repositories; valid 
with all,'
        @echo '                   update, sync targets'
+       @echo 'NEWPUB=yes         publish also PO files that do not exist in 
www master'
+       @echo '                   repository; valid with publish target; use 
with caution'
+       @echo '                   since this means translations that may not be 
ready yet'
+       @echo '                   will be published'
 



reply via email to

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