-
Notifications
You must be signed in to change notification settings - Fork 171
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-diff: support lightweight ostree import for RPM diff #4030
base: main
Are you sure you want to change the base?
Conversation
Since python has propoer boolean types we should be using that here.
Being able to diff two builds is now a very lightweight: ``` cosa buildfetch --build=A cosa buildfetch --build=B cosa diff --rpms --from=A --to=B ``` Previously this was hundreds of MiB and now it's in the KiB range.
a9af6c8
to
6b0a237
Compare
``` DeprecationWarning: datetime.datetime.utcnow() is deprecated and scheduled for removal in a future version. Use timezone-aware objects to represent datetimes in UTC: datetime.datetime.now(datetime.UTC). ```
I think it's of limited use that we arbitrarily hit some threshold and then are urged to write more tests by a percentage metric here. Let's just drop it.
6b0a237
to
1af3949
Compare
If you want to see these commands in action you can check out the few comments starting at containers/podman#25121 (comment) |
Useful for trying to determine the changes that occured for two builds that were outside of RPM changes. Example: ``` $ cosa diff --source-control --from=42.20240919.91.0 --to=42.20240920.91.0 https://github.com/coreos/fedora-coreos-config: 80f646d..051fb67 --> coreos/fedora-coreos-config@80f646d...051fb67 https://github.com/coreos/coreos-assembler.git: d3302e0..d3302e0 --> coreos/coreos-assembler@d3302e0...d3302e0 ```
1af3949
to
fe5fba7
Compare
@@ -31,7 +31,7 @@ class DiffBuildTarget: | |||
class Differ: | |||
name: str | |||
description: str | |||
needs_ostree: bool | |||
needs_ostree: str |
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.
This would be cleaner as an enum.
ostree_import = '' | ||
for differ in active_differs: | ||
if differ.needs_ostree == 'yes': | ||
ostree_import = 'full' | ||
# If we need a full import for one then we don't | ||
# need to check the others. | ||
break | ||
elif differ.needs_ostree == 'partial': | ||
ostree_import = 'partial' | ||
if ostree_import != '': |
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.
If we change it to an enum as suggested in the previous comment, then this could be e.g.
ostree_import = max([d.needs_ostree for d in active_differs])
if ostree_import > OstreeImport.NONE:
...
..., partial_import=(ostree_import == OstreeImport.PARTIAL))
if not config_shared_history: | ||
# If they weren't from the same repo/branch, etc then | ||
# there's not really any way to compare them easily | ||
# so just output the details gorry details and move on. |
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.
details twice
also s/gorry/gory/
@@ -114,6 +114,30 @@ def parse_args(): | |||
return parser.parse_args() | |||
|
|||
|
|||
def diff_source_control(diff_from, diff_to): |
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.
This is fine and clearly useful as is, but assuming that it's on GitHub seems like a leap for the developer case, no? It seems like it'd be cleaner to just do the git diff ourselves given that we have src/config
.
I guess for the cosa case, the GitHub link is the best we can do.
Being able to diff two builds is now a very lightweight:
Previously this was hundreds of MiB and now it's in the KiB range.
EDIT: Added another commit:
cmd-diff: support showing source-control diffs for two builds
Useful for trying to determine the changes that occured for two builds
that were outside of RPM changes. Example: