[bug#55874] Add timewarrior 1.4.3

Message ID CANNGBfmtyGVoYSC+QkqvShkOZijyr0XRwp6ZML+ks-ndUEAPdQ@mail.gmail.com
State New
Headers
Series [bug#55874] Add timewarrior 1.4.3 |

Commit Message

Zac Berkowitz June 9, 2022, 3:11 p.m. UTC
  
  

Comments

Maxime Devos June 9, 2022, 7:50 p.m. UTC | #1
Zac Berkowitz schreef op do 09-06-2022 om 11:11 [-0400]:
> +       (method url-fetch)
> +       (uri (string-append
> +            
> "https://github.com/GothenburgBitFactory/timewarrior/releases/download/v
> " version
> +             "/timew-" version ".tar.gz"))
> +       (sha256 (base32
> +               
> "0lyaqzcg8np2fpsmih0hlkjxd3qbadc7khr24m1pq9lsdhq7xpy4"))))

I can confirm the hash matches, and hashing the file with sha256sum
agrees with the hash mentioned on <https://timewarrior.net/releases/>.
  
Maxime Devos June 9, 2022, 7:53 p.m. UTC | #2
Zac Berkowitz schreef op do 09-06-2022 om 11:11 [-0400]:
> +    (native-inputs
> +     `(("ruby-asciidoctor" ,ruby-asciidoctor)
> +       ("python" ,python)))
> +    (inputs
> +     `(("gnutls" ,gnutls)
> +       ("util-linux:lib" ,util-linux "lib")))

Nowadays, these can be simplified to.

  (native-inputs (list ruby-asciidoctor python))

Where did you learn about the old form?

Likewise (if I remember the syntax right):

  (list gnutls `(,util-linux "lib"))

Greetings,
Maxime.
  
Maxime Devos June 9, 2022, 7:55 p.m. UTC | #3
Zac Berkowitz schreef op do 09-06-2022 om 11:11 [-0400]:
+         (delete 'install-license-files) ; Already installed by
package

Not a problem I think -- at worst, the license file will appear twice,
but identical files are automatically deduplicated, and even if not, they
are relatively small files anyway.

Greetings,
Maxime.
  
Maxime Devos June 9, 2022, 7:56 p.m. UTC | #4
Zac Berkowitz schreef op do 09-06-2022 om 11:11 [-0400]:
> +             (substitute* "src/commands/CMakeLists.txt"
> +               (("/bin/sh") (which "sh"))))))))

In this context, (which "sh") can maybe be simplified to just "sh", not
that it really matters.

Greetings,
Maxime.
  
Maxime Devos June 9, 2022, 8:01 p.m. UTC | #5
Zac Berkowitz schreef op do 09-06-2022 om 11:11 [-0400]:
> * gnu/packages/task-management.scm (timewarrior): New variable

This contains a binary src/libshared/src/wcwidth.h, which should be
built from source with the generator
https://github.com/ridiculousfish/widecharwidth/ instead.

Greetings,
Maxime.
  
Maxime Devos June 9, 2022, 8:06 p.m. UTC | #6
Zac Berkowitz schreef op do 09-06-2022 om 11:11 [-0400]:
> * gnu/packages/task-management.scm (timewarrior): New variable


This package is irreproducible, see

https://salsa.debian.org/tasktools-team/timew/-/blob/master/debian/patches/time-sensitive-tests.patch
  
Maxime Devos June 9, 2022, 8:08 p.m. UTC | #7
Zac Berkowitz schreef op do 09-06-2022 om 11:11 [-0400]:
> +    (native-inputs
> +     `(("ruby-asciidoctor" ,ruby-asciidoctor)
> +       ("python" ,python)))

According to Debian, additional (native-)inputs are required:

https://salsa.debian.org/tasktools-team/timew/-/blob/master/debian/tests/control

Are the tests actually run and can the man page be read?

Greetings,
Maxime.
  
