Remove zone.tab from tzdata am: 61b7d56237
Original change: https://android-review.googlesource.com/c/platform/system/timezone/+/1316534
Change-Id: I2862bf29d3001e75c5cbcd23b03aaa48367a75de
diff --git a/debug_tools/host/main/java/ZoneSplitter.java b/debug_tools/host/main/java/ZoneSplitter.java
index cc00254..3840df6 100644
--- a/debug_tools/host/main/java/ZoneSplitter.java
+++ b/debug_tools/host/main/java/ZoneSplitter.java
@@ -62,7 +62,6 @@
// byte[12] tzdata_version -- "tzdata2012f\0"
// int index_offset
// int data_offset
- // int zonetab_offset
// int final_offset
writeVersionFile(mappedFile, outputDir);
@@ -71,26 +70,20 @@
validateOffset(index_offset, fileSize);
int data_offset = mappedFile.getInt();
validateOffset(data_offset, fileSize);
- int zonetab_offset = mappedFile.getInt();
- validateOffset(zonetab_offset, fileSize);
int final_offset = mappedFile.getInt();
if (index_offset >= data_offset
- || data_offset >= zonetab_offset
- || zonetab_offset >= final_offset
+ || data_offset >= final_offset
|| final_offset > fileSize) {
throw new IOException("Invalid offset: index_offset=" + index_offset
- + ", data_offset=" + data_offset + ", zonetab_offset=" + zonetab_offset
- + ", final_offset=" + final_offset + ", fileSize=" + fileSize);
+ + ", data_offset=" + data_offset + ", final_offset=" + final_offset
+ + ", fileSize=" + fileSize);
}
File zicFilesDir = new File(outputDir, "zones");
zicFilesDir.mkdir();
extractZicFiles(mappedFile, index_offset, data_offset, zicFilesDir);
- writeZoneTabFile(mappedFile, zonetab_offset, final_offset - zonetab_offset,
- outputDir);
-
if (final_offset != fileSize) {
// This isn't an error, but it's worth noting: it suggests the file may be in a newer
// format than the current branch.
@@ -206,14 +199,6 @@
}
}
- private static void writeZoneTabFile(MappedByteBuffer mappedFile,
- int zoneTabOffset, int zoneTabSize, File outputDir) throws IOException {
- byte[] bytes = new byte[zoneTabSize];
- mappedFile.position(zoneTabOffset);
- mappedFile.get(bytes, 0, bytes.length);
- writeBytesToFile(new File(outputDir, "zone.tab"), bytes);
- }
-
private static void writeStringUtf8ToFile(File file, String string) throws IOException {
writeBytesToFile(file, string.getBytes(StandardCharsets.UTF_8));
}
diff --git a/input_tools/android/zone_compactor/main/java/ZoneCompactor.java b/input_tools/android/zone_compactor/main/java/ZoneCompactor.java
index 81873aa..72e5e0c 100644
--- a/input_tools/android/zone_compactor/main/java/ZoneCompactor.java
+++ b/input_tools/android/zone_compactor/main/java/ZoneCompactor.java
@@ -17,7 +17,7 @@
import java.io.*;
import java.util.*;
-// usage: java ZoneCompiler <setup file> <data directory> <output directory> <tzdata version>
+// usage: java ZoneCompactor <setup file> <data directory> <output directory> <tzdata version>
//
// Compile a set of tzfile-formatted files into a single file containing an index.
//
@@ -72,7 +72,8 @@
out.flush();
}
- public ZoneCompactor(String setupFile, String dataDirectory, String zoneTabFile, String outputDirectory, String version) throws Exception {
+ public ZoneCompactor(String setupFile, String dataDirectory, String outputDirectory,
+ String version) throws Exception {
// Read the setup file and concatenate all the data.
ByteArrayOutputStream allData = new ByteArrayOutputStream();
BufferedReader reader = new BufferedReader(new FileReader(setupFile));
@@ -119,7 +120,6 @@
// byte[12] tzdata_version -- 'tzdata2012f\0'
// int index_offset -- so we can slip in extra header fields in a backwards-compatible way
// int data_offset
- // int zonetab_offset
// int final_offset
// tzdata_version
@@ -131,8 +131,6 @@
f.writeInt(0);
int data_offset_offset = (int) f.getFilePointer();
f.writeInt(0);
- int zonetab_offset_offset = (int) f.getFilePointer();
- f.writeInt(0);
// The final offset serves as a placeholder for sections that might be added in future and
// ensures we know the size of the final "real" section. Relying on the last section ending at
// EOF would make it harder to append sections to the end of the file in a backward compatible
@@ -168,18 +166,6 @@
// Write the data.
f.write(allData.toByteArray());
- int zonetab_offset = (int) f.getFilePointer();
-
- // Copy the zone.tab.
- reader = new BufferedReader(new FileReader(zoneTabFile));
- while ((s = reader.readLine()) != null) {
- if (!s.startsWith("#")) {
- f.writeBytes(s);
- f.write('\n');
- }
- }
- reader.close();
-
int final_offset = (int) f.getFilePointer();
// Go back and fix up the offsets in the header.
@@ -187,8 +173,6 @@
f.writeInt(index_offset);
f.seek(data_offset_offset);
f.writeInt(data_offset);
- f.seek(zonetab_offset_offset);
- f.writeInt(zonetab_offset);
f.seek(final_offset_offset);
f.writeInt(final_offset);
@@ -206,11 +190,11 @@
}
public static void main(String[] args) throws Exception {
- if (args.length != 5) {
- System.err.println("usage: java ZoneCompactor <setup file> <data directory> <zone.tab file>"
- + " <output directory> <tzdata version>");
- System.exit(0);
+ if (args.length != 4) {
+ System.err.println("usage: java ZoneCompactor <setup file> <data directory>"
+ + " <output directory> <tzdata version>");
+ System.exit(1);
}
- new ZoneCompactor(args[0], args[1], args[2], args[3], args[4]);
+ new ZoneCompactor(args[0], args[1], args[2], args[3]);
}
}
diff --git a/output_data/distro/distro.zip b/output_data/distro/distro.zip
index c22c454..c12abf1 100644
--- a/output_data/distro/distro.zip
+++ b/output_data/distro/distro.zip
Binary files differ
diff --git a/output_data/iana/tzdata b/output_data/iana/tzdata
index 372a82a..422f03a 100644
--- a/output_data/iana/tzdata
+++ b/output_data/iana/tzdata
Binary files differ
diff --git a/testing/data/test1/output_data/distro/distro.zip b/testing/data/test1/output_data/distro/distro.zip
index 4a852a6..2e5603d 100644
--- a/testing/data/test1/output_data/distro/distro.zip
+++ b/testing/data/test1/output_data/distro/distro.zip
Binary files differ
diff --git a/testing/data/test1/output_data/iana/tzdata b/testing/data/test1/output_data/iana/tzdata
index badbbc5..e60fb5e 100644
--- a/testing/data/test1/output_data/iana/tzdata
+++ b/testing/data/test1/output_data/iana/tzdata
Binary files differ
diff --git a/testing/data/test2/output_data/distro/distro.zip b/testing/data/test2/output_data/distro/distro.zip
index efd5c23..3728847 100644
--- a/testing/data/test2/output_data/distro/distro.zip
+++ b/testing/data/test2/output_data/distro/distro.zip
Binary files differ
diff --git a/testing/data/test2/output_data/iana/tzdata b/testing/data/test2/output_data/iana/tzdata
index 4efdbf1..e2b8fac 100644
--- a/testing/data/test2/output_data/iana/tzdata
+++ b/testing/data/test2/output_data/iana/tzdata
Binary files differ
diff --git a/testing/data/test3/output_data/distro/distro.zip b/testing/data/test3/output_data/distro/distro.zip
index ec45f61..3c1e3a2 100644
--- a/testing/data/test3/output_data/distro/distro.zip
+++ b/testing/data/test3/output_data/distro/distro.zip
Binary files differ
diff --git a/testing/data/test3/output_data/iana/tzdata b/testing/data/test3/output_data/iana/tzdata
index badbbc5..e60fb5e 100644
--- a/testing/data/test3/output_data/iana/tzdata
+++ b/testing/data/test3/output_data/iana/tzdata
Binary files differ
diff --git a/testing/src/main/java/libcore/timezone/testing/ZoneInfoTestHelper.java b/testing/src/main/java/libcore/timezone/testing/ZoneInfoTestHelper.java
index 20b86b0..aa1c253 100644
--- a/testing/src/main/java/libcore/timezone/testing/ZoneInfoTestHelper.java
+++ b/testing/src/main/java/libcore/timezone/testing/ZoneInfoTestHelper.java
@@ -222,10 +222,8 @@
// A list is used in preference to a Map to allow simulation of badly ordered / duplicate
// IDs.
private List<ZicDatum> zicData = new ArrayList<>();
- private String zoneTab;
private Integer indexOffsetOverride;
private Integer dataOffsetOverride;
- private Integer zoneTabOffsetOverride;
private Integer finalOffsetOverride;
public TzDataBuilder() {}
@@ -246,11 +244,6 @@
return this;
}
- public TzDataBuilder setZoneTabOffsetOverride(int zoneTabOffset) {
- this.zoneTabOffsetOverride = zoneTabOffset;
- return this;
- }
-
public TzDataBuilder setFinalOffsetOverride(int finalOffset) {
this.finalOffsetOverride = finalOffset;
return this;
@@ -265,15 +258,9 @@
return this;
}
- public TzDataBuilder setZoneTab(String zoneTab) {
- this.zoneTab = zoneTab;
- return this;
- }
-
public TzDataBuilder initializeToValid() {
setHeaderMagic("tzdata9999a");
addZicData("Europe/Elbonia", new ZicDataBuilder().initializeToValid().build());
- setZoneTab("ZoneTab data");
return this;
}
@@ -294,8 +281,6 @@
writeInt(baos, 0);
int dataOffsetOffset = baos.size();
writeInt(baos, 0);
- int zoneTabOffsetOffset = baos.size();
- writeInt(baos, 0);
int finalOffsetOffset = baos.size();
writeInt(baos, 0);
@@ -331,11 +316,6 @@
int dataOffset = baos.size();
writeByteArray(baos, dataBytes.toByteArray());
- // Write the zoneTab section.
- int zoneTabOffset = baos.size();
- byte[] zoneTabBytes = zoneTab.getBytes(StandardCharsets.US_ASCII);
- writeByteArray(baos, zoneTabBytes);
-
int finalOffset = baos.size();
byte[] bytes = baos.toByteArray();
@@ -343,8 +323,6 @@
indexOffsetOverride != null ? indexOffsetOverride : indexOffset);
setInt(bytes, dataOffsetOffset,
dataOffsetOverride != null ? dataOffsetOverride : dataOffset);
- setInt(bytes, zoneTabOffsetOffset,
- zoneTabOffsetOverride != null ? zoneTabOffsetOverride : zoneTabOffset);
setInt(bytes, finalOffsetOffset,
finalOffsetOverride != null ? finalOffsetOverride : finalOffset);
return bytes;
diff --git a/update-tzdata.py b/update-tzdata.py
index 9a9bd2f..f914719 100755
--- a/update-tzdata.py
+++ b/update-tzdata.py
@@ -181,14 +181,13 @@
tzdatautil.InvokeSoong(android_build_top, ['zone_compactor'])
# Create args for ZoneCompactor
- zone_tab_file = '%s/zone.tab' % extracted_iana_data_dir
header_string = 'tzdata%s' % iana_data_version
print('Executing ZoneCompactor...')
command = '%s/bin/zone_compactor' % android_host_out
iana_output_data_dir = '%s/iana' % timezone_output_data_dir
- subprocess.check_call([command, zone_compactor_setup_file, zic_output_dir, zone_tab_file,
- iana_output_data_dir, header_string])
+ subprocess.check_call([command, zone_compactor_setup_file, zic_output_dir, iana_output_data_dir,
+ header_string])
def BuildTzlookup(iana_data_dir):