mbox series

[bug#49042,0/2] WIP gnu: Add ruby-taskjuggler.

Message ID 87lf7bnpj3.fsf@xelera.eu
Headers show
Series WIP gnu: Add ruby-taskjuggler. | expand

Message

Giovanni Biscuolo June 15, 2021, 2:40 p.m. UTC
Hello,

First, ruby-taskjuggler needs ruby-term-ansicolor version 1.7.1 or above (43
dependent packages rebuilds).

This is the new package ruby-taskjuggler but still have an issue I'm not able
to fix.

The package is succesfully built, tests included (except the removed one) but
if I run the program with the tutorial example file provided upstream [1] I
get this result:

--8<---------------cut here---------------start------------->8---

giovanni@roquette: tj3 -o tutorial tutorial.tjp 
TaskJuggler v3.7.1 - A Project Management Software

Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
              by Chris Schlaeger <cs@taskjuggler.org>

This program is free software; you can redistribute it and/or modify it under
the terms of version 2 of the GNU General Public License as published by the
Free Software Foundation.

tutorial.tjp:11: Error: Europe/Paris is not a known time zone
  timezone "Europe/Paris"

--8<---------------cut here---------------end--------------->8---

The strange thing is that timezones are tested at build (check) time but they
seems missing at runtime.

Please any hint on what I'm doing wrong?

I would like to fix this before merging to master.

Best regards, Giovanni

[1] https://taskjuggler.org/tj3/examples/Tutorial/tutorial.tjp

Giovanni Biscuolo (2):
  gnu: ruby-term-ansicolor: Update to 1.7.1.
  gnu: Add ruby-taskjuggler.

 gnu/packages/ruby.scm | 58 +++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 56 insertions(+), 2 deletions(-)

Comments

Giovanni Biscuolo June 16, 2021, 9:04 a.m. UTC | #1
Hello,

a couple more info on this WIP of mine.

Giovanni Biscuolo <g@xelera.eu> writes:

[...]

> --8<---------------cut here---------------start------------->8---
>
> giovanni@roquette: tj3 -o tutorial tutorial.tjp 
> TaskJuggler v3.7.1 - A Project Management Software
>
> Copyright (c) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020
>               by Chris Schlaeger <cs@taskjuggler.org>
>
> This program is free software; you can redistribute it and/or modify it under
> the terms of version 2 of the GNU General Public License as published by the
> Free Software Foundation.
>
> tutorial.tjp:11: Error: Europe/Paris is not a known time zone
>   timezone "Europe/Paris"
>
> --8<---------------cut here---------------end--------------->8---

I forgot to mention that I'm installing ruby-taskjuggler in my default
profile with "./pre-inst-env guix install ruby-taskjuggler".

I'm on a foreign distro and if I run the program this way:

 TZDIR=/usr/share/zoneinfo tj3 -o tutorial tutorial.tjp 

all is fine.

Anyway: "tzdata" from Guix is not installed AFAIU:

--8<---------------cut here---------------start------------->8---

giovanni@roquette: find /gnu/store -type d -iname 'tzdata'
/gnu/store/9jznxb2f5s46yr8fmppigiad0fyh4b4p-tcl-8.6.10/lib/tcl8.6/tzdata

--8<---------------cut here---------------end--------------->8---

and also TZDIR is not in the search paths of my profile:

--8<---------------cut here---------------start------------->8---
giovanni@roquette: guix package --search-paths -p "/home/giovanni/.guix-profile"
export PATH="/home/giovanni/.guix-profile/bin:/home/giovanni/.guix-profile/sbin"
export GUIX_GTK3_PATH="/home/giovanni/.guix-profile/lib/gtk-3.0"
export GI_TYPELIB_PATH="/home/giovanni/.guix-profile/lib/girepository-1.0"
export XDG_DATA_DIRS="/home/giovanni/.guix-profile/share"
export CHROMIUM_EXTENSION_DIRECTORY="/home/giovanni/.guix-profile/share/chromium/extensions"
export GIT_SSL_CAINFO="/home/giovanni/.guix-profile/etc/ssl/certs/ca-certificates.crt"
export GIT_EXEC_PATH="/home/giovanni/.guix-profile/libexec/git-core"
--8<---------------cut here---------------end--------------->8---

So the issue is: I'm not able to package so that inputs are properly installed
and env is properly set :-(

I've searched other guix packages to see how they handle tzdata
dependency but I'm not able to find what I'm doing wrong: any hint
please?

Thanks! Giovanni.
M June 16, 2021, 9:17 a.m. UTC | #2
Giovanni Biscuolo schreef op di 15-06-2021 om 16:40 [+0200]:
> tutorial.tjp:11: Error: Europe/Paris is not a known time zone
>   timezone "Europe/Paris"
> 
> --8<---------------cut here---------------end--------------->8---
> 
> The strange thing is that timezones are tested at build (check) time but they
> seems missing at runtime.

Not weird at all. I see you put "tzdata" in 'inputs', not 'propagated-inputs'.

When installing ruby-taskjuggler in a profile (or using guix environment --ad-hoc),
guix will only install ruby-taskjuggler. "tzdata" won't be automagically installed
too. If you want to automagically install "tzdata", there are two options:

  * move "tzdata" to propagated-inputs
  * wrap tj3 (e.g. using wrap-program from (guix build utils)) to
    set TZDIR to (string-append (assoc-ref inputs "tzdata") "/share/zoneinfo")

Both options are not recommended, because "tzdata" frequently needs to be updated
and therefore, if packages used "tzdata" as input, there would be plenty of rebuilds
each time. When "tzdata" is used for tests, use the less-frequently updated tzdata-for-tests
instead.

The solution is to install "tzdata" separately. A user could do this with
"guix package -i tzdata". However, normally the operating system would provide
a time zone database of its own and initialise TZDIR to something reasonable.

E.g., on Guix System, 'operating-system-environment-variables' in (gnu system)
will initialise TZDIR, SSL_CERT_DIR and GIT_SSL_CAINFO to something reasonable
(though the user can override these defaults with "guix package -i tzdata".)

What operating system are you on, and what output do you get if you run
"echo $TZDIR"?

Greetings,
Maxime.
Giovanni Biscuolo June 16, 2021, 9:42 a.m. UTC | #3
Hello,

Giovanni Biscuolo <g@xelera.eu> writes:

[...]

> I'm on a foreign distro and if I run the program this way:
>
>  TZDIR=/usr/share/zoneinfo tj3 -o tutorial tutorial.tjp 
>
> all is fine.

I just found the related bug #36870 [1] and as the original reporter I'm
incorrectly assuming Guix packages are using Guix timezone package (when
set as package input) on foreign distro also.

Mark H Weaver wrote:

--8<---------------cut here---------------start------------->8---

  On Guix systems, /etc/environment includes an entry that sets TZDIR to
  the equivalent of "$(guix build tzdata)/share/zoneinfo".

  When using Guix on top of another distro, an alternative choice might be
  to set TZDIR to "/usr/share/zoneinfo".  I'm not sure which setting is
  preferable on non-Guix systems.

--8<---------------cut here---------------end--------------->8---

and Ludovic Courtès added:

--8<---------------cut here---------------start------------->8---

    I agree that it’d be nice to somehow tell users about ‘TZDIR’, but I’m
    reluctant to introducing yet another profile file.

    I’m not sure what would be the best approach!

--8<---------------cut here---------------end--------------->8---

So AFAIU all I have to do is to fix my foreign distro environment.

Also, AFAIU from #40881 we should avoid setting tzdata as inputs of our
packages (to avoid massive rebuilds) and let our packages look up zones
at runtime with $TZDIR; this also makes me understand a little bit more
clearly why we have "tzdata-for-tests"... and I'm gonna use it in my
next version of the patch.

A new patch version will follow... soon (TM)

Happy hacking! Gio'

[...]


[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36870
Giovanni Biscuolo June 16, 2021, 10:09 a.m. UTC | #4
Hi Maxime,

thank you for your reply!

I'm reading it after my last message to debbugs.

Maxime Devos <maximedevos@telenet.be> writes:

> Giovanni Biscuolo schreef op di 15-06-2021 om 16:40 [+0200]:

[...]

> If you want to automagically install "tzdata", there are two options:
>
>   * move "tzdata" to propagated-inputs

I thought I tried this but I'm not sure... I'll have a try later just to
test and learn: thanks!

[...]

> When "tzdata" is used for tests, use the less-frequently updated
> tzdata-for-tests instead.

Yes, now I understand that package purpose, thanks!

[...]

> What operating system are you on, and what output do you get if you run
> "echo $TZDIR"?

Since I'd like this thread to be only for adding ruby-taskjuggler I'm
going to open a new dedicated thread on guix-devel ASAP, to keep things
separated.

Thank you very much Maxime! Gio'
Giovanni Biscuolo June 16, 2021, 4:51 p.m. UTC | #5
Hello,

unfortunately this package still have some issues with the daemon mode
(tj3d)

Starting tj3d in daemon mode with "tj3d -c .taskjugglerrc --debug -d -w"
and trying to add a project fails with an exception:

--8<---------------cut here---------------start------------->8---

giovanni@roquette: tj3client -c .taskjugglerrc add tutorial.tjp
TaskJuggler v3.7.1 - A Project Management Software

Exception `SecurityError' at /gnu/store/1rslmq79i0lwccxqfh4cv1shbv5hchkq-ruby-taskjuggler-3.7.1/lib/ruby/vendor_ruby/gems/taskjuggler-3.7.1/lib/taskjuggler/TjTime.rb:80 - Insecure operation - []=
Warning: Projects(s) project-001.tjp could not be added

--8<---------------cut here---------------end--------------->8---

Looking at the issues upstream, it seems to be the same issue like this
one:
https://github.com/taskjuggler/TaskJuggler/issues/168

I'll see if I can arrange a patch, please do not merge this package to
master until we fix this.

Thanks! Giovanni
Giovanni Biscuolo June 16, 2021, 5:55 p.m. UTC | #6
Hello,

some more info

Giovanni Biscuolo <g@xelera.eu> writes:

[...]

> --8<---------------cut here---------------start------------->8---
>
> giovanni@roquette: tj3client -c .taskjugglerrc add tutorial.tjp
> TaskJuggler v3.7.1 - A Project Management Software
>
> Exception `SecurityError' at /gnu/store/1rslmq79i0lwccxqfh4cv1shbv5hchkq-ruby-taskjuggler-3.7.1/lib/ruby/vendor_ruby/gems/taskjuggler-3.7.1/lib/taskjuggler/TjTime.rb:80 - Insecure operation - []=
> Warning: Projects(s) project-001.tjp could not be added
>
> --8<---------------cut here---------------end--------------->8---

If I comment out the "timezone" keyword in tutorial.tjp the project is
loaded (and I can see it in the localhost web interface).

Anyway, for all connections, the tj3d daemon shows this exception:

--8<---------------cut here---------------start------------->8---

Exception `DRb::DRbConnError' at /gnu/store/yw250lzn7ii8vlm5gqk4ylzgy9jg8ii3-ruby-2.6.5/lib/ruby/2.6.0/drb/drb.rb:578 - connection closed

--8<---------------cut here---------------end--------------->8---

I'm not expert in Ruby so I don't know where to investigate for this.

Happy hacking, Gio'