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: Sun, 20 Mar 2011 23:21:02 +0000

CVSROOT:        /cvsroot/www-el
Module name:    www-el
Changes by:     Georgios Zarkadas <gzarkadas>   11/03/20 23:21:02

Modified files:
        .              : LOG GNUmakefile 

Log message:
        tools update

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

Patches:
Index: LOG
===================================================================
RCS file: /cvsroot/www-el/www-el/LOG,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- LOG 20 Mar 2011 13:23:36 -0000      1.8
+++ LOG 20 Mar 2011 23:21:02 -0000      1.9
@@ -8,6 +8,13 @@
 ## subsequent maintenance actions should not.                              ##
 #############################################################################
 
+2011-03-21     CVS     Rewritten GNUmakefile to auto tag before commit
+                       and apply our extended workflow by default; added
+                       'fuzdiff', 'obreport', 'obremove', 'logclean' targets
+                       as well as logfile integration
+
+2011-03-20     TRA     re-enabled localised styles (broken by upstream)
+
 2011-03-19     CVS     added 'help' target to GNUmakefile
 
 2011-03-18     TRA     new translations & ports from old html

Index: GNUmakefile
===================================================================
RCS file: /cvsroot/www-el/www-el/GNUmakefile,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- GNUmakefile 20 Mar 2011 13:23:36 -0000      1.15
+++ GNUmakefile 20 Mar 2011 23:21:02 -0000      1.16
@@ -48,13 +48,16 @@
 MSGFMT := msgfmt
 MSGCAT := msgcat
 MSGATTRIB := msgattrib
-VIEWFUZZY := view-fuzzy -h b -g8 --merge
 CVS := cvs
 SVN := svn
 BZR := bzr
 HG  := hg
 # Baz can be used alternatively; its commands are compatible.
 TLA := tla
+VIEWFUZZY := view-fuzzy -h b -g8 --merge
+# Put as a variable to ease those preferring trash. 
+# Note that trash does not currently accept any options.
+RM := rm --force
 
 # Script to be created by publish target (commits all published .po files).
 #
