Purge two old time-zone lookup fallbacks

We used to need to consult /etc/timezone for the zone name back when
Debian, up to Jessie, used a copy of the zoneinfo file as
/etc/localtime, instead of a symlink.  Jessie's end of life is this
May, but Thiago reports that its gcc can't build Qt 5.14, so we may as
well remove this fall-back.  Newer versions of Debian use a symlink.

We used to need to consult /etc/sysconfig/clock for this information
back when ancient Red Hat distros copied zoneinfo to /etc/localtime
instead of symlinking, but Thiago believes that's now ancient history.
So, again, remove this old fallback.

Change-Id: I73cb40b926186b311dac6f00fe8743d37a9dfce5
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2020-04-06 15:01:06 +02:00
parent b40ac4b858
commit b0383cbd38

View File

@ -1153,29 +1153,6 @@ QByteArray QTzTimeZonePrivate::systemTimeZoneId() const
}
}
// On Debian Etch up to Jessie, /etc/localtime is a copy of the relevant
// zoneinfo file, whose name is recorded in /etc/timezone:
if (ianaId.isEmpty()) {
QFile tzif(QStringLiteral("/etc/timezone"));
if (tzif.open(QIODevice::ReadOnly))
ianaId = tzif.readAll().trimmed();
}
// On some Red Hat distros /etc/localtime is real file with name held in /etc/sysconfig/clock
// in a line like ZONE="Europe/Oslo" or TIMEZONE="Europe/Oslo"
if (ianaId.isEmpty()) {
QFile tzif(QStringLiteral("/etc/sysconfig/clock"));
if (tzif.open(QIODevice::ReadOnly)) {
while (ianaId.isEmpty() && !tzif.atEnd()) {
const QByteArray line(tzif.readLine().trimmed());
if (line.startsWith("ZONE="))
ianaId = line.mid(6, line.length() - 7);
else if (line.startsWith("TIMEZONE="))
ianaId = line.mid(10, line.length() - 11);
}
}
}
// Some systems (e.g. uClibc) have a default value for $TZ in /etc/TZ:
if (ianaId.isEmpty()) {
QFile zone(QStringLiteral("/etc/TZ"));