[tz] Programmatic way of determining the latest release number?

Brian Inglis Brian.Inglis at systematicsw.ab.ca
Sat Apr 30 19:11:00 UTC 2016

On 2016-04-30 01:39, Jon Skeet wrote:
> I'm aware of the ability to use
> ftp://ftp.iana.org/tz/tzcode-latest.tar.gz and the similar data URL
> to get the latest actual files, but is there a URL which either
> serves an HTTP redirect to the latest version, or gives the latest
> version number in some other easily-retrievable machine-readable
> format?  
> I could parse the content of http://www.iana.org/time-zones, but that
> doesn't feel like a very robust approach :)>
> Presumably this might all drop out of the tzdist work, but I was
> wondering whether there was a low-tech way at the moment.

Wget allows you to download synlinks verbatim with option
--retr-symlinks=no which gets the symlinks themselves, whereas
--retr-symlinks[=yes] gets the files pointed to the symlinks.

Extract from daily tz download check job:


# get remote links to latest releases
wget -qN --retr-symlinks=no $site/$cl $site/$dl

# if links get remote names from link contents
[ -L "$cl" -a -L "$dl" ]	&& \
     rca=$(readlink $cl)		&& \
     rda=$(readlink $dl)		&& \

Symlinks contain/point to 'releases/tzcode2016d.tar.gz' and
'releases/tzdata2016d.tar.gz' currently.
You can then extract the releases from these linsk and compare
against previous/current code/data Makefile lines starting
/^VERSION=/ using your favourite tools and decide whether to
download the actual files pointed to by the links and their
.asc signatures, for gpg verification against Paul's trusted
key ED97E90E62AA7E34 which I dug up from somewhere.

HTTP server redirects are transparent to wget but are available
from curl.
By default curl displays the HTTP server 30# redirect error code
and message, including HSTS redirections from http: to https: pages.
Specifying option -w redirect_url shows the redirect URL and
option -L follows the redirect to get the file.

HTML "redirects" can also be performed by tags like:
<meta http-equiv="refresh" content="0;..."> and full screen iframes:
<iframe src="..." frameborder="0" allowtransparency="true"
seamless="seamless" scrolling="auto" allowfullscreen="true">
which may have to be dealt with programmatically.

Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

More information about the tz mailing list