Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print install and remove messages below transaction summary #421

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Chocimier
Copy link
Member

@Chocimier Chocimier commented Jul 24, 2021

Makes messages actually visible, and allow to delay update in case manual steps required after update are inconvenient at given time.
As is, presence of messages breaks tools parsing xbps-install -n output, but I want that despite.
There are no install messages in xbps or octoxbps dependency tree, so system update won't be affected.

Pushed on top of static linking as publishing neither xbps_cb_message nor show_package_msgs used in xbps-install make sense.

Also changed formatting a bit, now it looks like:

qt5ct-1.2_1 install x86_64 https://alpha.de.repo.voidlinux.org/current 825203 226027
git-lfs-2.12.1_1 install x86_64 https://alpha.de.repo.voidlinux.org/current 15180953 7175847
=== rustup-1.24.1_1: install message ===================================
Please run rustup-init after initial install to use rustup.
========================================================================
=== qt5ct-1.2_1: install message =======================================
To enable qt5ct restart the X11 server for the changes to take effect.
========================================================================
=== git-lfs-2.12.1_1: install message ==================================
Run 'git-lfs install' to configure git to use git-lfs
========================================================================

Copy link
Member

@ericonr ericonr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think an important part missing here is an option to disable printing the info. I think having messages below the summary helps with discoverability, at least, but maybe we should consider printing a message to look above the messages for the summary, if any message was printed? Might help unaware users.

Unrelated: these install msgs should all be removed.

Comment on lines 61 to 84
const char *pkgname = xbps_string_cstring_nocopy(xbps_dictionary_get(obj, "pkgname"));
xbps_dictionary_t pkgdb_pkg = pkgname ? xbps_pkgdb_get_pkg(xhp, pkgname) : NULL;
xbps_object_t previous = pkgdb_pkg ? xbps_dictionary_get(pkgdb_pkg, "install-msg") : NULL;
xbps_cb_message(xhp, obj, "install-msg", previous);
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put a comment explaining this? I don't get the logic.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here install-msg of installed version of package is read from system pkgdb, and passed to xbps_cb_message.
Then xbps_cb_message don't print message if current and previous are same.
Is doc comment of xbps_cb_message best place to write it down?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then xbps_cb_message don't print message if current and previous are same.

Not sure how I feel about this... If someone misses an INSTALL.msg, they will never see it again.

Is doc comment of xbps_cb_message best place to write it down?

Yeah, I guess so. And comment this code block "get installed version of package, if any".

Comment on lines 99 to 102
if (chars_print < sizeof bar) {
printf("%s", bar + chars_print);
}
printf("\n%s", xscd->desc);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

		if (chars_print < sizeof bar) {
			puts(bar + chars_print);
		}
                fputs(xscd->desc, stdout); // not sure if you like this one, otherwise keep the printf

Copy link
Member Author

@Chocimier Chocimier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

important part missing here is an option to disable printing the info

Why? I feel something is done wrong if this needs a toggle.

maybe we should consider printing a message to look above

May be helpful when message take all screen, indeed.

Changed fprint to fputs.

Messages during transaction are still printed, and never skipped, but this can be changed to no more print during transaction, I think.

Comment on lines 61 to 84
const char *pkgname = xbps_string_cstring_nocopy(xbps_dictionary_get(obj, "pkgname"));
xbps_dictionary_t pkgdb_pkg = pkgname ? xbps_pkgdb_get_pkg(xhp, pkgname) : NULL;
xbps_object_t previous = pkgdb_pkg ? xbps_dictionary_get(pkgdb_pkg, "install-msg") : NULL;
xbps_cb_message(xhp, obj, "install-msg", previous);
break;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here install-msg of installed version of package is read from system pkgdb, and passed to xbps_cb_message.
Then xbps_cb_message don't print message if current and previous are same.
Is doc comment of xbps_cb_message best place to write it down?

@ericonr
Copy link
Member

ericonr commented Jul 30, 2021

Why? I feel something is done wrong if this needs a toggle.

You could have read them already and not want the spam, or to pipe the output through some filter/program (even if it's not advised), or something else I can't think of.

@ericonr
Copy link
Member

ericonr commented Jul 30, 2021

And I don't see why keep the messages during installation. The most I'd do is print them after as a block reminder (but maybe only for the packages that succeeded, if a hook fails or something - assuming that's easy to implement).

@Chocimier
Copy link
Member Author

I'm not convinced about switch to disable. Config file don't fit, because you don't want to disable and forget. Flag don't fit, because existing tools won't use it, and adapted could use | sed -n '/^=/q; p' instead. What's left is env variable maybe.

You could have read them already and not want the spam

This is solved by showing message just once, administrators of multiple systems are encouraged to skim over anyway.

I don't see why keep the messages during installation.

removed

Mentioning packages list is added, but not really nice.

@Chocimier
Copy link
Member Author

Rebased, removed last line pointing to packages list and replaced static linking with exposing function, as agreed in other PR.

@Duncaen
Copy link
Member

Duncaen commented Sep 17, 2023

I don't think breaking the -n output is good, what is the reason to print them there, would stderr be ok?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants