[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[www-el-commits] www-el GNUmakefile
From: |
Georgios Zarkadas |
Subject: |
[www-el-commits] www-el GNUmakefile |
Date: |
Tue, 22 Mar 2011 19:25:21 +0000 |
CVSROOT: /cvsroot/www-el
Module name: www-el
Changes by: Georgios Zarkadas <gzarkadas> 11/03/22 19:25:21
Modified files:
. : GNUmakefile
Log message:
final reorganisation + git support
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/www-el/GNUmakefile?cvsroot=www-el&r1=1.21&r2=1.22
Patches:
Index: GNUmakefile
===================================================================
RCS file: /cvsroot/www-el/www-el/GNUmakefile,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- GNUmakefile 21 Mar 2011 23:36:30 -0000 1.21
+++ GNUmakefile 22 Mar 2011 19:25:20 -0000 1.22
@@ -51,6 +51,7 @@
MSGUNIQ := msguniq
CVS := cvs
SVN := svn
+GIT := git
BZR := bzr
HG := hg
# Baz can be used alternatively; its commands are compatible.
@@ -80,22 +81,18 @@
_ | tr _\n_ _ _\`
endef
-# Path to make log file.
-#
-LOGFILE := __tools__/make.log
-
# Path to obsolete translations storage catalog.
#
-OBCATALOG := __tools__/deleted.el.po
+obcatalog := __tools__/deleted.el.po
# Paths to exclude from search (for example tools or test sub-directories).
# Space separated list of {-not -path <path wildcard>} items.
#
-EXCLUDED := -not -path './__tools__/*' -not -path './incoming/*'
+excluded := -not -path './__tools__/*' -not -path './incoming/*'
# Expression to retrieve all translations
#
-translations := $(shell find -name '*.$(TEAM).po' $(EXCLUDED) | sort)
+translations := $(shell find -name '*.$(TEAM).po' $(excluded) | sort)
# Warning message for the `publish' rule.
#
@@ -108,125 +105,135 @@
# Determine the VCS and relevant update/commit commands.
-REPO := $(shell (test -d CVS && echo CVS) || (test -d .svn && echo SVN) \
+repo := $(shell (test -d CVS && echo CVS) || (test -d .svn && echo SVN) \
|| (test -d .bzr && echo Bzr) || (test -d .hg && echo Hg) \
- || (test -d \{arch\} && echo Arch))
-ifndef REPO
+ || (test -d .git && echo Git) || (test -d \{arch\} && echo Arch))
+ifndef repo
$(error Unsupported Version Control System)
endif
# For those who love details.
ifdef VERBOSE
-$(info Repository: $(REPO))
+$(info Repository: $(repo))
$(info translations = $(translations))
-MSGMERGEVERBOSE := --verbose
-ECHO := echo $$file: ;
-CVSQUIET :=
-# Also applicable for Hg.
-BZRQUIET := --verbose
+msgmergeverbose := --verbose
+echofile := echo $$file: ;
+
+cvsquiet :=
+# Also applicable for Hg and Git.
+bzrquiet := --verbose
else
-CVSQUIET := -q
-BZRQUIET := --quiet
+cvsquiet := -q
+bzrquiet := --quiet
endif
-# The command to update the CVS repositories.
+# 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 --rfc-3339=seconds | tr ' +' '__' | tr -d ':')
+
+runtag := $(join status_,$(lastrun))
+
+# The commands to update/commit/tag the CVS repository.
+
define cvs-update
-$(CVS) $(CVSQUIET) update -d -P
+$(CVS) $(cvsquiet) update -d -P
endef
-# The command to update the Subversion repository.
+define cvs-commit
+$(CVS) commit -m $(log)
+endef
+
+define cvs-tag
+$(CVS) $(cvsquiet) tag $(runtag)
+endef
+
+# The commands to update/commit/tag the Subversion repository.
+
define svn-update
-$(SVN) $(CVSQUIET) update
+$(SVN) $(cvsquiet) update
endef
-# The command to update the Bazaar repository.
-define bzr-update
-$(BZR) pull $(BZRQUIET)
+define svn-commit
+$(SVN) commit -m $(log)
endef
-# The command to update the Mercurial repository.
-# Note that the "fetch" extension is not guaranteed
-# to be available, and/or enabled in user's ~/.hgrc.
-define hg-update
-$(HG) pull --update $(BZRQUIET)
+define svn-tag
+[ -d tags ] || $(SVN) mkdir tags ; \
+$(SVN) $(cvsquiet) copy trunk tags/$(runtag) -m $(runtag)
endef
-# The command to update the Arch repository.
-define tla-update
-$(TLA) update
+# The commands to update/commit/tag the Git repository.
+
+define git-update
+$(GIT) pull $(bzrquiet)
endef
-# The command to commit to the CVS repositories.
-define cvs-commit
-$(CVS) commit -m $(log)
+define git-commit
+$(GIT) commit $(bzrquiet) --all -m $(log)
endef
-# The command to commit to the Subversion repository.
-define svn-commit
-$(SVN) commit -m $(log)
+define git-tag
+$(GIT) tag -m $(runtag)
+endef
+
+# The commands to update/commit/tag the Bazaar repository.
+
+define bzr-update
+$(BZR) pull $(bzrquiet)
endef
-# The command to commit to the Bazaar repository.
# The behavior of `bzr commit' is not very script-friendly: it will
# exit with an error if there are no changes to commit.
define bzr-commit
if $(BZR) status --versioned --short | grep --quiet '^ M'; then \
- $(BZR) commit $(BZRQUIET) -m $(log) && $(BZR) push $(BZRQUIET); \
+ $(BZR) commit $(bzrquiet) -m $(log) && $(BZR) push $(bzrquiet); \
else \
true; \
fi
endef
-# The command to commit to the Mercurial repository.
-define hg-commit
-$(HG) commit $(BZRQUIET) -m $(log) && $(HG) push $(BZRQUIET)
+define bzr-tag
+$(BZR) tag $(runtag) $(bzrquiet)
endef
-# The command to commit to the Arch repository.
-# Arch is so dumb that it will do a bogus commit (adding another
-# absolutely useless revision) even if there are no changes.
-# Fortunately, the exit status of `tla changes' is sane.
-define tla-commit
-$(TLA) changes >/dev/null || $(TLA) commit -s $(log)
-endef
+# The commands to update/commit/tag the Mercurial repository.
-# 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 --rfc-3339=seconds | tr ' +' '__' | tr -d ':')
-
-TAG := $(join status_,$(LASTRUN))
+# Note that the "fetch" extension is not guaranteed
+# to be available, and/or enabled in user's ~/.hgrc.
+define hg-update
+$(HG) pull --update $(bzrquiet)
+endef
-# The command to tag the CVS repository.
-define cvs-tag
-$(CVS) $(CVSQUIET) tag $(TAG)
+define hg-commit
+$(HG) commit $(bzrquiet) -m $(log) && $(HG) push $(bzrquiet)
endef
-# The command to tag the Subversion repository.
-define svn-tag
-[ -d tags ] || $(SVN) mkdir tags ; \
-$(SVN) $(CVSQUIET) copy trunk tags/$(TAG) -m $(TAG)
+define hg-tag
+$(HG) tag -m $(runtag) $(runtag)
endef
-# The command to tag the Bazaar repository.
-define bzr-tag
-$(BZR) tag $(TAG) $(BZRQUIET)
+# The commands to update/commit/tag the Arch repository.
+
+define tla-update
+$(TLA) update
endef
-# The command to tag the Mercurial repository.
-define hg-tag
-$(HG) tag -m $(TAG) $(TAG)
+# Arch is so dumb that it will do a bogus commit (adding another absolutely
+# useless revision) even if there are no changes. Fortunately, the exit status
+# of `tla changes' is sane.
+define tla-commit
+$(TLA) changes >/dev/null || $(TLA) commit -s $(log)
endef
-# The command to tag the Arch repository.
define tla-tag
-$(TLA) tag $(TAG)
+$(TLA) tag $(runtag)
endef
-# To find prefix, make REPO lowercase and substitute arch by tla
+# To find prefix, make repo lowercase and substitute arch by tla
#
-repoprefix := $(subst arch,tla,$(shell echo $(REPO) | tr A-Z a-z))
+repoprefix := $(subst arch,tla,$(shell echo $(repo) | tr A-Z a-z))
repoupdate := $($(repoprefix)-update)
repocommit := $($(repoprefix)-commit)
@@ -234,13 +241,6 @@
# 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).
@@ -255,12 +255,11 @@
.PHONY: update
update:
ifeq ($(VCS),yes)
- @echo Updating the repositories... | tee -a $(LOGFILE)
+ @echo Updating the repositories...
cd $(wwwdir) && $(cvs-update)
- @echo Updating repository... | tee -a $(LOGFILE)
- @$(repoupdate) | tee -a $(LOGFILE)
+ $(repoupdate)
else
- $(info $(noupdmsg)) | tee -a $(LOGFILE)
+ $(info $(noupdmsg))
endif
# Synchronize (update) the PO files from the master POTs.
@@ -273,23 +272,23 @@
$${file/.$(TEAM).po/.pot}` ]; then \
echo "Warning: $(notdir $$file) has no equivalent .pot in www."; \
else \
- $(ECHO) $(MSGMERGE) $(MSGMERGEVERBOSE) --quiet --update \
+ $(echofile) $(MSGMERGE) $(msgmergeverbose) --quiet --update \
--previous $$file \
$(wwwdir)`dirname $$file`/po/`basename $${file/.$(TEAM).po/.pot}`; \
fi; \
- done | tee -a $(LOGFILE)
+ done
ifeq ($(VCS),yes)
- @echo Tagging repository with tag: \'$(TAG)\' | tee -a $(LOGFILE)
- @$(repotag) | tee -a $(LOGFILE)
- @echo Commiting changes to repository... | tee -a $(LOGFILE)
- @$(repocommit) | tee -a $(LOGFILE)
+ @echo Tagging repository with tag: \'$(runtag)\'
+ $(repotag)
+ @echo Commiting changes to repository...
+ $(repocommit)
endif
# Helper target to tag repository with the same tag class used by sync target.
.PHONY: tag
tag:
- @echo Tagging repository with tag: \'$(TAG)\' | tee -a $(LOGFILE)
- @$(repotag) | tee -a $(LOGFILE)
+ @echo Tagging repository with tag: \'$(runtag)\'
+ $(repotag)
# Helper target to check which articles have to be updated.
.PHONY: report
@@ -298,7 +297,7 @@
LC_ALL=C $(MSGFMT) --statistics -o /dev/null $$file 2>&1 \
| egrep '(fuzzy|untranslated)' \
&& echo "$${file#./} needs updating." || true ; \
- done | tee -a $(LOGFILE)
+ done
# Helper target to rewrap all PO files; avoids spurious diffs when
# they get remerged by the official build.
@@ -309,25 +308,26 @@
if [ `LC_ALL=C <$$file wc --max-line-length` -gt 80 ]; then \
$(MSGCAT) -o $$file $$file && echo " $${file#./}"; \
fi; \
- done | tee -a $(LOGFILE)
+ done
# Helper target to mark changes (at word level) in fuzzy messages
.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 | tee -a $(LOGFILE)
+ @echo The fuzdiff target is not ready for production. Skipping...
+# @for file in $(translations); do \
+# if [ -f $(wwwdir)`dirname $$file`/po/`basename \
+# $${file/.$(TEAM).po/.pot}` ]; then \
+# $(VIEWFUZZY) --output=$$file $$file; \
+# fi; \
+# done
# 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 }
+chtime := $(shell date '+%Y-%m-%d %R%:z')
+rulebg := BEGIN{ RS=""; FS="\n"; ORS="\n\n"; OFS=FS }
+rulepr := 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: $(chtime)\\n\""; break } }
print }
# Helper target to report obsolete messages
.PHONY: obreport
@@ -339,31 +339,31 @@
echo "########################################################"; \
echo ; \
$(MSGATTRIB) --only-obsolete $$file \
- | awk '$(RULEBG) $(RULERP)'; \
+ | awk '$(rulebg) $(rulepr)'; \
fi; \
- done | tee -a $(LOGFILE)
+ done
# 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)
+ @echo Removing obsolete messages to $(obcatalog) ...
+ @[ "`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 '$(RULEBG) $(RULERM)' >> $(OBCATALOG); \
+ | awk '$(rulebg) $(rulerm)' >> $(obcatalog); \
tmpfile=`tempfile`; \
$(MSGATTRIB) --no-obsolete $$file > $$tmpfile; \
mv --backup $$tmpfile $$file; \
fi; \
- done | tee -a $(LOGFILE)
+ done
@for dummy in 1; do \
tmpfile=`tempfile`; \
- < $(OBCATALOG) awk '$(RULEBG) $(RULEN1) $(RULERP)' > $$tmpfile; \
- $(MSGUNIQ) $$tmpfile > $(OBCATALOG); \
+ < $(obcatalog) awk '$(rulebg) $(rulen1) $(rulepr)' > $$tmpfile; \
+ $(MSGUNIQ) $$tmpfile > $(obcatalog); \
rm --force $$tmpfile; \
- done | tee -a $(LOGFILE)
+ done
# Helper target to copy all modified files to the `www' master repository.
# A warning is printed if the corresponding directory in `www' cannot be
@@ -375,9 +375,9 @@
# as a result of applying our tool-chain.
.PHONY: publish
publish: format
- @echo Copying edited .po files back to $(wwwdir): | tee -a $(LOGFILE)
+ @echo Copying edited .po files back to $(wwwdir):
@cat <<< '$(commit_header)' | tr "._" "$$'" \
- | sed -e 's/\^ /\n/g' -e 's/\\`/`/g' > $(commitfile) | tee -a
$(LOGFILE)
+ | sed -e 's/\^ /\n/g' -e 's/\\`/`/g' > $(commitfile)
@for file in $(translations); do \
wwwfdir=$(wwwdir)`dirname $$file`/po; \
wwwfpot=$${wwwfdir}/`basename $${file/.$(TEAM).po/.pot}`; \
@@ -407,25 +407,19 @@
echo "ERROR: could not copy $$file to $$wwwfile"; \
fi; \
fi; \
- done | tee -a $(LOGFILE)
+ done
@cat <<< '$(commit_footer)' | tr "._" "$$'" \
- | sed -e 's/\^ /\n/g' -e 's/\\`/`/g' >> $(commitfile) | tee -a
$(LOGFILE)
- @chmod u+x $(commitfile) | tee -a $(LOGFILE)
+ | sed -e 's/\^ /\n/g' -e 's/\\`/`/g' >> $(commitfile)
+ @chmod u+x $(commitfile)
# Helper target to delete common auto-generated files.
.PHONY: clean
clean:
- @echo Deleting unnecessary auto-generated files... | tee -a $(LOGFILE)
+ @echo Deleting unnecessary auto-generated files...
@for file in $(translations); do \
$(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)
+ done
+ @echo "done."
# Helper target to display accepted targets and parameters.
.PHONY: help
@@ -442,7 +436,6 @@
@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; by'
@echo ' default only files that exist in www master
repository '
@@ -457,6 +450,9 @@
@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 'tag tag the team repository with the same type of
tags as the'
+ @echo ' sync target creates; useful for
intermediately tagging the'
+ @echo ' state of large changes operations'
@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)'