@@ -75,6 +78,10 @@
 _ | tr _\n_ _ _\`
 endef
 
+# Path to make log file.
+#
+LOGFILE := __tools__/make.log
+
 # Path to obsolete translations storage catalog.
 #
 OBCATALOG := __tools__/deleted.el.po
@@ -95,6 +102,8 @@
 
 log := "Automatic merge from the master repository."
 
+noupdmsg := 'Repositories were not updated, you might want "make VCS=yes".'
+
 # Determine the VCS and relevant update/commit commands.
 
 REPO := $(shell (test -d CVS && echo CVS) || (test -d .svn && echo SVN) \
@@ -109,6 +118,7 @@
 $(info Repository: $(REPO))
 $(info translations = $(translations))
 MSGMERGEVERBOSE := --verbose
+
 ECHO := echo $$file: ;
 CVSQUIET :=
 # Also applicable for Hg.
@@ -179,27 +189,75 @@
 $(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
+
+LASTRUN := $(shell date '+%Y-%m-%d_%H-%M-%S')
+
+TAG := $(join before_autocommit_,$(LASTRUN))
+
+# The command to tag the CVS repository.
+define cvs-tag
+$(CVS) $(CVSQUIET) tag $(TAG)
+endef
+
+# The command to tag the Subversion repository.
+define svn-tag
+[ -d tags ] || $(SVN) mkdir tags ; \
+$(SVN) $(CVSQUIET) copy trunk tags/$(TAG) -m $(TAG)
+endef
+
+# The command to tag the Bazaar repository.
+define bzr-tag
+$(BZR) tag $(TAG) $(BZRQUIET)
+endef
+
+# The command to tag the Mercurial repository.
+define hg-tag
+$(HG) tag -m $(TAG) $(TAG)
+endef
+
+# The command to tag the Arch repository.
+define tla-tag
+$(TLA) tag $(TAG)
+endef
+
 # To find prefix, make REPO lowercase and substitute arch by tla
 #
 repoprefix := $(subst arch,tla,$(shell echo $(REPO) | tr A-Z a-z))
 
 repoupdate := $(repoprefix)-update
 repocommit := $(repoprefix)-commit
+repotag := $(repoprefix)-tag
 
 # Targets
 
+# Enter a header in make logfile *once* on each invocation (hence
+# the need to do this as a side-effect and not inside targets).
+
+logheader := \#\#\#\# GNUmakefile invoked at:
+
+DUMMY := $(shell echo "$(logheader)" $(LASTRUN) | tee -a $(LOGFILE))
+
+# Putting fuzdiff, obremove *after* the sync, gives us the option to use 
+# their features locally, without storing our specialised po formats in
+# the repository (good for others which do not use our tools).
+# The inclusion of report, obreport targets is a mere convenience to keep
+# an eye in what needs to be fixed and what has changed in the POT files.
+#
 .PHONY: all
-all: update sync
+all: update sync report obreport fuzdiff obremove
 
 # Update the master and the team repositories.
 .PHONY: update
 update:
 ifeq ($(VCS),yes)
-       @echo Updating the repositories...
+       @echo Updating the repositories... | tee -a $(LOGFILE)
+# do not record www/ update in logfile to save considerable space
        cd $(wwwdir) && $(cvs-update)
-       $(repoupdate)
+       $(repoupdate) | tee -a $(LOGFILE)
 else
-       $(info Repositories were not updated, you might want "make VCS=yes".)
+       $(info $(noupdmsg)) | tee -a $(LOGFILE)
 endif
 
 # Synchronize (update) the PO files from the master POTs.
@@ -214,9 +272,12 @@
            --previous $$file \
            $(wwwdir)`dirname $$file`/po/`basename $${file/.$(TEAM).po/.pot}`; \
          fi; \
-       done
+       done | tee -a $(LOGFILE)
 ifeq ($(VCS),yes)
-       $(repocommit)
+# 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
 
 # Helper target to check which articles have to be updated.
@@ -226,7 +287,7 @@
          LC_ALL=C $(MSGFMT) --statistics -o /dev/null $$file 2>&1 \
            | egrep '(fuzzy|untranslated)' \
              && echo "$${file#./} needs updating." || true ; \
-       done
+       done | tee -a $(LOGFILE)
 
 # Helper target to rewrap all PO files; avoids spurious diffs when
 # they get remerged by the official build.
@@ -237,27 +298,44 @@
          if [ `LC_ALL=C <$$file wc --max-line-length` -gt 80 ]; then \
            $(MSGCAT) -o $$file $$file && echo "  $${file#./}"; \
          fi; \
-       done
+       done | tee -a $(LOGFILE)
 
 # Helper target to mark changes (at word level) in fuzzy messages
-.PHONY: fuzzy
-fuzzy:
+.PHONY: fuzdiff
+fuzdiff: format
        @for file in $(translations); do \
          if [ -f $(wwwdir)`dirname $$file`/po/`basename \
            $${file/.$(TEAM).po/.pot}` ]; then \
            $(VIEWFUZZY) --output=$$file $$file; \
          fi; \
-       done
+       done | tee -a $(LOGFILE)
+
+# Helper target to report obsolete messages
+.PHONY: obreport
+obreport:
+       @for file in $(translations); do \
+         if [ `LC_ALL=C $(MSGATTRIB) --only-obsolete $$file \
+             | wc --lines` -gt 0 ]; then \
+           echo "#### File: $$file"; \
+           echo "########################################################"; \
+           $(MSGATTRIB) --only-obsolete $$file; \
+         fi; \
+       done | tee -a $(LOGFILE)
 
 # Helper target to remove obsolete messages and store them in a catalog
-.PHONY: obsolete
-obsolete:
+.PHONY: obremove
+obremove:
        @for file in $(translations); do \
-         $(MSGATTRIB) --only-obsolete  $$file >> $(OBCATALOG); \
+         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); \
          tmpfile=`tempfile`; \
          $(MSGATTRIB) --no-obsolete $$file > $$tmpfile; \
          mv --backup $$tmpfile $$file; \
-       done
+         fi; \
+       done | tee -a $(LOGFILE)
 
 # Helper target to copy all (supposedly) modified files to the `www'
 # master repository.  A warning is printed if the corresponding
@@ -266,11 +344,10 @@
 # renamed or deleted).
 .PHONY: publish
 publish: format
-       @echo Copying edited .po files back to $(wwwdir):
-# Additions by www-el team <start>
+       @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)
+         | sed -e 's/\^ /\n/g' -e 's/\\`/`/g' > $(commitfile) | tee -a 
$(LOGFILE)
        @for file in $(translations); do \
          wwwfdir=$(wwwdir)`dirname $$file`/po; \
          wwwfpot=$${wwwfdir}/`basename $${file/.$(TEAM).po/.pot}`; \
