[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Identify snapshot based on Release file Date:



On Mon, Aug 15, 2016 at 5:34 AM, Yaroslav Halchenko wrote:

> I wondered if there is a quick "ready" way to given a datetime from the
> Release file, to jump to the snapshot which would include that
> Release file.

The Date field from the Release files is not imported into the database AFAICT.

> Assuming that everything is nicely in sync, it should be the snapshot
> NEXT after the one snapshot.d.o would redirect me to if I simply enter
> that date in url, since it would "round down". E.g. if I have Release
> file from
> http://snapshot.debian.org/archive/debian/20091002T164800Z/dists/sid/
> which contains date
> Fri, 02 Oct 2009 15:22:39 UTC ==  20091002T112239Z, so if I go to

I think you made a typo there? s/T11/T15

> http://snapshot.debian.org/archive/debian/20091002T112239Z/
> I would be redirected to snapshot "before" that Release file datetime:
> http://snapshot.debian.org/archive/debian/20091002T105946Z/

That particular redirect is already in place AFAICT:

$ HEAD -S http://snapshot.debian.org/archive/debian/20091002T112239Z/ | head -n4
HEAD http://snapshot.debian.org/archive/debian/20091002T112239Z/
301 Moved Permanently
HEAD http://snapshot.debian.org/archive/debian/20091002T105946Z/
200 OK

Fixing your typo gets a redirect to the same location:

$ HEAD -S http://snapshot.debian.org/archive/debian/20091002T152239Z/dists/sid/
| head -n4
HEAD http://snapshot.debian.org/archive/debian/20091002T152239Z/dists/sid/
301 Moved Permanently
HEAD http://snapshot.debian.org/archive/debian/20091002T105946Z/dists/sid/
200 OK

Both the typo and the correct URL get the previous date:

$ GET http://snapshot.debian.org/archive/debian/20091002T152239Z/dists/sid/Release
| grep Date
Date: Fri, 02 Oct 2009 09:17:29 UTC
$ GET http://snapshot.debian.org/archive/debian/20091002T112239Z/dists/sid/Release
| grep Date
Date: Fri, 02 Oct 2009 09:17:29 UTC

The best you can currently get is to add two hours on to the time:

$ GET http://snapshot.debian.org/archive/debian/20091002T172239Z/dists/sid/Release
| grep Date
Date: Fri, 02 Oct 2009 15:22:39 UTC
$ HEAD -S http://snapshot.debian.org/archive/debian/20091002T172239Z/dists/sid/
| head -n4
HEAD http://snapshot.debian.org/archive/debian/20091002T172239Z/dists/sid/
301 Moved Permanently
HEAD http://snapshot.debian.org/archive/debian/20091002T164800Z/dists/sid/
200 OK

Or maybe parse the HTML:

$ GET http://snapshot.debian.org/archive/debian/20091002T152239Z/dists/sid/
| grep -i 'next'
        <acronym title="2009-10-02 16:48:00"><a
href="/archive/debian/20091002T164800Z/dists/sid/">next</a></acronym>
            <acronym title="2009-10-02 16:48:00"><a
href="/archive/debian/20091002T164800Z/dists/sid/">next
change</a></acronym>

> So I wondered if there is any client API (i.e. without looking to the
> DB, or scraping dates/urls from month(s) views) to jump to the
> "rounded up/ceiling" snapshot, not down?  or may be just to the 'next'
> from the current one?

There isn't an API for that yet:

https://anonscm.debian.org/cgit/mirror/snapshot.debian.org.git/plain/API

-- 
bye,
pabs

https://wiki.debian.org/PaulWise


Reply to: