[PATCH] makepkg: use localized date strings

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] makepkg: use localized date strings

Chi Hsuan Yen
From: Yen Chi Hsuan <[hidden email]>

Before this change, LC_TIME=zh_TW.UTF-8 makepkg has the following line:

==> Making package: foobar 1-1 (日  2月 11 01:13:42 CST 2018)

With this patch, this line becomes:

==> Making package: foobar 1-1 (西元2018年02月11日 (週日) 01時13分57秒)

The latter is more natural for a Chinese native speaker.

Signed-off-by: Chih-Hsuan Yen <[hidden email]>
---
 scripts/makepkg.sh.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 63b6c3e1..5e3af337 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1569,7 +1569,7 @@ if (( INFAKEROOT )); then
  exit $E_OK
 fi
 
-msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date))"
+msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date +%c))"
 
 # if we are creating a source-only package, go no further
 if (( SOURCEONLY )); then
@@ -1597,7 +1597,7 @@ if (( SOURCEONLY )); then
  msg "$(gettext "Signing package...")"
  create_signature "$SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT}"
 
- msg "$(gettext "Source package created: %s")" "$pkgbase ($(date))"
+ msg "$(gettext "Source package created: %s")" "$pkgbase ($(date +%c))"
  exit $E_OK
 fi
 
@@ -1703,7 +1703,7 @@ if (( NOARCHIVE )); then
  exit $E_OK
 fi
 
-msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date))"
+msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date +%c))"
 
 install_package && exit $E_OK || exit $E_INSTALL_FAILED
 
--
2.16.1
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] makepkg: use localized date strings

Chi Hsuan Yen
Hello,

Does this patch requires more work? Or I was doing something wrong in
submitting patches? I'll be grateful for any further feedback.

Best Regards,

Chih-Hsuan Yen

2018-02-11 1:27 GMT+08:00 Chih-Hsuan Yen <[hidden email]>:

> From: Yen Chi Hsuan <[hidden email]>
>
> Before this change, LC_TIME=zh_TW.UTF-8 makepkg has the following line:
>
> ==> Making package: foobar 1-1 (日  2月 11 01:13:42 CST 2018)
>
> With this patch, this line becomes:
>
> ==> Making package: foobar 1-1 (西元2018年02月11日 (週日) 01時13分57秒)
>
> The latter is more natural for a Chinese native speaker.
>
> Signed-off-by: Chih-Hsuan Yen <[hidden email]>
> ---
>  scripts/makepkg.sh.in | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 63b6c3e1..5e3af337 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -1569,7 +1569,7 @@ if (( INFAKEROOT )); then
>         exit $E_OK
>  fi
>
> -msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date))"
> +msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date +%c))"
>
>  # if we are creating a source-only package, go no further
>  if (( SOURCEONLY )); then
> @@ -1597,7 +1597,7 @@ if (( SOURCEONLY )); then
>         msg "$(gettext "Signing package...")"
>         create_signature "$SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT}"
>
> -       msg "$(gettext "Source package created: %s")" "$pkgbase ($(date))"
> +       msg "$(gettext "Source package created: %s")" "$pkgbase ($(date +%c))"
>         exit $E_OK
>  fi
>
> @@ -1703,7 +1703,7 @@ if (( NOARCHIVE )); then
>         exit $E_OK
>  fi
>
> -msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date))"
> +msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date +%c))"
>
>  install_package && exit $E_OK || exit $E_INSTALL_FAILED
>
> --
> 2.16.1
>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] makepkg: use localized date strings

Silvan Jegen
Hi

On Wed, Mar 7, 2018 at 5:03 AM, Chih-Hsuan Yen <[hidden email]> wrote:
> Does this patch requires more work? Or I was doing something wrong in
> submitting patches? I'll be grateful for any further feedback.

It seems like a reasonable change to me but I am a little bit worried
about it because it will change the formatting of the printed time for
all users. It also depends on the locale the user has set so it may
result in issues if people have not set up their locale properly.

