All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] support/download/svn: fix date format for archive creation
Date: Mon, 22 Feb 2021 11:58:21 +0100	[thread overview]
Message-ID: <4cba7ba3-06c7-b45b-81c8-4746bcee2bcf@mind.be> (raw)
In-Reply-To: <20210220095148.GI2276@scaer>



On 20/02/2021 10:51, Yann E. MORIN wrote:
> Vincent, All,
> 
> Arnout, question for you toward the end...
> 
> On 2021-02-19 15:21 -0600, Vincent Fazio spake thusly:
>> Previously we would use the date provided by:
>> `svn info --show-item last-changed-date ...`
>>
>> The date returned from this command could include sub-second precision
>> which is not compatible with the PAX options we specify to GNU tar.
>>
>> Now the returned date is massaged to drop the sub-seconds.
>>
>> Signed-off-by: Vincent Fazio <vfazio@xes-inc.com>
> 
> Thank you for spinning this one right before you sprung on the train to
> your holidays!
> 
>> ---
>>  support/download/svn | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/support/download/svn b/support/download/svn
>> index 839dccaf62..ea1032267f 100755
>> --- a/support/download/svn
>> +++ b/support/download/svn
>> @@ -52,6 +52,9 @@ _svn export ${verbose} "${@}" "'${uri}@${rev}'" "'${basename}'"
>>  # last line (svn outputs everything on stdout)
>>  date="$( _svn info --show-item last-changed-date "'${uri}@${rev}'" |tail -n 1 )"
>>  
>> +# Drop sub-second precision to play nice with GNU tar's valid_timespec check
>> +date="$( date -d "${date}" -uIseconds )"
> 
> So, I did some checks about when 'date -d' learnt to deal with
> sub-second precision. Not sure when, but it is suported in all the
> major distributions still maintained (centos 7, debian jessie, ubuntu
> trusty), while it was not in some earlier versions (centos 6, debian
> squeeze).

A much simpler solution is

date="$( date -d "${date}" -u +%Y-%m-%dT%T%:z )"

which is fully portable over any POSIX-compliant version of date.

> 
> So that's fine for me.
> 
> But I wonder whether this should be svn-specific, or whether we should
> move it into the generic herlper mk_tar_gz()... Arnout, thoughts?

 I would expect any sane VCS to be able to show the last change date in ISO 8601
format - I'd hope that SVN is the exception rather than the rule...

 Regards,
 Arnout

> 
> Regards,
> Yann E. MORIN.
> 
>>  # Generate the archive.
>>  # We did a 'svn export' above, so it's not a working copy (there is no .svn
>>  # directory or file to ignore).
>> -- 
>> 2.30.0
>>
> 

  reply	other threads:[~2021-02-22 10:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-19 21:21 [Buildroot] [PATCH] support/download/svn: fix date format for archive creation Vincent Fazio
2021-02-20  9:51 ` Yann E. MORIN
2021-02-22 10:58   ` Arnout Vandecappelle [this message]
2021-02-22 18:28     ` Yann E. MORIN
2021-02-22 20:14       ` Yann E. MORIN
2021-02-22 22:06 ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4cba7ba3-06c7-b45b-81c8-4746bcee2bcf@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.