GNU bug report logs - #55769
[PATCH] gnu: Add xwhite.

Previous Next

Package: guix-patches;

Reported by: <derekchuank <at> outlook.com>

Date: Thu, 2 Jun 2022 16:14:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 55769 in the body.
You can then email your comments to 55769 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#55769; Package guix-patches. (Thu, 02 Jun 2022 16:14:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to <derekchuank <at> outlook.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 02 Jun 2022 16:14:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: <derekchuank <at> outlook.com>
To: "guix-patches <at> gnu.org" <guix-patches <at> gnu.org>
Subject: [PATCH] gnu: Add xwhite.
Date: Thu, 2 Jun 2022 15:39:39 +0000
[Message part 1 (text/plain, inline)]
diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index e5a98edb35..250860274d 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -54,6 +54,7 @@
 ;;; Copyright © 2021 jgart <jgart <at> dismail.de>
 ;;; Copyright © 2022 John Kehayias <john.kehayias <at> protonmail.com>
 ;;; Copyright © 2022 Jai Vetrivelan <jaivetrivelan <at> gmail.com>
+;;; Copyright © 2022 Derek Chuank <derekchuank <at> outlook.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1499,6 +1500,40 @@ (define-public redshift-wayland
 protocol.")
       (license license:gpl3+))))

+(define-public xwhite
+  (package
+    (name "xwhite")
+    (version "0.0.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "https://github.com/derekchuank/xwhite/"
+                       "releases/download/v" version
+                       "/xwhite-" version ".tar.gz"))
+       (sha256
+        (base32 "1gadgvl408zdl9drz6rb0dhq285a6w57bn94ql2sgcpp9mq7ym5q"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (delete 'configure)
+         (replace 'install
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (install-file "xwhite" (string-append out "/bin"))
+               #t))))))
+    (inputs
+     (list libxrandr))
+    (home-page "https://github.com/derekchuank/xwhite")
+    (synopsis "Adjust color balance")
+    (description "xwhite is a command line tool for adjusting color
+balance of screen.  It is based on xrandr's gamma correction and
+brightness adjustment.  Typically used for tuning color balance
+while setting color temperature.")
+    (license license:gpl2)))
+
 (define-public gammastep
   (package
     (name "gammastep")

[Message part 2 (text/html, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#55769; Package guix-patches. (Thu, 02 Jun 2022 18:44:01 GMT) Full text and rfc822 format available.

Message #8 received at 55769 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: derekchuank <at> outlook.com, 55769 <at> debbugs.gnu.org
Subject: Re: [bug#55769] [PATCH] gnu: Add xwhite.
Date: Thu, 02 Jun 2022 20:43:33 +0200
[Message part 1 (text/plain, inline)]
derekchuank <at> outlook.com schreef op do 02-06-2022 om 15:39 [+0000]:
> +    (arguments
> +     `(#:tests? #f

Always add a comment on why tests are disabled.
In this case, probably because there are no tests?

> +       #:phases
> +       (modify-phases %standard-phases
> +         (delete 'configure)
> +         (replace 'install
> +           (lambda* (#:key outputs #:allow-other-keys)
> +             (let ((out (assoc-ref outputs "out")))
> +               (install-file "xwhite" (string-append out "/bin"))
> +               #t))))))

Trailing #t haven't been necessary anymore since a long time

Also, a comment on the makefile.  In the makefile you do CC=gcc, but
that won't work when cross-compiling, because then TARGET-gcc (e.g. 
aarch64-linux-gnu-gcc) is required.  There are multiple ways to resolve
this, but given that you are upstream, I recommend switching to a build
system such as, say, meson[0].  meson (and autotools) take care of such
details for you (cross-compilation, also choosing the right
installation directory).

If you use meson or autotools, then you won't have to add any Guix
phases or do cross-compilation detection in the makefile, you then only
have to replace gnu-build-system by
meson-build-system.

A comment on the license: strictly speaking, you have licensed it as
‘any version of the GPL whatsoever’.  From the GPL itself:

> If the Program does not specify a version number of this License, you
> may choose any version ever published by the Free Software
> Foundation.

I doubt that's what you mean, so maybe document it in the README to be
GPL-2-or-later or GPL-2-only or GPL-2-OR-3-only?

A comment on the code itself: I recommend returning a non-zero value on
failure.  Also, all this is already implemented by another tool:

$ redshift -P -g 2:2:0.1 -O 10000

so to me there appears to be no need to write, maintain and package a
new tool.

[0] https://mesonbuild.com/

Greetings,
Maxime
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#55769; Package guix-patches. (Fri, 03 Jun 2022 13:14:02 GMT) Full text and rfc822 format available.

Message #11 received at 55769 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: derekchuank <at> outlook.com
Cc: 55769 <at> debbugs.gnu.org
Subject: Re: [bug#55769] [PATCH] gnu: Add xwhite.
Date: Fri, 03 Jun 2022 15:13:21 +0200
[Message part 1 (text/plain, inline)]
[Please keep 55769 <at> debbugs.gnu.org in CC]

derekchuank <at> outlook.com schreef op vr 03-06-2022 om 01:33 [+0000]:
> Thank you for your patient.

Nitpick not relevant to the discussion: patient (adjective) -> patience
(noun).

> "Also, all this is already implemented by another tool:
> $ redshift -P -g 2:2:0.1 -O 10000
> so to me there appears to be no need to write, maintain and package a new tool."


derekchuank <at> outlook.com schreef op vr 03-06-2022 om 01:33 [+0000]:
> Setting gamma(redshift -g) correction in redshift is [...].

Ok, it fullfills a somewhat different niche.

> If you think it's worth a new package, I would fix the issues you
mentioned. Either way, I'm happy with the conversation with
> you.


> Setting gamma(redshift -g) correction in redshift is the same as `xrandr --output eDP-1 --gamma 2:2:0.1` in principle,
> which changes the gamma curve shape while keeps the curve two end point position still, resulting a strange
> color scheme with white color unchanged. And that's the problem setting color temperature(redshift -O) is trying to
> resolve, compressing the whole gamma curve, however, the RGB of white color of a fixed color temperature is fixed too,
> the above gamma correction can't change it. That's why I wrote xwhite, a simple but more flexible way to manual color
> balance, setting to a warm color tempature while enhancing green color to avoiding a red screen due to the backlight
> aging. I'm satisfied with it finally.
>
> If you think it's worth a new package, I would fix the issues you
> mentioned. Either way, I'm happy with the conversation with you. 

Given that it fullfills a different niche, a new package 'xwhite'
sounds reasonable to me.  Though maybe you can give a small comparison
of xwhite with redshift in the package description?


> +    (description "xwhite is a command line tool for adjusting color
> +balance of screen.  It is based on xrandr's gamma correction and
> +brightness adjustment.  Typically used for tuning color balance
> +while setting color temperature.")

xwhite -> @command{white} (TeXinfo markup).

adjusting color balance -> adjusting the color balance.

color can be replaced by colour or kept as-is.

It is based on xrandr's gamma correction and brightness adjustment.
-> maybe add the caveat ‘As such, it can only be used for X displays
and not Wayland displays?’

Typically used for tuning color balance while setting color
temperature.  --> It is typically used for tuning the color balance and
color temperature.

Maybe add: ‘It has a similar function as @command{redshift -P -g R:G:B
-O temperature}, but @command{xwhite} is more flexible in that it does
not keep the white color fixed.’

Greetings,
Maxime.


[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#55769; Package guix-patches. (Fri, 03 Jun 2022 19:33:01 GMT) Full text and rfc822 format available.

Message #14 received at 55769 <at> debbugs.gnu.org (full text, mbox):

From: Maxime Devos <maximedevos <at> telenet.be>
To: derekchuank <at> outlook.com
Cc: "55769 <at> debbugs.gnu.org" <55769 <at> debbugs.gnu.org>, control <at> debbugs.gnu.org
Subject: Re: [bug#55769] [PATCH] gnu: Add xwhite.
Date: Fri, 03 Jun 2022 21:32:21 +0200
[Message part 1 (text/plain, inline)]
user guix
usertags 55769 + reviewed looks-good reviewed-looks-good
thanks
(list available at <https://debbugs.gnu.org/cgi/pkgreport.cgi?tag=reviewed-looks-good&users=guix>)

derekchuank <at> outlook.com schreef op vr 03-06-2022 om 19:07 [+0000]:
> +     (uri
> +      (string-append "https://github.com/derekchuank/xwhite/"
> +                     "releases/download/v" version
> +                     "/xwhite-" version ".tar.gz"))
> +     (sha256
> +      (base32
> "0jbnlj5a91ib4anprmylqqnbv9wa73cr7fsc1s54df0a0w5yq8sz"))))


New package definition LGTM (looks good to me).
The hash matches, without any malware in the tarball.
Assuming it actually builds (I haven't checked) it should be fine to
apply.

Greetings,
Maxime.
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#55769; Package guix-patches. (Fri, 03 Jun 2022 19:39:01 GMT) Full text and rfc822 format available.

Message #17 received at 55769 <at> debbugs.gnu.org (full text, mbox):

From: <derekchuank <at> outlook.com>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: "55769 <at> debbugs.gnu.org" <55769 <at> debbugs.gnu.org>
Subject: Re: [bug#55769] [PATCH] gnu: Add xwhite.
Date: Fri, 3 Jun 2022 19:07:04 +0000
[Message part 1 (text/plain, inline)]
I've fixed all the issues you mentioned: adopt meson build system, add GPTv2-only license in README, fix return values in code and a new description. Again, Thank you very much for your detailed guidance and patience.


 gnu/packages/xdisorg.scm | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/gnu/packages/xdisorg.scm b/gnu/packages/xdisorg.scm
index e5a98edb35..1c09128c17 100644
--- a/gnu/packages/xdisorg.scm
+++ b/gnu/packages/xdisorg.scm
@@ -54,6 +54,7 @@
 ;;; Copyright © 2021 jgart <jgart <at> dismail.de>
 ;;; Copyright © 2022 John Kehayias <john.kehayias <at> protonmail.com>
 ;;; Copyright © 2022 Jai Vetrivelan <jaivetrivelan <at> gmail.com>
+;;; Copyright © 2022 Derek Chuank <derekchuank <at> outlook.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1499,6 +1500,37 @@ (define-public redshift-wayland
 protocol.")
       (license license:gpl3+))))

+(define-public xwhite
+  (package
+   (name "xwhite")
+   (version "0.0.2")
+   (source
+    (origin
+     (method url-fetch)
+     (uri
+      (string-append "https://github.com/derekchuank/xwhite/"
+                     "releases/download/v" version
+                     "/xwhite-" version ".tar.gz"))
+     (sha256
+      (base32 "0jbnlj5a91ib4anprmylqqnbv9wa73cr7fsc1s54df0a0w5yq8sz"))))
+   (build-system meson-build-system)
+   (arguments
+    `(#:tests? #f)) ; No test suite.
+   (native-inputs
+    (list pkg-config))
+   (inputs
+    (list libxrandr))
+   (home-page "https://github.com/derekchuank/xwhite")
+   (synopsis "Adjust the color balance")
+   (description "@command{xwhite} is a command line tool for adjusting the colour
+balance of screen.  It is based on xrandr's gamma correction and brightness adjustment.
+As such, it can only be used for X displays and not Wayland displays.  It is typically
+used for tuning the color balance and color temperature.  It has a similar function as
+@command{redshift -P -g R:G:B -O temperature}, but @command{xwhite} is more flexible
+in that it does not keep the white color fixed, suitable for setting the white color
+to an arbitrary balanced color.")
+   (license license:gpl2)))
+
 (define-public gammastep
   (package
     (name "gammastep")

[Message part 2 (text/html, inline)]

Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Tue, 07 Jun 2022 16:29:02 GMT) Full text and rfc822 format available.

Notification sent to <derekchuank <at> outlook.com>:
bug acknowledged by developer. (Tue, 07 Jun 2022 16:29:02 GMT) Full text and rfc822 format available.

Message #22 received at 55769-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Maxime Devos <maximedevos <at> telenet.be>
Cc: "55769 <at> debbugs.gnu.org" <55769-done <at> debbugs.gnu.org>,
 derekchuank <at> outlook.com
Subject: Re: bug#55769: [PATCH] gnu: Add xwhite.
Date: Tue, 07 Jun 2022 18:28:50 +0200
Hi,

Maxime Devos <maximedevos <at> telenet.be> skribis:

> user guix
> usertags 55769 + reviewed looks-good reviewed-looks-good
> thanks
> (list available at <https://debbugs.gnu.org/cgi/pkgreport.cgi?tag=reviewed-looks-good&users=guix>)
>
> derekchuank <at> outlook.com schreef op vr 03-06-2022 om 19:07 [+0000]:
>> +     (uri
>> +      (string-append "https://github.com/derekchuank/xwhite/"
>> +                     "releases/download/v" version
>> +                     "/xwhite-" version ".tar.gz"))
>> +     (sha256
>> +      (base32
>> "0jbnlj5a91ib4anprmylqqnbv9wa73cr7fsc1s54df0a0w5yq8sz"))))
>
>
> New package definition LGTM (looks good to me).
> The hash matches, without any malware in the tarball.
> Assuming it actually builds (I haven't checked) it should be fine to
> apply.

Applied.  Thanks Derek and Maxime!

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 06 Jul 2022 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 287 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.