[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
trans-coord/gnun/server/gnun GNUmakefile.team C...
From: |
Pavel Kharitonov |
Subject: |
trans-coord/gnun/server/gnun GNUmakefile.team C... |
Date: |
Fri, 23 Nov 2012 05:25:52 +0000 |
CVSROOT: /sources/trans-coord
Module name: trans-coord
Changes by: Pavel Kharitonov <ineiev> 12/11/23 05:25:52
Modified files:
gnun/server/gnun: GNUmakefile.team ChangeLog
Log message:
GNUmakefile.team (TEAM): Autodetect the language code.
(translations): Prepend `find' expression with the path.
(all): Remove `update' since `sync' already depends on it.
(sync-file, format-file, publish-file): New functions.
(sync, format, publish): Redefine using *-file to enable
parallel processing.
(format-file): Don't touch the file unless it actually
changes so that it wouldn't be published. This fixes
the bug introduced to `format' in the previous commit.
(clean): Join `rm' invocations to reduce the number of calls.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/GNUmakefile.team?cvsroot=trans-coord&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/trans-coord/gnun/server/gnun/ChangeLog?cvsroot=trans-coord&r1=1.304&r2=1.305
Patches:
Index: GNUmakefile.team
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/GNUmakefile.team,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- GNUmakefile.team 22 Nov 2012 16:05:36 -0000 1.15
+++ GNUmakefile.team 23 Nov 2012 05:25:52 -0000 1.16
@@ -35,7 +35,9 @@
SHELL = /bin/bash
# Set this variable to your language code.
-TEAM := bg
+ifndef TEAM
+TEAM := $(shell find . -name \*.po | head -n 1 | sed 's/\.po$$//; s/.*\.//')
+endif
# The relative or absolute path to the working copy of the master
# "www" repository; must end with a trailing slash.
@@ -54,7 +56,7 @@
# Baz can be used alternatively; its commands are compatible.
TLA := tla
-translations := $(shell find -name '*.$(TEAM).po' | sort)
+translations := $(shell find . -name '*.$(TEAM).po' | sort)
log := "Automatic merge from the master repository."
# Warning message for the `publish' rule.
pubwmsg := "Warning (%s): %s\n does not exist; (either obsolete or \`cvs\
@@ -92,7 +94,7 @@
endef
.PHONY: all
-all: update sync
+all: sync
# Update the master and the team repositories.
.PHONY: update
@@ -124,28 +126,9 @@
# source for missing translations, which covers the case when the
# coordinator updates the translation directly in `www' repository.
.PHONY: sync
+# Actual synchoronizations are defined as dependencies
+# to enable parallel processing.
sync: update
- @for file in $(translations); do \
- if [ ! -f $(wwwdir)`dirname $$file`/po/`basename \
- $${file/.$(TEAM).po/.pot}` ]; then \
- echo "Warning: $${file#./} has no equivalent .pot in www."; \
- else \
- echo -n "$${file#./}: "; \
- www_po=$(wwwdir)`dirname $$file`/po/`basename $${file}`; \
- if test -f $${www_po}; then \
- comp="-C $${www_po}"; \
- else \
- comp=; \
- fi; \
- diff -q -I "^$$" -I "^#" $${file} $${www_po} &>/dev/null \
- && echo "Already in sync." \
- || { \
- echo -n "Merging"; \
- $(MSGMERGE) $(MSGMERGEFLAGS) $(MSGMERGEVERBOSE) $${comp} \
- --update $$file $${www_po%.$(TEAM).po}.pot 2>&1; \
- } \
- fi; \
- done
ifeq ($(VCS),yes)
ifeq ($(REPO),CVS)
$(CVS) commit -m $(log)
@@ -175,6 +158,32 @@
endif
endif
+define sync-file
+.PNONY: sync-$(1)
+sync-$(1):
+ @file=$(1); if [ ! -f $(wwwdir)`dirname $$$$file`/po/`basename \
+ $$$${file/.$(TEAM).po/.pot}` ]; then \
+ echo "Warning: $$$${file#./} has no equivalent .pot in www."; \
+ else \
+ www_po=$(wwwdir)`dirname $$$$file`/po/`basename $$$${file}`; \
+ if test -f $$$${www_po}; then \
+ comp="-C $$$${www_po}"; \
+ else \
+ comp=; \
+ fi; \
+ diff -q -I "^$$$$" -I "^#" $$$${file} $$$${www_po} &>/dev/null \
+ && echo "$$$${file#./}: Already in sync." \
+ || { \
+ echo -n "$$$${file#./}: Merging"; \
+ $(MSGMERGE) $(MSGMERGEFLAGS) $(MSGMERGEVERBOSE) $$$${comp} \
+ --update $$$$file $$$${www_po%.$(TEAM).po}.pot 2>&1; \
+ } \
+ fi
+sync: sync-$(1)
+endef
+$(foreach file, $(patsubst ./%, %, $(translations)), \
+ $(eval $(call sync-file,$(file))))
+
# Assign priorities to translations for report.
-include priorities.mk
priority-articles-pos := \
@@ -217,17 +226,19 @@
# Helper target to rewrap all PO files; avoids spurious diffs when
# they get remerged by the official build.
+# Formatting is defined per-file as dependencies of the main target
+# to enable parallel processing.
.PHONY: format
-format:
- @echo Formatting .po files with msgcat:
-# Earlier used `if [ wc --max-line-length $$file -gt 80 ] ; then $(MSGCAT)...'
-# is not adequate because (0) msgcat doesn't wrap long comment lines
-# and (1) msgmerge in the GNUN cron job rewraps strings with short lines,
-# so there still would be a non-zero difference. On the other hand,
-# it doesn't take too long time to rewrap the files unconditionally.
- @for file in $(translations); do \
- $(MSGCAT) -o $$file $$file && echo " $${file#./}"; \
- done
+define format-file
+.PNONY: format-$(1)
+format-$(1):
+ @file=$(1); $(MSGCAT) -o $$$$file-tmp $$$$file; \
+ cmp $$$$file-tmp $$$$file || cp $$$$file-tmp $$$$file; \
+ $(RM) $$$$file-tmp; echo " $$$${file#./} formatted."
+format: format-$(1)
+endef
+$(foreach file, $(patsubst ./%, %, $(translations)), \
+ $(eval $(call format-file,$(file))))
# Helper target to copy all (supposedly) modified files to the `www'
# master repository. A warning is printed if the corresponding
@@ -236,31 +247,36 @@
# renamed or deleted).
.PHONY: publish
publish: format
- @echo Copying edited .po files back to $(wwwdir):
- @for file in $(translations); do \
- wwwfdir=$(wwwdir)`dirname $$file`/po; \
- wwwfpot=$${wwwfdir}/`basename $${file/.$(TEAM).po/.pot}`; \
- wwwfile=$${wwwfdir}/`basename $$file`; \
- if [ ! -d $$wwwfdir ]; then \
- printf $(pubwmsg) "$${file#./}" "directory $$wwwfdir"; \
+ @echo All edited .po files have been copied back to $(wwwdir)
+define publish-file
+.PNONY: publish-$(1)
+publish-$(1):
+ @file=$(1); wwwfdir=$(wwwdir)`dirname $$$$file`/po; \
+ wwwfpot=$$$${wwwfdir}/`basename $$$${file/.$(TEAM).po/.pot}`; \
+ wwwfile=$$$${wwwfdir}/`basename $$$$file`; \
+ if [ ! -d $$$$wwwfdir ]; then \
+ printf $(pubwmsg) "$$$${file#./}" \
+"skipped (no $$$$wwwfdir directory)"; \
continue; \
fi; \
- if [ ! -f $$wwwfpot ]; then \
- printf $(pubwmsg) "$${file#./}" "template $$wwwfpot"; \
+ if [ ! -f $$$$wwwfpot ]; then \
+ printf $(pubwmsg) "$$$${file#./}" \
+"template $$$$wwwfpot skipped (no such file)"; \
continue; \
fi; \
- if [ $$file -nt $$wwwfile ]; then \
- cp $$file $$wwwfile && echo " $${file#./}"; \
- fi; \
- done
+ if [ $$$$file -nt $$$$wwwfile ]; then \
+ cp $$$$file $$$$wwwfile && echo " $$$${file#./} published."; \
+ fi
+publish: publish-$(1)
+endef
+$(foreach file, $(patsubst ./%, %, $(translations)), \
+ $(eval $(call publish-file,$(file))))
# Helper target to delete common auto-generated files.
.PHONY: clean
clean:
@echo -n Deleting unnecessary auto-generated files...
@for file in $(translations); do \
- $(RM) $$file~; \
- $(RM) $${file/.po/.mo}; \
- $(RM) $$file.bak; \
+ $(RM) $$file~ $${file/.po/.mo} $$file.bak; \
done
@echo " done."
Index: ChangeLog
===================================================================
RCS file: /sources/trans-coord/trans-coord/gnun/server/gnun/ChangeLog,v
retrieving revision 1.304
retrieving revision 1.305
diff -u -b -r1.304 -r1.305
--- ChangeLog 22 Nov 2012 16:05:36 -0000 1.304
+++ ChangeLog 23 Nov 2012 05:25:52 -0000 1.305
@@ -1,3 +1,16 @@
+2012-11-23 Pavel Kharitonov <address@hidden>
+
+ * GNUmakefile.team (TEAM): Autodetect the language code.
+ (translations): Prepend `find' expression with the path.
+ (all): Remove `update' since `sync' already depends on it.
+ (sync-file, format-file, publish-file): New functions.
+ (sync, format, publish): Redefine using *-file to enable
+ parallel processing.
+ (format-file): Don't touch the file unless it actually
+ changes so that it wouldn't be published. This fixes
+ the bug introduced to `format' in the previous commit.
+ (clean): Join `rm' invocations to reduce the number of calls.
+
2012-11-22 Pavel Kharitonov <address@hidden>
* GNUmakefile.team (ECHO): Remove the variable.