Lastly I am also not sure if the +%c formatting option is supported on
all Unix-like platforms. On FreeBSD that option does seem to be
supported: https://www.freebsd.org/cgi/man.cgi?date &&
https://www.freebsd.org/cgi/man.cgi?query=strftime&sektion=3&apropos=0&manpath=FreeBSD+11.1-RELEASE+and+Ports
but I don't know about other BSDs, Darwin, ...


Cheers,

Silvan


>
> Best Regards,
>
> Chih-Hsuan Yen
>
> 2018-02-11 1:27 GMT+08:00 Chih-Hsuan Yen <[hidden email]>:
>> From: Yen Chi Hsuan <[hidden email]>
>>
>> Before this change, LC_TIME=zh_TW.UTF-8 makepkg has the following line:
>>
>> ==> Making package: foobar 1-1 (日  2月 11 01:13:42 CST 2018)
>>
>> With this patch, this line becomes:
>>
>> ==> Making package: foobar 1-1 (西元2018年02月11日 (週日) 01時13分57秒)
>>
>> The latter is more natural for a Chinese native speaker.
>>
>> Signed-off-by: Chih-Hsuan Yen <[hidden email]>
>> ---
>>  scripts/makepkg.sh.in | 6 +++---
>>  1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
>> index 63b6c3e1..5e3af337 100644
>> --- a/scripts/makepkg.sh.in
>> +++ b/scripts/makepkg.sh.in
>> @@ -1569,7 +1569,7 @@ if (( INFAKEROOT )); then
>>         exit $E_OK
>>  fi
>>
>> -msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date))"
>> +msg "$(gettext "Making package: %s")" "$pkgbase $basever ($(date +%c))"
>>
>>  # if we are creating a source-only package, go no further
>>  if (( SOURCEONLY )); then
>> @@ -1597,7 +1597,7 @@ if (( SOURCEONLY )); then
>>         msg "$(gettext "Signing package...")"
>>         create_signature "$SRCPKGDEST/${pkgbase}-${fullver}${SRCEXT}"
>>
>> -       msg "$(gettext "Source package created: %s")" "$pkgbase ($(date))"
>> +       msg "$(gettext "Source package created: %s")" "$pkgbase ($(date +%c))"
>>         exit $E_OK
>>  fi
>>
>> @@ -1703,7 +1703,7 @@ if (( NOARCHIVE )); then
>>         exit $E_OK
>>  fi
>>
>> -msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date))"
>> +msg "$(gettext "Finished making: %s")" "$pkgbase $basever ($(date +%c))"
>>
>>  install_package && exit $E_OK || exit $E_INSTALL_FAILED
>>
>> --
>> 2.16.1
>>
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] makepkg: use localized date strings

Allan McRae
On 07/03/18 17:56, Silvan Jegen wrote:
> On FreeBSD that option does seem to be
> supported: https://www.freebsd.org/cgi/man.cgi?date

Right on the page you linked...
     %c   is replaced by national representation of time and date.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] makepkg: use localized date strings

Allan McRae
In reply to this post by Chi Hsuan Yen
On 07/03/18 14:03, Chih-Hsuan Yen wrote:
> Hello,
>
> Does this patch requires more work? Or I was doing something wrong in
> submitting patches? I'll be grateful for any further feedback.
>

The patch looks fine.   I have not had time to do a patch round up the
last month so patches are just sitting in my todo list currently.  My
time should free up again next week (maybe...  I will be travelling).

A
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] makepkg: use localized date strings

Silvan Jegen
In reply to this post by Allan McRae
On Wed, Mar 7, 2018 at 11:09 AM, Allan McRae <[hidden email]> wrote:
> On 07/03/18 17:56, Silvan Jegen wrote:
>> On FreeBSD that option does seem to be
>> supported: https://www.freebsd.org/cgi/man.cgi?date
>
> Right on the page you linked...
>      %c    is replaced by national representation of time and date.

