Re: [gentoo-user] Piping "emerge -a" to some other command

2022-02-25 Thread Neil Bothwick
On Fri, 25 Feb 2022 11:26:34 +0100, Dr Rainer Woitok wrote:

> Nice idea.   However, I'd like to keep things as simple as possible, be-
> cause an important usecase for me is  installing a new  or fixing an ex-
> isting system after booting from a USB stick.  The "script" binary is in
> package "sys-apps/util-linux"  which belongs to "@system",  so it SHOULD
> be on my USB stick.   Like "cmp" and "diff" from package "sys-apps/diff-
> utils" which belong to "@system" too, but which were NOT on my USB stick
> when I used it to install my current system about three years ago, or at
> least they were not in "PATH"  (I then didn't frantically need these, so
> I didn't really search for them).

Use a different live distro, one that includes all you need - such as
System Rescue. I think Arve's suggestion of using screen (or tmux) is the
simplest effective solution. I routinely run emerge -a @world in a tmux
session, and scrolling back though long update lists is easy.


-- 
Neil Bothwick

I spilled Spot remover on my dog. Now he's gone.


pgpfL5KNBc_pQ.pgp
Description: OpenPGP digital signature


Re: [gentoo-user] Piping "emerge -a" to some other command

2022-02-25 Thread Dr Rainer Woitok
Arve,

On Friday, 2022-02-25 10:15:18 +0100, you wrote:

> ...
> I'm guessing any proposed solution would fail when what you want to
> capture has an interactive component like this.

I think "fail" is the wrong word here.   My own scripts send such quest-
ions to the same device  they retrieve the answer from ("/dev/tty" in my
case).   So both, question and answer would be missing from the log file
produced by "tee", but they would appear on the screen, which seems more
important to me.

But you are right in that it would at least be difficult to have them in
both places.

Sincerely,
  Rainer



Re: [gentoo-user] Piping "emerge -a" to some other command

2022-02-25 Thread Dr Rainer Woitok
John,

On Thursday, 2022-02-24 09:59:50 -0500, you wrote:

> ...
> I use script for that purpose and it works great, the output is
> complete and I can just say no and its all  there.

Nice idea.   However, I'd like to keep things as simple as possible, be-
cause an important usecase for me is  installing a new  or fixing an ex-
isting system after booting from a USB stick.  The "script" binary is in
package "sys-apps/util-linux"  which belongs to "@system",  so it SHOULD
be on my USB stick.   Like "cmp" and "diff" from package "sys-apps/diff-
utils" which belong to "@system" too, but which were NOT on my USB stick
when I used it to install my current system about three years ago, or at
least they were not in "PATH"  (I then didn't frantically need these, so
I didn't really search for them).

I do not know what "nano"  (the only editor then available) will do with
all the control characters in the  "script" output file,  and "scriptre-
play" doesn't seem to offer any interactive control.  I do have a "gawk"
based shell function  which turns a  "script" output file  into a normal
text file containing command log + standard output + standard error sans
any control characters, but this will not yet be available in that situ-
ation.

So I'm still preferring "tee" here which definitely WAS on my USB stick.

Sincerely,
  Rainer



Re: [gentoo-user] Piping "emerge -a" to some other command

2022-02-25 Thread Arve Barsnes
On Fri, 25 Feb 2022 at 10:00, Dr Rainer Woitok  wrote:
> A quick search in the "emerge" manual page  for "pars" and "pip" did not
> turn up anything I considered relevant.  Can anyone give more hints?

I'm guessing any proposed solution would fail when what you want to
capture has an interactive component like this.

My solution would rather be to run your emerge commands in a place
that would give you the scroll-back that you lack now, such as in a
screen session. It feels like something like a screen session would be
potentially beneficial in more ways as well, such as being able to do
this remotely.

Regards,
Arve



Re: [gentoo-user] Piping "emerge -a" to some other command

2022-02-25 Thread Dr Rainer Woitok
Rich,

On Thursday, 2022-02-24 07:10:10 -0500, you wrote:

> ...
> Wouldn't it be more appropriate to use -p in this case, which will
> require no input?

Running "emerge -p ..."  followed by "emerge ..." without "-p" would run
the dependency analysis twice for EVERY package update.   Using a single
"emerge -a" call  will run the dependency analysis  only once for almost
each package update.  The option to say "N" and further inspect the "em-
erge" output using an editor  is meant as sort of a safety belt which is
not intended to be used on a daily basis.

> I haven't dug into the man page, but I'm sure there are also options
> that are more intended to make the output more suitable for
> parsing/etc.

A quick search in the "emerge" manual page  for "pars" and "pip" did not
turn up anything I considered relevant.  Can anyone give more hints?

Sincerely,
  Rainer



Re: [gentoo-user] Piping "emerge -a" to some other command

2022-02-24 Thread John Covici
On Thu, 24 Feb 2022 07:10:10 -0500,
Rich Freeman wrote:
> 
> On Thu, Feb 24, 2022 at 6:47 AM Dr Rainer Woitok
>  wrote:
> >
> > since the output of "emerge -a" might be long, and since on a stock con-
> > sole you cannot scroll,  I had the idea of piping it into "tee",  and in
> > case I'm unsure  just to say  "No"  to the question  of whether or not I
> > would like to merge these packages and then to inspect the "emerge" out-
> > put more closely using an editor.
> 
> Wouldn't it be more appropriate to use -p in this case, which will
> require no input?
> 
> I haven't dug into the man page, but I'm sure there are also options
> that are more intended to make the output more suitable for
> parsing/etc.
> 

I use script for that purpose and it works great, the output is
complete and I can just say no and its all  there.

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

 John Covici wb2una
 cov...@ccs.covici.com



Re: [gentoo-user] Piping "emerge -a" to some other command

2022-02-24 Thread Rich Freeman
On Thu, Feb 24, 2022 at 6:47 AM Dr Rainer Woitok
 wrote:
>
> since the output of "emerge -a" might be long, and since on a stock con-
> sole you cannot scroll,  I had the idea of piping it into "tee",  and in
> case I'm unsure  just to say  "No"  to the question  of whether or not I
> would like to merge these packages and then to inspect the "emerge" out-
> put more closely using an editor.

Wouldn't it be more appropriate to use -p in this case, which will
require no input?

I haven't dug into the man page, but I'm sure there are also options
that are more intended to make the output more suitable for
parsing/etc.

-- 
Rich



[gentoo-user] Piping "emerge -a" to some other command

2022-02-24 Thread Dr Rainer Woitok
Greetings,

since the output of "emerge -a" might be long, and since on a stock con-
sole you cannot scroll,  I had the idea of piping it into "tee",  and in
case I'm unsure  just to say  "No"  to the question  of whether or not I
would like to merge these packages and then to inspect the "emerge" out-
put more closely using an editor.

Sadly, however, this works only partly:

   $ sudo emerge -1a acct-group/abrt | tee
   Password: 

   These are the packages that would be merged, in order:

   Calculating dependencies  ... done!
   [ebuild  N ] acct-group/abrt-0-r1 

And that's it, however long you're going to wait here.  You can then
blindly say "No", and "tee" will continue its output:

   Would you like to merge these packages? [Yes/No] 
   Quitting.

   $

Replacing "tee" with "more" does not change anything, so most likely the
culprit is "emerge" itself, which seems to instantly block standard out-
put after it has sent its question there.

So, is this a bug or a feature?

Sincerely,
  Rainer