[PATCH] guix package: Avoid spinner at end of output.

  • Done
  • quality assurance status badge
Details
4 participants
  • Danny Milosavljevic
  • Ludovic Courtès
  • Christopher Baines
  • Ricardo Wurmus
Owner
unassigned
Submitted by
Christopher Baines
Severity
normal

Debbugs page

Christopher Baines wrote 6 years ago
(address . guix-patches@gnu.org)
20190129195031.21496-1-mail@cbaines.net
Often guix package will report something like the following when performing
operations, for example:

guix package -i hello
...
building /gnu/store/wiwqmbi66gcr27dac3qqgrc8imyp1344-profile.drv...
-117 packages in profile

Now there aren't -117 packages in this profile, it's just the spinner running
in to the output from Guix package. I'm not sure if this is a proper solution
for this issue, but it does work.

* guix/scripts/package.scm (build-and-use-profile): Erase the spinner before
output.
---
guix/scripts/package.scm | 1 +
1 file changed, 1 insertion(+)

Toggle diff (14 lines)
diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
index a633d2ee6d..4db0e72e9b 100644
--- a/guix/scripts/package.scm
+++ b/guix/scripts/package.scm
@@ -159,6 +159,7 @@ hooks\" run when building the profile."
(switch-symlinks profile (basename name))
(unless (string=? profile %current-profile)
(register-gc-root store name))
+ (display "\r") ; erase the spinner
(format #t (N_ "~a package in profile~%"
"~a packages in profile~%"
count)
--
2.20.1
Danny Milosavljevic wrote 6 years ago
(name . Christopher Baines)(address . mail@cbaines.net)(address . 34249@debbugs.gnu.org)
20190129211645.08cdbd2d@scratchpost.org
Hi Christopher,
Toggle quote (10 lines)
> diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
> index a633d2ee6d..4db0e72e9b 100644
> --- a/guix/scripts/package.scm
> +++ b/guix/scripts/package.scm
> @@ -159,6 +159,7 @@ hooks\" run when building the profile."
> (switch-symlinks profile (basename name))
> (unless (string=? profile %current-profile)
> (register-gc-root store name))
> + (display "\r") ; erase the spinner

In order to actually erase it, might want to do (display "\r\x1b[K") instead.
-----BEGIN PGP SIGNATURE-----

iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAlxQtK0ACgkQ5xo1VCww
uqVntQf/Tx5FHuumIXxvv3wmKU1JMmmO9phMtvxc+JRDPSdERRhEvw+feEz/OY/9
AxUp62UbsJJQAxswu0XH9rrun2pqK8/Jz7K96WHXZWmXbIIRijn64z3nPXfT32WN
q/w6+bkgvYyJ9+rQkXBXRFfBTgQD9EbQ/2sf0dvpGNHMOuF6bFsbBVE87fZeEHAU
YzjKOWX10cb1oh5WRExYQgIhRRiXxFbVs9FTmp1oqcPIQ2DuDIF6cTG2aGfnTbSL
8fxIWPi1npSSr/t9KUgWIVTBWtFtBX6DbfBG+gUvBnc3r0LOtptcTCl1v8Yee17e
YMPq2mlZGsgFRTppvejc9irte66Y5g==
=wSMA
-----END PGP SIGNATURE-----


Ludovic Courtès wrote 6 years ago
(name . Danny Milosavljevic)(address . dannym@scratchpost.org)
8736pbm6ac.fsf@gnu.org
Danny Milosavljevic <dannym@scratchpost.org> skribis:

Toggle quote (13 lines)
> Hi Christopher,
>> diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
>> index a633d2ee6d..4db0e72e9b 100644
>> --- a/guix/scripts/package.scm
>> +++ b/guix/scripts/package.scm
>> @@ -159,6 +159,7 @@ hooks\" run when building the profile."
>> (switch-symlinks profile (basename name))
>> (unless (string=? profile %current-profile)
>> (register-gc-root store name))
>> + (display "\r") ; erase the spinner
>
> In order to actually erase it, might want to do (display "\r\x1b[K") instead.

And to do that, you can use (erase-current-line port).

Though actually I think this should be done in ‘print-build-event’ in
(guix status). Probably something like the patch below, but I haven’t
been able to quickly reproduce the initial problem.

Could you give it a spin (ah ha!) and report back?

If it doesn’t solve the issue, we should strace the thing to see why it
keeps spinning after everything is “done” basically.