Yes, that's why I linked it. I am not sure if it's supported on the
other BSDs and/or MacOSX though, that is what I was trying to say. If
all BSDs use the same version of date(1) then I assume adding this
option is probably fine.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] makepkg: use localized date strings

Andrew Gregory
On 03/07/18 at 02:30pm, Silvan Jegen wrote:

> On Wed, Mar 7, 2018 at 11:09 AM, Allan McRae <[hidden email]> wrote:
> > On 07/03/18 17:56, Silvan Jegen wrote:
> >> On FreeBSD that option does seem to be
> >> supported: https://www.freebsd.org/cgi/man.cgi?date
> >
> > Right on the page you linked...
> >      %c    is replaced by national representation of time and date.
>
> Yes, that's why I linked it. I am not sure if it's supported on the
> other BSDs and/or MacOSX though, that is what I was trying to say. If
> all BSDs use the same version of date(1) then I assume adding this
> option is probably fine.

%c is specified by POSIX
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] makepkg: use localized date strings

Silvan Jegen
On Wed, Mar 7, 2018 at 2:50 PM, Andrew Gregory
<[hidden email]> wrote:

> On 03/07/18 at 02:30pm, Silvan Jegen wrote:
>> On Wed, Mar 7, 2018 at 11:09 AM, Allan McRae <[hidden email]> wrote:
>> > On 07/03/18 17:56, Silvan Jegen wrote:
>> >> On FreeBSD that option does seem to be
>> >> supported: https://www.freebsd.org/cgi/man.cgi?date
>> >
>> > Right on the page you linked...
>> >      %c    is replaced by national representation of time and date.
>>
>> Yes, that's why I linked it. I am not sure if it's supported on the
>> other BSDs and/or MacOSX though, that is what I was trying to say. If
>> all BSDs use the same version of date(1) then I assume adding this
>> option is probably fine.
>
> %c is specified by POSIX

I was hoping for the man page to mention that this formatting option
is POSIX but I didn't.

If it's POSIX then this change should be ok. The formatting of the
date command will change for a lot of users but I assume that should
be fine.
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] makepkg: use localized date strings

Chi Hsuan Yen
2018-03-07 23:17 GMT+08:00 Silvan Jegen <[hidden email]>:

> On Wed, Mar 7, 2018 at 2:50 PM, Andrew Gregory
> <[hidden email]> wrote:
>> On 03/07/18 at 02:30pm, Silvan Jegen wrote:
>>> On Wed, Mar 7, 2018 at 11:09 AM, Allan McRae <[hidden email]> wrote:
>>> > On 07/03/18 17:56, Silvan Jegen wrote:
>>> >> On FreeBSD that option does seem to be
>>> >> supported: https://www.freebsd.org/cgi/man.cgi?date
>>> >
>>> > Right on the page you linked...
>>> >      %c    is replaced by national representation of time and date.
>>>
>>> Yes, that's why I linked it. I am not sure if it's supported on the
>>> other BSDs and/or MacOSX though, that is what I was trying to say. If
>>> all BSDs use the same version of date(1) then I assume adding this
>>> option is probably fine.
>>
>> %c is specified by POSIX
>
> I was hoping for the man page to mention that this formatting option
> is POSIX but I didn't.
>
> If it's POSIX then this change should be ok. The formatting of the
> date command will change for a lot of users but I assume that should
> be fine.

Looks like %c is specified in POSIX.1-2008 [1]:

%c    Locale's appropriate date and time representation.

[1] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] makepkg: use localized date strings

Allan McRae
In reply to this post by Chi Hsuan Yen
On 11/02/18 03:27, Chih-Hsuan Yen wrote:

> From: Yen Chi Hsuan <[hidden email]>
>
> Before this change, LC_TIME=zh_TW.UTF-8 makepkg has the following line:
>
> ==> Making package: foobar 1-1 (日  2月 11 01:13:42 CST 2018)
>
> With this patch, this line becomes:
>
> ==> Making package: foobar 1-1 (西元2018年02月11日 (週日) 01時13分57秒)
>
> The latter is more natural for a Chinese native speaker.
>

Applied - Thanks,
A