* commit 'db71c2f3d22140cb2685362c35d93c374a621b7c': Fix tzdata update tools for 'backzone'.
This commit is contained in:
		@@ -132,9 +132,15 @@ public class ZoneCompactor {
 | 
				
			|||||||
        throw new RuntimeException("zone filename too long: " + zoneName.length());
 | 
					        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.write(toAscii(new byte[MAXNAME], zoneName));
 | 
				
			||||||
      f.writeInt(offsets.get(zoneName));
 | 
					      f.writeInt(offsets.get(actualZoneName));
 | 
				
			||||||
      f.writeInt(lengths.get(zoneName));
 | 
					      f.writeInt(lengths.get(actualZoneName));
 | 
				
			||||||
      f.writeInt(0); // Used to be raw GMT offset. No longer used.
 | 
					      f.writeInt(0); // Used to be raw GMT offset. No longer used.
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,8 +13,11 @@ import sys
 | 
				
			|||||||
import tarfile
 | 
					import tarfile
 | 
				
			||||||
import tempfile
 | 
					import tempfile
 | 
				
			||||||
 | 
					
 | 
				
			||||||
regions = ['africa', 'antarctica', 'asia', 'australasia', 'backward',
 | 
					regions = ['africa', 'antarctica', 'asia', 'australasia',
 | 
				
			||||||
           'etcetera', 'europe', 'northamerica', 'southamerica']
 | 
					           'etcetera', 'europe', 'northamerica', 'southamerica',
 | 
				
			||||||
 | 
					           # These two deliberately come last so they override what came
 | 
				
			||||||
 | 
					           # before (and each other).
 | 
				
			||||||
 | 
					           'backward', 'backzone' ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def CheckDirExists(dir, dirname):
 | 
					def CheckDirExists(dir, dirname):
 | 
				
			||||||
  if not os.path.isdir(dir):
 | 
					  if not os.path.isdir(dir):
 | 
				
			||||||
@@ -49,16 +52,16 @@ def WriteSetupFile():
 | 
				
			|||||||
      fields = line.split()
 | 
					      fields = line.split()
 | 
				
			||||||
      if fields:
 | 
					      if fields:
 | 
				
			||||||
        if fields[0] == 'Link':
 | 
					        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])
 | 
					          zones.append(fields[2])
 | 
				
			||||||
        elif fields[0] == 'Zone':
 | 
					        elif fields[0] == 'Zone':
 | 
				
			||||||
          zones.append(fields[1])
 | 
					          zones.append(fields[1])
 | 
				
			||||||
  zones.sort()
 | 
					  zones.sort()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  setup = open('setup', 'w')
 | 
					  setup = open('setup', 'w')
 | 
				
			||||||
  for link in links:
 | 
					  for link in sorted(set(links)):
 | 
				
			||||||
    setup.write(link)
 | 
					    setup.write('%s\n' % link)
 | 
				
			||||||
  for zone in zones:
 | 
					  for zone in sorted(set(zones)):
 | 
				
			||||||
    setup.write('%s\n' % zone)
 | 
					    setup.write('%s\n' % zone)
 | 
				
			||||||
  setup.close()
 | 
					  setup.close()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -165,9 +168,10 @@ def BuildBionicToolsAndData(data_filename):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  print 'Calling zic(1)...'
 | 
					  print 'Calling zic(1)...'
 | 
				
			||||||
  os.mkdir('data')
 | 
					  os.mkdir('data')
 | 
				
			||||||
  for region in regions:
 | 
					  zic_inputs = [ 'extracted/%s' % x for x in regions ]
 | 
				
			||||||
    if region != 'backward':
 | 
					  zic_cmd = ['zic', '-d', 'data' ]
 | 
				
			||||||
      subprocess.check_call(['zic', '-d', 'data', 'extracted/%s' % region])
 | 
					  zic_cmd.extend(zic_inputs)
 | 
				
			||||||
 | 
					  subprocess.check_call(zic_cmd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  WriteSetupFile()
 | 
					  WriteSetupFile()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user