@@ -289,22 +366,25 @@
              echo $${wwwfile/"$(wwwdir)"} >> $(commitfile) ; \
            fi; \
          fi; \
-       done
+       done | tee -a $(LOGFILE)
        @cat <<< '$(commit_footer)' | tr "._" "$$'" \
-         | sed -e 's/\^ /\n/g' -e 's/\\`/`/g' >> $(commitfile)
-       @chmod u+x $(commitfile)
-# Additions by www-el team <end>
+         | sed -e 's/\^ /\n/g' -e 's/\\`/`/g' >> $(commitfile) | tee -a 
$(LOGFILE)
+       @chmod u+x $(commitfile) | tee -a $(LOGFILE)
 
 # Helper target to delete common auto-generated files.
 .PHONY: clean
 clean:
-       @echo -n Deleting unnecessary auto-generated files...
+       @echo Deleting unnecessary auto-generated files... | tee -a $(LOGFILE)
        @for file in $(translations); do \
-         $(RM) $$file~; \
-         $(RM) $${file/.po/.mo}; \
-         $(RM) $$file.bak; \
-       done
-       @echo " done."
+         $(RM) $$file~ $$file.bak $${file/.po/.mo} 2>/dev/null; \
+       done | tee -a $(LOGFILE)
+       @echo "done." | tee -a $(LOGFILE)
+
+# Helper target to delete make log.
+.PHONY: logclean
+logclean:
+       @echo Deleting make logfile: $(LOGFILE)
+       @rm $(LOGFILE)
 
 # Helper target to display accepted targets and parameters.
 .PHONY: help
@@ -314,28 +394,32 @@
        @echo ''
        @echo 'Accepted values of TARGET are (only one target is allowed):'
        @echo ''
-       @echo 'all (or empty)     default target; invokes update and sync 
targets'
-       @echo 'update             update the team repository; if the VCS=yes 
parameter'
-       @echo '                   is supplied, update the master repository 
also'
-       @echo 'sync               synchronize (update) the PO files from the 
master POTs;'
-       @echo '                   if the FUZZY=yes parameter is supplied, edit 
in-place'
-       @echo '                   PO files with the view-fuzzy script to mark 
changes of'
-       @echo '                   fuzzy translations (modifies the #| 
comments);'
-       @echo '                   if the VCS=yes parameter is supplied, 
automatically'
-       @echo '                   commit the changes to the team repository'
-       @echo 'report             check which articles have to be updated and 
display '
-       @echo '                   a report'
+       @echo 'all (or empty)     default target; invokes update and sync 
targets, as well'
+       @echo '                   as report obreport fuzdiff and obremove 
targets'
+       @echo 'clean              delete common auto-generated files (.mo and 
backups)'
        @echo 'format             format all PO files to standard (80 columns) 
width'
+       @echo 'fuzdiff            edit in-place PO files with the view-fuzzy 
script to mark'
+       @echo '                   changes of fuzzy translations (modify the #| 
comments);'
+       @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 '                   to commit all changes cd to www and run 
./commit-pub'
-       @echo 'clean              delete common auto-generated files (.mo and 
backups)'
+       @echo 'obremove           remove obsolete translations from PO files; 
store them in'
+       @echo '                   a backup catalog'
+       @echo 'obreport           report obsolete translations inside PO files'
+       @echo 'report             check which articles have to be updated and 
display '
+       @echo '                   a report'
+       @echo 'sync               synchronize (update) the PO files from the 
master POTs;'
+       @echo '                   if the VCS=yes parameter is supplied, 
automatically'
+       @echo '                   commit the changes to the team repository 
(tags it just'
+       @echo '                   before the commit to allow easy rollback if 
desired)'
+       @echo 'update             update the team repository; if the VCS=yes 
parameter'
+       @echo '                   is supplied, update the master repository 
also'
        @echo 'help               display GNUmakefile usage (this message)'
        @echo ''
        @echo 'Accepted values of PARAMS are:'
        @echo ''
        @echo 'VCS=yes            update master and team repositories; valid 
with all,'
        @echo '                   update, sync targets'
-       @echo 'FUZZY=yes          mark fuzzy translations changes inside the #| 
comments;'
-       @echo '                   valid with all, sync targets'
 



reply via email to

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