Maxime Devos June 9, 2022, 8:09 p.m. UTC | #8
Zac Berkowitz schreef op do 09-06-2022 om 11:11 [-0400]:
> +       (method url-fetch)
> +       (uri (string-append
> +            
> "https://github.com/GothenburgBitFactory/timewarrior/releases/download/v
> " version
> +             "/timew-" version ".tar.gz"))
> +       (sha256 (base32

The tests are missing:

https://salsa.debian.org/tasktools-team/timew/-/blob/master/debian/README.source

so maybe use the source code on git instead?
  
Maxime Devos June 9, 2022, 8:10 p.m. UTC | #9
Zac Berkowitz schreef op do 09-06-2022 om 11:11 [-0400]:
> +     (origin
> +       (method url-fetch)
> +       (uri (string-append
> +            
> "https://github.com/GothenburgBitFactory/timewarrior/releases/download/v
> " version
> +             "/timew-" version ".tar.gz"))
> +       (sha256 (base32

Is the bash completion installed in the right location?
According to Debian, it isn't:

https://salsa.debian.org/tasktools-team/timew/-/blob/master/debian/timewarrior.bash-completion
  
Maxime Devos June 9, 2022, 8:12 p.m. UTC | #10
Zac Berkowitz schreef op do 09-06-2022 om 11:11 [-0400]:
> +    (native-inputs
> +     `(("ruby-asciidoctor" ,ruby-asciidoctor)
> +       ("python" ,python)))

Are the scripts in ext/*.py installed somewhere?  If so, 'python' needs
to be in 'inputs' instead for cross-compilation.
  
Maxime Devos June 9, 2022, 8:17 p.m. UTC | #11
According to archlinux, there are some bogus man pages:

https://archlinuxarm.org/packages/aarch64/timew/files/PKGBUILD

are they absent here?  (Also, archlinux has the same hash!)
  
Zac Berkowitz June 10, 2022, 1:36 a.m. UTC | #12
Maxime,

Thanks for all of the great feedback -- seems like "works for me"
wasn't nearly good enough in this case!  I'll chip away at these
issues next week when I've got some time.  Is submitting a new patch
on this bug # the best way forward?  Or should I close this and open a
new patch issue when it's ready?

Cheers,

Zac

On Thu, Jun 9, 2022 at 4:17 PM Maxime Devos <maximedevos@telenet.be> wrote:
>
> According to archlinux, there are some bogus man pages:
>
> https://archlinuxarm.org/packages/aarch64/timew/files/PKGBUILD
>
> are they absent here?  (Also, archlinux has the same hash!)
  
Maxime Devos June 10, 2022, 7:49 a.m. UTC | #13
Zac Berkowitz schreef op do 09-06-2022 om 21:36 [-0400]:
> Maxime,
> 
> Thanks for all of the great feedback -- seems like "works for me"
> wasn't nearly good enough in this case!  I'll chip away at these
> issues next week when I've got some time.  Is submitting a new patch
> on this bug # the best way forward?  Or should I close this and open a
> new patch issue when it's ready?

Send it as a v2 to 55874@, then all the relevant information is kept
together at <https://issues.guix.gnu.org/55874>.

Greetings,
Maxime.
  
Zac Berkowitz June 10, 2022, 2:04 p.m. UTC | #14
Maxime,

Ended up having a bit of time today to look through what you brought
up.  Thanks again for it!

>> +    (native-inputs
>> +     `(("ruby-asciidoctor" ,ruby-asciidoctor)
>> +       ("python" ,python)))
>
> According to Debian, additional (native-)inputs are required:
>
> https://salsa.debian.org/tasktools-team/timew/-/blob/master/debian/tests/control
>
> Are the tests actually run and can the man page be read?

According to the source
(https://github.com/GothenburgBitFactory/timewarrior/blob/develop/INSTALL)
asciidoctor is required to build the docs, but python is not a
requirement at runtime.
I'm able to run the timew executable in a pure shell without moving
python to the input list, so this seems to be a debian issue?

The python scripts in ext/ are completely optional according to the
README in that same directory.  Like taskwarrior, timewarrior can
execute python scripts as hooks in response to various commands, but
they're not necessary for base use.
Maybe this is why debian adds the python requirement?  So hooks just
work out of the box?  How does guix deal with optional dependencies
like this?

Tests are run and pass, but that doesn't rule out determinism issues,
I'll see what debian did to address that.

man pages are not available, I'll correct that.

>> +    (native-inputs
>> +     `(("ruby-asciidoctor" ,ruby-asciidoctor)
>> +       ("python" ,python)))
>> +    (inputs
>> +     `(("gnutls" ,gnutls)
>> +       ("util-linux:lib" ,util-linux "lib")))
>
> Nowadays, these can be simplified to.
>
>  (native-inputs (list ruby-asciidoctor python))
>
> Where did you learn about the old form?

Wouldn't say "learn" - I'm very new to lisps! The code here is mostly
adapted from taskwarrior (same developer) and other snippets from
gnu/packages.  I'm sure I grep'd for another package that required
asciidoctor and adapted their portion of the code.

>>+         (delete 'install-license-files) ; Already installed by
>> package
>
> Not a problem I think -- at worst, the license file will appear twice,
> but identical files are automatically deduplicated, and even if not, they
> are relatively small files anyway.

This is from taskwarrior from the same developer and has a similar
build setup.  Seems like both packages should be consistent, but I'm
happy to remove this directive if needed.

>> +             (substitute* "src/commands/CMakeLists.txt"
>> +               (("/bin/sh") (which "sh"))))))))
>
> In this context, (which "sh") can maybe be simplified to just "sh", not
> that it really matters.

Ok.




On Fri, Jun 10, 2022 at 3:49 AM Maxime Devos <maximedevos@telenet.be> wrote:
>
> Zac Berkowitz schreef op do 09-06-2022 om 21:36 [-0400]:
> > Maxime,
> >
> > Thanks for all of the great feedback -- seems like "works for me"
> > wasn't nearly good enough in this case!  I'll chip away at these
> > issues next week when I've got some time.  Is submitting a new patch
> > on this bug # the best way forward?  Or should I close this and open a
> > new patch issue when it's ready?
>
> Send it as a v2 to 55874@, then all the relevant information is kept
> together at <https://issues.guix.gnu.org/55874>.
>
> Greetings,
> Maxime.
  
Maxime Devos June 10, 2022, 2:54 p.m. UTC | #15
Zac Berkowitz schreef op vr 10-06-2022 om 10:04 [-0400]:
> The python scripts in ext/ are completely optional according to the
> README in that same directory.  Like taskwarrior, timewarrior can
> execute python scripts as hooks in response to various commands, but
> they're not necessary for base use.
> Maybe this is why debian adds the python requirement?  So hooks just
> work out of the box?  How does guix deal with optional dependencies
> like this?
> 

If it increases the closure size a lot and does not provide much extra
functionality, the extra dependency (and the components that require
that dependency) is removed.  (Alternatively the ext/ scripts can be
changed to use the 'python' in $PATH instead of a baked-in 'python',
though such things are avoided where feasible for robustness).

Even if they are optional, adding python might be required such that
the _correct_ python is used when cross-compiling.  As a test, you
could try running "guix gc --references" on the timewarrior store item
-- if the output contains python, the ext/... is installed with python.

Probably most people would have python anyway, so I don't think it has
to be removed.

Looking at the output of "guix gc --references", it does indeed use
python from somewhere.

Greetings,
Maxime.
  
Maxime Devos June 10, 2022, 2:56 p.m. UTC | #16
Zac Berkowitz schreef op vr 10-06-2022 om 10:04 [-0400]:
> According to the source
> (https://github.com/GothenburgBitFactory/timewarrior/blob/develop/INSTALL)
> asciidoctor is required to build the docs, but python is not a
> requirement at runtime.

Then something appears to be broken somewhere, because I'm not seeing
any docs (except for some README) in
</gnu/store/n2hl121g9qgvdpmx4qmsfr1d77hrpxps-timewarrior-1.4.3/>.

Greetings,
Maxime.
  
Maxime Devos June 10, 2022, 3 p.m. UTC | #17
Zac Berkowitz schreef op vr 10-06-2022 om 10:04 [-0400]:
> The python scripts in ext/ are completely optional according to the
> README in that same directory.  Like taskwarrior, timewarrior can
> execute python scripts as hooks in response to various commands, but
> they're not necessary for base use.

Two comments:

  * the scripts are installed in share/doc/timew, so I don't think they
    are actually automatically or discoverable by the user, so FWIW
    as-is they can be removed (removing the reference to python).
    Alternatively you could look into making them functional, as some
    other distros do.

  * the scripts do subprocess.call(['timew', ...]).  For robustness,
    if these scripts are kept, the 'timew' needs to be replaced by the
    /gnu/store/.../bin/timew (by using 'substitute*' in a phase).

Greetings,
Maxime.
  
Maxime Devos June 10, 2022, 3 p.m. UTC | #18
Zac Berkowitz schreef op vr 10-06-2022 om 10:04 [-0400]:
> Wouldn't say "learn" - I'm very new to lisps! The code here is mostly
> adapted from taskwarrior (same developer) and other snippets from
> gnu/packages.  I'm sure I grep'd for another package that required
> asciidoctor and adapted their portion of the code.
> 

Ok, not all old packages have been converted yet.
  

Patch

From dc3cd50a62ddce3fcc2ea9c374036192411b833a Mon Sep 17 00:00:00 2001
From: Zac Berkowitz <zac.berkowitz@gmail.com>
Date: Fri, 13 May 2022 11:56:51 -0400
Subject: [PATCH] gnu: Add timewarrior.

* gnu/packages/task-management.scm (timewarrior): New variable
---
 gnu/packages/task-management.scm | 38 ++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/gnu/packages/task-management.scm b/gnu/packages/task-management.scm
index aeedbfbe6a..3a21c1a44d 100644
--- a/gnu/packages/task-management.scm
+++ b/gnu/packages/task-management.scm
@@ -38,6 +38,7 @@  (define-module (gnu packages task-management)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
   #:use-module (gnu packages python-xyz)
+  #:use-module (gnu packages ruby)
   #:use-module (gnu packages time)
   #:use-module (gnu packages tls)
   #:use-module (guix download)
@@ -145,6 +146,43 @@  (define-public taskwarrior
 and querying data, exposing task data in multiple formats to other tools.")
     (license license:expat)))
 
+(define-public timewarrior
+  (package
+    (name "timewarrior")
+    (version "1.4.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "https://github.com/GothenburgBitFactory/timewarrior/releases/download/v" version
+             "/timew-" version ".tar.gz"))
+       (sha256 (base32
+                "0lyaqzcg8np2fpsmih0hlkjxd3qbadc7khr24m1pq9lsdhq7xpy4"))))
+    (build-system cmake-build-system)
+    (native-inputs
+     `(("ruby-asciidoctor" ,ruby-asciidoctor)
+       ("python" ,python)))
+    (inputs
+     `(("gnutls" ,gnutls)
+       ("util-linux:lib" ,util-linux "lib")))
+     ;; (list gnutls
+     ;;       `(,util-linux "lib")))
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (delete 'install-license-files) ; Already installed by package
+         (add-after 'patch-source-shebangs 'patch-cmake-shell
+           (lambda _
+             (substitute* "src/commands/CMakeLists.txt"
+               (("/bin/sh") (which "sh"))))))))
+     (home-page "https://timewarrior.net")
+    (synopsis "Command line utility to track and report time")
+    (description
+     "Timewarrior is a command line time tracking application, which allows
+you to record time spent on activities.  You may be tracking your time for
+curiosity, or because your work requires it.")
+    (license license:expat)))
+
 (define-public worklog
   (let ((commit "0f545ad6697ef4de7f68d92cd7cc5c6a4c60517b")
         (revision "1"))
-- 
2.36.1