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

selfupdate: Prints number of outdated ports after updating ports tree #314

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

Conversation

thelastlin
Copy link

Hi,

Here is a tiny suggestion about user interface.
People may want to know how many ports can be upgraded after the ports tree has been updated by port selfupdate.

This patch prints about numbers of outdated ports like this:

# port selfupdate
--->  Updating MacPorts base sources using rsync
MacPorts base version 2.8.1 installed,
MacPorts base version 2.8.1 downloaded.
--->  Updating the ports tree
--->  MacPorts base is already the latest version

The ports tree has been updated. To upgrade your installed ports, you should run
  port upgrade outdated

2 ports are outdated. Run 'port outdated' to see them.

and when no installed ports are outdated will look like this:

# port selfupdate
--->  Updating MacPorts base sources using rsync
MacPorts base version 2.8.1 installed,
MacPorts base version 2.8.1 downloaded.
--->  Updating the ports tree
--->  MacPorts base is already the latest version

The ports tree has been updated. To upgrade your installed ports, you should run
  port upgrade outdated

All installed ports are up to date.

Copy link
Member

@jmroot jmroot left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. This would close https://trac.macports.org/ticket/33820.

src/macports1.0/selfupdate.tcl Outdated Show resolved Hide resolved
This commit declares updatestatusvar in selfupdate::main as a dict,
indicates that whether we updated base and portindex is needed.
@@ -2798,6 +2798,20 @@ proc action_selfupdate { action portlist opts } {
fatal "port selfupdate failed: $result"
}

if {![info exists options(ports_${action}_no-sync)] || !$options(ports_${action}_no-sync)} {
if {[dict get $selfupdate_status needed_portindex]} {
Copy link
Author

@thelastlin thelastlin Jan 3, 2024

Choose a reason for hiding this comment

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

Does needed_portindex actually required if the port base has been updated with no --no-sync given?

Seems that we can just check base_updated at here to print messages for rerun port selfupdate.

Copy link
Member

Choose a reason for hiding this comment

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

Moving this message to port.tcl looks good to me, as it is up to the client to restart the selfupdate (or ask the user to do so).

The check for --no-sync is the same as inside the macports1.0 API and that seems redundant. The needed_portindex would not be set otherwise.

But your change lost the condition on base_updated here.

As a side note, the macports1.0 API change is not backwards compatible, so we should only ship this with the next 2.x.0 release.

Copy link
Author

Choose a reason for hiding this comment

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

The check for --no-sync is the same as inside the macports1.0 API and that seems redundant. The needed_portindex would not be set otherwise.

Checking for --no-sync might be required for messages about restarting the selfupdate at here.
It can be returned by macports::selfupdate, but I'm not sure if it's necessary since there are some similar checks in port.tcl.

But your change lost the condition on base_updated here.

The check for base_updated might not be required at here, asportindex may not running in some cases:

set needs_portindex false

Copy link
Member

Choose a reason for hiding this comment

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

This is when the ports tree was downloaded, but the Portfiles use new features of base, so they cannot be parsed with the old version. The message being printed only makes sense when base was updated.

@KJshuhj

This comment was marked as off-topic.

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