aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2014-11-12 17:19:56 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-12 17:19:57 +0000
commitc05314a0b230d6820e07bcc641e8a553b5196e86 (patch)
treeaa33557fc68e0363baba4fd2b3c472d2a309cc00
parent1ca3350f4c7b60afdb95784c9cb3ea5ba5ce591f (diff)
parent371dcc189f62dbf5bc861aed41754a0ef1008ee5 (diff)
downloadbionic-c05314a0b230d6820e07bcc641e8a553b5196e86.tar.gz
Merge "Fix tzdata update tools for 'backzone'." into lmp-mr1-dev
-rw-r--r--libc/tools/zoneinfo/ZoneCompactor.java10
-rwxr-xr-xlibc/tools/zoneinfo/update-tzdata.py22
2 files changed, 21 insertions, 11 deletions
diff --git a/libc/tools/zoneinfo/ZoneCompactor.java b/libc/tools/zoneinfo/ZoneCompactor.java
index bf3153eff..2d598fec0 100644
--- a/libc/tools/zoneinfo/ZoneCompactor.java
+++ b/libc/tools/zoneinfo/ZoneCompactor.java
@@ -132,9 +132,15 @@ public class ZoneCompactor {
throw new RuntimeException("zone filename too long: " + zoneName.length());
}
+ // Follow the chain of links to work out where the real data for this zone lives.
+ String actualZoneName = zoneName;
+ while (links.get(actualZoneName) != null) {
+ actualZoneName = links.get(actualZoneName);
+ }
+
f.write(toAscii(new byte[MAXNAME], zoneName));
- f.writeInt(offsets.get(zoneName));
- f.writeInt(lengths.get(zoneName));
+ f.writeInt(offsets.get(actualZoneName));
+ f.writeInt(lengths.get(actualZoneName));
f.writeInt(0); // Used to be raw GMT offset. No longer used.
}
diff --git a/libc/tools/zoneinfo/update-tzdata.py b/libc/tools/zoneinfo/update-tzdata.py
index f5681beb2..330f1662d 100755
--- a/libc/tools/zoneinfo/update-tzdata.py
+++ b/libc/tools/zoneinfo/update-tzdata.py
@@ -13,8 +13,11 @@ import sys
import tarfile
import tempfile
-regions = ['africa', 'antarctica', 'asia', 'australasia', 'backward',
- 'etcetera', 'europe', 'northamerica', 'southamerica']
+regions = ['africa', 'antarctica', 'asia', 'australasia',
+ 'etcetera', 'europe', 'northamerica', 'southamerica',
+ # These two deliberately come last so they override what came
+ # before (and each other).
+ 'backward', 'backzone' ]
def CheckDirExists(dir, dirname):
if not os.path.isdir(dir):
@@ -49,16 +52,16 @@ def WriteSetupFile():
fields = line.split()
if fields:
if fields[0] == 'Link':
- links.append('%s %s %s\n' % (fields[0], fields[1], fields[2]))
+ links.append('%s %s %s' % (fields[0], fields[1], fields[2]))
zones.append(fields[2])
elif fields[0] == 'Zone':
zones.append(fields[1])
zones.sort()
setup = open('setup', 'w')
- for link in links:
- setup.write(link)
- for zone in zones:
+ for link in sorted(set(links)):
+ setup.write('%s\n' % link)
+ for zone in sorted(set(zones)):
setup.write('%s\n' % zone)
setup.close()
@@ -165,9 +168,10 @@ def BuildBionicToolsAndData(data_filename):
print 'Calling zic(1)...'
os.mkdir('data')
- for region in regions:
- if region != 'backward':
- subprocess.check_call(['zic', '-d', 'data', 'extracted/%s' % region])
+ zic_inputs = [ 'extracted/%s' % x for x in regions ]
+ zic_cmd = ['zic', '-d', 'data' ]
+ zic_cmd.extend(zic_inputs)
+ subprocess.check_call(zic_cmd)
WriteSetupFile()