[buildd-tools-devel] Bug#834736: Bug#834736: sbuild: Use basic format for ISO 8601 timestamps (for build logs filenames)

Santiago Vila sanvila at unex.es
Fri Aug 19 09:20:45 UTC 2016


retitle 834736 sbuild: Being able to choose format for build log filenames
thanks

On Fri, 19 Aug 2016, Johannes Schauer wrote:

> Hi,
> 
> Quoting Santiago Vila (2016-08-18 19:31:30)
> > Try doing that in standard AWK without those fancy time-handling functions
> > :-)
> > 
> > For the basic format it would be something like this:
> > 
> > date=substr(stamp,1,8)
> > time=substr(stamp,10,6)
> > 
> > I leave the extended format as an exercise for the reader.
> 
> challenge accepted! To parse the current format just with shell tool, you would
> do:
> 
> 	TZ=0 date -d'2016-08-18T17:09:36Z' +%s
> 
> You are welcome.

Fine, but I said AWK. It would be something like this:

  date = substr(stamp,1,4) substr(stamp,6,2) substr(stamp,9,2)
  time = substr(stamp,12,2) substr(stamp,15,2) substr(stamp,18,2)

I have thousands of build logs. If I have to invoke the "date" command
for each one of them, the whole thing is going to be very slow.

Anyway, I'm changing the title to something which I believe it is more
generic and realistic.

Suppose that I have more than 38000 build logs already (this is really
the truth), and the new logs that are generated have a different
format. Suppose that for convenience I would like to keep using the
old format so that I don't have a mix of old and new formats.

How would I modify sbuild for that?

By looking at the source, it seems that this is decided in line 2 of
open_build_log function in lib/Sbuild/Build.pm, which reads like this:

  my $date = strftime_c "%FT%TZ", gmtime($self->get('Pkg Start Time'));


So: Instead of harcoding the timestamp format, would not be possible
to just make "%FT%TZ" the default value for a variable that could be
changed in .sbuildrc?

> [...]
> Why does the colon have to be escaped?

You are right, it does not have to be escaped, I was just confused
about the fact that bash escapes it when I use tab for completing
the filename.

> [...]
> > In either case: Nobody asked for a way to specify the filename format in a
> > flexible way?
> 
> Correct, nobody did.

Well, maybe because the previous format was ok for almost everybody.
Now that you changed it, I guess somebody had to be the first one to ask
for this to be customizable.

Thanks.



More information about the Buildd-tools-devel mailing list