-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
cmd/info: show size information #18172
base: master
Are you sure you want to change the base?
Conversation
|
||
private | ||
|
||
def manifest_annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this safe to cache?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think so?
bottle_size = bottle.bottle_size | ||
puts "Bottle size: #{disk_usage_readable(bottle_size)}" if bottle_size.positive? | ||
installed_size = bottle.installed_size | ||
puts "Installed size: #{disk_usage_readable(installed_size)}" if installed_size.positive? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently looks like
Bottle size: 5MB
Installed size: 16.0MB
For comparison
- Apt uses
Download-Size
andInstalled-Size
. - https://archlinux.org/packages shows
Package Size
andInstalled Size
.
Also, mainly an approximate if pouring bottle into non-standard prefix.
@@ -45,6 +45,8 @@ class Info < AbstractCommand | |||
switch "--github", | |||
description: "Open the GitHub source page for <formula> and <cask> in a browser. " \ | |||
"To view the history locally: `brew log -p` <formula> or <cask>" | |||
switch "--github-manifest", | |||
description: "Fetch Github package manifest for extra information when <formula> is not installed." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
description: "Fetch Github package manifest for extra information when <formula> is not installed." | |
description: "Fetch GitHub package manifest for extra information when <formula> is not installed." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to me so far, nice work!
Would be interested (post-merge) in benchmarks for this so we can consider how to get to being able to put these in the API.
CC @reitermarkus also for thoughts on whether the parallel downloading work overlaps here and when it might be ready.
@@ -45,6 +45,8 @@ class Info < AbstractCommand | |||
switch "--github", | |||
description: "Open the GitHub source page for <formula> and <cask> in a browser. " \ | |||
"To view the history locally: `brew log -p` <formula> or <cask>" | |||
switch "--github-manifest", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work with --json?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not yet. Haven't had time to look at that code path. Also need to figure out the path to get information to formulae.brew.sh, which may be similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeh, it's that code path. If it doesn't work for now: might be worth marking as conflicting?
|
||
private | ||
|
||
def manifest_annotations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Think so?
end | ||
|
||
def bottle_size | ||
manifest_annotations["sh.brew.bottle.size"].to_i |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
manifest_annotations["sh.brew.bottle.size"].to_i | |
manifest_annotations.fetch("sh.brew.bottle.size").to_i |
or
manifest_annotations["sh.brew.bottle.size"].to_i | |
manifest_annotations["sh.brew.bottle.size"]&.to_i |
depending on whether manifest_annotations
is supposed to always have that key.
Yes, slight overlap, but the changes to |
brew style
with your changes locally?brew typecheck
with your changes locally?brew tests
with your changes locally?Follow up to #18144
Proof of concept for now on getting size info into
brew info
.May need to see if any better ways to get this information out of the manifest. A bit trickier than just tab info.