Thanks,
Ludo’.
Toggle diff (21 lines)
diff --git a/guix/status.scm b/guix/status.scm
index e3375816c5..7a330525b0 100644
--- a/guix/status.scm
+++ b/guix/status.scm
@@ -465,8 +465,14 @@ addition to build events."
(_
(spin! port))))))
- (unless print-log?
- (display "\r" port)) ;erase the spinner
+ (define erase-current-line*
+ (if (isatty?* port)
+ (lambda (port)
+ (erase-current-line port)
+ (force-output port))
+ (const #t)))
+
+ (erase-current-line* port) ;clear the spinner
(match event
(('build-started drv . _)
(let ((properties (derivation-properties
Christopher Baines wrote 6 years ago
(name . Ludovic Courtès)(address . ludo@gnu.org)
87o97p5a6w.fsf@cbaines.net
Ludovic Courtès <ludo@gnu.org> writes:

Toggle quote (51 lines)
> Danny Milosavljevic <dannym@scratchpost.org> skribis:
>
>> Hi Christopher,
>>> diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm
>>> index a633d2ee6d..4db0e72e9b 100644
>>> --- a/guix/scripts/package.scm
>>> +++ b/guix/scripts/package.scm
>>> @@ -159,6 +159,7 @@ hooks\" run when building the profile."
>>> (switch-symlinks profile (basename name))
>>> (unless (string=? profile %current-profile)
>>> (register-gc-root store name))
>>> + (display "\r") ; erase the spinner
>>
>> In order to actually erase it, might want to do (display "\r\x1b[K") instead.
>
> And to do that, you can use (erase-current-line port).
>
> Though actually I think this should be done in ‘print-build-event’ in
> (guix status). Probably something like the patch below, but I haven’t
> been able to quickly reproduce the initial problem.
>
> Could you give it a spin (ah ha!) and report back?
>
> If it doesn’t solve the issue, we should strace the thing to see why it
> keeps spinning after everything is “done” basically.
>
> Thanks,
> Ludo’.
>
> diff --git a/guix/status.scm b/guix/status.scm
> index e3375816c5..7a330525b0 100644
> --- a/guix/status.scm
> +++ b/guix/status.scm
> @@ -465,8 +465,14 @@ addition to build events."
> (_
> (spin! port))))))
>
> - (unless print-log?
> - (display "\r" port)) ;erase the spinner
> + (define erase-current-line*
> + (if (isatty?* port)
> + (lambda (port)
> + (erase-current-line port)
> + (force-output port))
> + (const #t)))
> +
> + (erase-current-line* port) ;clear the spinner
> (match event
> (('build-started drv . _)
> (let ((properties (derivation-properties

I've tried out the change you pushed here [1], and it looks good to me
:) I can't see anything odd in the output now.

-----BEGIN PGP SIGNATURE-----

iQKTBAEBCgB9FiEEPonu50WOcg2XVOCyXiijOwuE9XcFAlxa3idfFIAAAAAALgAo
aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDNF
ODlFRUU3NDU4RTcyMEQ5NzU0RTBCMjVFMjhBMzNCMEI4NEY1NzcACgkQXiijOwuE
9XcCKg//UcAy3A+7uwHp/2CeCUdXeDldJWZhDeDIcIs+sw8dRbz49GCsyaWdZSDm
+1qBkE3rB94dffrrcsZbnDQWYy8kM6QtDb4nU7dIz5lz5FVeU6oYwXihSpFEx3BK
F4/gL+414ts9qonjJ+1bId+Mh0LEX6J0LosWvqwZfqgJVftsFMytoiPPsFyrZMzX
UyONnu6kBewgv3LYVIp2XyHgTjPUUx6Pfbvj4d7UY9jzx4+O7iFx1pdesGMNaVlG
g0Kcu0nrX1JpoLBbJ1SVfxdQ+1oyjgJFEtINmnlJC94WNeANi+l+hjpYUNXSmUPz
ZEV8EDRWvFh4xm4RlWWMU/dblKkalu7qEItRYthA1nQgSfbEe0O2Dg7R17LMXd96
9ebwzSZ15CwpylU9e/b8Ga+tvTBJDthxZejs/YRWq0tYHTHdyrewz+A9PpMiw3Vb
Bs8UTCaco+KwqDVf9Fk21WS+OhxSap9zum3rEG1IK9dBLq+wfv+IQSWFX4RNBpBu
bhH/uHASLYoWMmf5FOhQrGlht91DUd859G+fEagaMUMJaxhtVjnGRi5/Ru3ZPHil
AlXM6xfRZ2m9fJux/n76rtS6WNO9ZIWFpTsleFWh3gr9fFCQtrPYyjaWSRLNP/qa
PzgX2TaoNxgcIFGq5GIyEtGbEhlAdF3Udqoap9pdZV+GCUkdOvY=
=b28M
-----END PGP SIGNATURE-----

Closed
Ricardo Wurmus wrote 6 years ago
Re: bug#34249: [PATCH] guix package: Avoid spinner at end of output.
(name . Christopher Baines)(address . mail@cbaines.net)
87zhr9f0nq.fsf@elephly.net
Christopher Baines <mail@cbaines.net> writes:

Toggle quote (5 lines)
> I've tried out the change you pushed here [1], and it looks good to me
> :) I can't see anything odd in the output now.
>
> 1: https://git.savannah.gnu.org/cgit/guix.git/commit/?id=7473bce207af846312d5167a398f5f20bbf3e896

With this change I see that there are now two empty lines between
“downloading” lines. The updating line flickers, too.

I wonder if maybe too much is deleted. I can’t give specifics, but it
did seem a little weird when I observed the output on my i686 machine.

--
Ricardo
Closed
Ludovic Courtès wrote 6 years ago
Re: bug#33470: bug#34249: [PATCH] guix package: Avoid spinner at end of output.
(name . Ricardo Wurmus)(address . rekado@elephly.net)
87r2cj37ii.fsf@gnu.org
Hi!

Ricardo Wurmus <rekado@elephly.net> skribis:

Toggle quote (13 lines)
> Christopher Baines <mail@cbaines.net> writes:
>
>> I've tried out the change you pushed here [1], and it looks good to me
>> :) I can't see anything odd in the output now.
>>
>> 1: https://git.savannah.gnu.org/cgit/guix.git/commit/?id=7473bce207af846312d5167a398f5f20bbf3e896
>
> With this change I see that there are now two empty lines between
> “downloading” lines. The updating line flickers, too.
>
> I wonder if maybe too much is deleted. I can’t give specifics, but it
> did seem a little weird when I observed the output on my i686 machine.

Indeed, I noticed it too. I believe that
024d5275c5cd72c0121b4f70d64c63f859a68f17 fixes it.

Let me know!

Thanks,
Ludo’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 34249@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 34249
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help