void-linux / xbps

The X Binary Package System (XBPS)
https://voidlinux.org/xbps/
Other
770 stars 123 forks source link

Consider showing messages summary after installation #381

Open kotoko opened 3 years ago

kotoko commented 3 years ago

I run regularly xbps-install -Su to update all packages in the system. Some packages show short messages that user should read and maybe do something about it. However because during update there are hundreds of packages it's easy to miss those messages. It would be nice if xbps could "remember" in the background those messages and after finishing installation/update of all packages xbps could show wall of remembered messages. This way it is impossible to miss and easy to read.

Current situation

When installing/updating many packages messages are shown during installation and xbps shows many lines with info from installing and messages to humans. Messages are in the middle of the log's stream so it is easy for human to miss them.

My wish/suggestion

Consider temporarily saving messages. Instead of showing them in the middle of the log's stream, show them after installation of all packages has completed. There would stream of logs from installation and after that there would stream of messages. Because it will be last thing printed to stdout it will be impossible to miss. Also all messages will be together so it would be easy to read.

emerge in Gentoo does this exactly this way. If you ever used it then this is exactly what I'm suggesting.

Chocimier commented 3 years ago

Gentoo's eselect news way is surely better than what xbps has, but too complicated.

Displaying messages together with list of installed packages to be accepted looks better to me, as there they are really visible, relatively easy to make display once (not show on every update) and give chance to resign from update and prepare in case of breaking changes.

kotoko commented 3 years ago

Hmm... I think we are talking about 2 different things. I am talking about messages that are between tags === in xbps output. Let me try to create minimal example.

Gentoo Command:

$ emerge --update --quiet-build=y @world

Output:

>>> emerging package1...
>>> installing package1...
...
>>> emerging package234...
>>> installing package234...
All packages installed successfully!

* Message from package10:
* To migrate database do bla bla bla, for example run:
*   /bin/migrate

* Message from package205:
* To manipulate bluetooth user must be bla bla bla...
*   /bin/add_user_to_group kotoko bluetooth

^--- Messages are in the end.

Void Command:

$ xbps-install -Su

Output:

Downloading package1...
...
Downloading package234...
Installing package1...
...
Installing package234...
Configuring package1...
...
Configuring package10...
=====================================================
To migrate database do bla bla bla, for example run:
  /bin/migrate
=====================================================
...
Configuring package205...
=====================================================
To manipulate bluetooth user must be bla bla bla...
  /bin/add_user_to_group kotoko bluetooth
=====================================================
...
Configuring package234...
Done!

^--- Messages are in the middle. Not all packages show them.

Chocimier commented 3 years ago

I'm talking about that too, just remembered wrongly about what goes into news, or maybe things changed during years. Still, showing all messages at end may lose some of them in terminals without scrollback.

kotoko commented 3 years ago

Still, showing all messages at end may lose some of them in terminals without scrollback.

Well... Right now on terminals without scrollback you would probably miss all of messages in current form. If messages are in the end then you would at least see a few of them. I'm not sure what do you mean by "lose some of them"?

Recently I run script for updating within screen on default settings (by mistake) and could only see last 100 lines or something like that. So if there were messages I missed all of them. Hence this suggestion.

crater2150 commented 3 years ago

I think both suggestions, displaying the messages in the package list before confirming the update, and displaying them at the end, would be improvements over the current situation. I have a small preference towards displaying them upfront, as for some packages breaking changes may mean more work than a simple migration script (e.g. as discussed in the current caddy2 PR). So if you encountered one of those updates, you could abort and fix it upfront or set the package version to hold until there is time for migrating.

As it is, the messages are too easy to miss. I recently updated a machine that was offline for a while and missed the message about pam needing some lines removed, so I could no longer log in and needed a rescue system to repair it.

A (hacky) workaround I use is the following, which queries all install messages after a run of xbps-install:

function xbps-install() {
  sudo script --return --quiet -c "/usr/bin/xbps-install $*" \
  | tee /dev/stderr | grep -oP '.*(?=: post-install message)' \
  | ifne xargs xbps-query -p install-msg; 
}
ericonr commented 3 years ago

I think both suggestions, displaying the messages in the package list before confirming the update, and displaying them at the end, would be improvements over the current situation. I have a small preference towards displaying them upfront

I agree that this would be a nice improvement to have, but it requires a big change to how INSTALL.msg is stored, given that right now it's contained in the package. Either have all the INSTALL.msg files in repodata (might get very big), or add another confirmation step where all the packages are downloaded and you can now inspect INSTALL.msg before kicking off installation.

crater2150 commented 3 years ago

@ericonr Aren't they already stored in the repository? I don't know anything about the repository format, but xbps-query -Rp install-msg $pkg can display the messages for packages that I don't have installed. And as it works near instantly even for chromium, it doesn't seem to download the whole package.

ericonr commented 3 years ago

@crater2150 you're right, install-msg is stored in both :)

So yes, that makes this even simpler, though I'm not sure about the UI.