fix weak regular expressions (if one key was prefix of another key, the key can be misinterpreted)
--- a/Makefile Fri Dec 03 11:31:02 2010 +0100
+++ b/Makefile Mon Dec 13 18:09:27 2010 +0100
@@ -30,7 +30,6 @@
GNU_PATCH ?= gpatch
UNZIP ?= unzip
ZIP ?= zip
-GNU_GREP ?= ggrep
PERL ?= perl
BZIP2 ?= bzip2
CC = /opt/SUNWspro/bin/cc
@@ -235,12 +234,12 @@
# prototype
$(PKGS:%=build/%/prototype): build/%/prototype: build/%/.dir
$(M)GENERATE $@
- $(Q)cat $^ | $(PERL) -ne 'next if $$a{$$_}++; print' > $@
+ $(Q)cat $^ | $(PERL) -ne 'print unless $$a{$$_}++' > $@
# manifest
$(PKGS:%=build/%/manifest): build/%/manifest: build/%/.dir
$(M)GENERATE $@
- $(Q)cat $^ | $(PERL) -ne 'next if $$a{$$_}++; print' > $@
+ $(Q)cat $^ | $(PERL) -ne 'print unless $$a{$$_}++' > $@
# copyright
$(FILEROOT)/copyright.cddl+unicode: misc/copyright.cddl+unicode
@@ -260,8 +259,8 @@
add_platform = $(1)$(call contains,$(1),platform=,,$(call sep,$(1))platform=solaris)
add_yesno = $(1)$(call contains,$(1),yesno=,,$(call sep,$(1))yesno=solaris)
-spec_key = $(if $(shell $(GNU_GREP) '^$(1)' $<| cut -f2-),$(shell $(PERL) -ne 'print $$1 if /^$(1)\s*(.*)/' < $<),$(2))
-spec_key_is_set = $(if $(shell $(GNU_GREP) '^$(1)' $<| cut -f2-),\# $(1) is set,)
+spec_key = $(if $(shell $(PERL) -ne 'print 1 if /^$(1)\s/' $<),$(shell $(PERL) -ne 'print if s/^$(1)\s+(.*)/\1/' $<),$(2))
+spec_key_is_set = $(if $(shell $(PERL) -ne 'print 1 if /^$(1)\s/' $<),\# $(1) is set,)
spec_fkey = $(addprefix misc/templates/$(1)/,$(spec_key))
# if $(1) contains $(2), return $(3) else $(4)
@@ -299,11 +298,11 @@
$(LOCALES:%=build/%/locale_description): build/%/locale_description: locale/%.spec $(CLDR_TOOLS_DEPS) build/%/cldr_variant build/.dtd_cache/.src
$(M)GENERATE $@
- $(Q)(if [ -z "$(shell $(GNU_GREP) '^locale_desc' $< | cut -f2-)" ] ; then \
+ $(Q)(if [ -z "$(shell $(PERL) -ne 'print if s/^locale_desc\s+(.*)/\1/' $<)" ] ; then \
$(GEN_DESCRIPTION) build/cldr_core $(shell cat build/$*/cldr_variant); \
echo " ($(call charmap,$*))"; \
else \
- echo "$(shell $(GNU_GREP) '^locale_desc' $<| cut -f2-)"; \
+ echo "$(shell $(PERL) -ne 'print if s/^locale_desc\s+(.*)/\1/' $<)"; \
fi) > $@
$(LOCALES:%=build/%/prototype): build/%/prototype: locale/%.spec build/%/pkg_description