From e704f64c8201aa7e47dff5f7d77a9c1cc1d6aeeb Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Wed, 11 Jan 2012 01:32:37 +0000 Subject: [PATCH] mkrules: Correct handling of multiple foundry mappings. If multiple PCFs request the same mapping, only write it once; if they induce inconsistent mappings, report an error. Make sure there's a newline between foundry mapping entries. Signed-off-by: Mark Wooding --- mkrules | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/mkrules b/mkrules index b55b397..a0d08de 100755 --- a/mkrules +++ b/mkrules @@ -25,6 +25,7 @@ chars () { } seenrules=/ +seenfoundries=/ while read keyword rest; do case "$keyword" in @@ -54,7 +55,19 @@ while read keyword rest; do print or die $!; exit; ' <$good` - printf "%s %s" "$oldfoundry" "$newfoundry" >>rules/foundries.new + case "$seenfoundries" in + */"$oldfoundry,$newfoundry"/*) + ;; + */"$oldfoundry,"*) + echo >&2 "inconsistent foundry mapping" + exit 1 + ;; + *) + seenfoundries=$seenfoundries$oldfoundry,$newfoundry/ + printf >>rules/foundries.new \ + "%s %s\n" "$oldfoundry" "$newfoundry" + ;; + esac case "$seenrules" in */"$newfoundry,$key"/*) exec 3>>rules/$newfoundry,$key.rules -- 2.11.0