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

Allow passing patterns to --update argument #15652

Merged
merged 16 commits into from
Feb 15, 2024

Conversation

AbrilRBS
Copy link
Member

@AbrilRBS AbrilRBS commented Feb 12, 2024

Changelog: Feature: Add ability to pass patterns to --update flag.
Docs: conan-io/docs#3587

Got bitten because I wanted to update a specific package coming from a version range on a dependency graph, but thought that it was too wasteful to have the whole graph updated which I didnt care about.

The thing that took most of the time was checking the already present --update tests

Importantly, the old syntax still works and means "update all".

This helps to reduce processing time of graph computation when you want to update only specific references

Closes #2615

@AbrilRBS AbrilRBS requested a review from memsharded February 12, 2024 20:24
parser.add_argument("-u", "--update", action='store_true', default=False,
help=update_help)

parser.add_argument("-u", "--update", action="append", nargs="?", help=update_help, const=True)
Copy link
Member Author

Choose a reason for hiding this comment

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

const=True does not mean that the value is const, rather, when no argument is supplied, it will append True in this case to the list

conans/client/graph/proxy.py Outdated Show resolved Hide resolved
conans/client/graph/proxy.py Outdated Show resolved Hide resolved
conans/client/graph/proxy.py Outdated Show resolved Hide resolved
conans/test/integration/cache/cache2_update_test.py Outdated Show resolved Hide resolved
add_profiles_args(parser)


def protect_update(args):
Copy link
Member Author

Choose a reason for hiding this comment

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

Used to check in the tests that no leftover if update: is left, will remove before merging

@AbrilRBS AbrilRBS marked this pull request as ready for review February 13, 2024 14:09
@AbrilRBS AbrilRBS added this to the 2.1 milestone Feb 13, 2024
@AbrilRBS AbrilRBS changed the title Initial sketch for passing patterns to --update argument Allow passing patterns to --update argument Feb 13, 2024
Copy link
Contributor

@czoido czoido 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 this could be useful, maybe we could add some test cases like:

conan install .. --update=zlib --update=openssl
conan install .. --update=!zlib 

conans/client/graph/range_resolver.py Show resolved Hide resolved
conans/client/graph/proxy.py Outdated Show resolved Hide resolved
conans/client/graph/proxy.py Outdated Show resolved Hide resolved
parser.add_argument("-u", "--update", action='store_true', default=False,
help=update_help)

parser.add_argument("-u", "--update", action="append", nargs="?", help=update_help, const="*")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should also update the update_help text?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops good catch, will do right now

@czoido czoido merged commit 0bad0d1 into conan-io:develop2 Feb 15, 2024
2 checks passed
@AbrilRBS AbrilRBS deleted the rr/update-patterns branch February 15, 2024 11:19
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.

--update=<pattern>
3 participants