-
Notifications
You must be signed in to change notification settings - Fork 991
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
Add conan graph outdated command #15838
Add conan graph outdated command #15838
Conversation
conan/cli/commands/graph.py
Outdated
except Exception: | ||
ConanOutput(f"{node_name} not found in remote {remote.name}") | ||
continue |
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.
Too broad exception. If the repo is off-line this should actually raise an error an stop.
Better:
- Only capture specific exceptions
- The
ConanOutput(msg)
is wrong, this means this is at least not tested.
tc.save({"conanfile.py": GenConanfile()}) | ||
tc.run("create . --name=zlib --version=1.0") | ||
|
||
tc.run("create . --name=foo --version=1.0") | ||
tc.save({"conanfile.py": GenConanfile().with_requires("foo/[>=1.0]")}) | ||
tc.run("create . --name=libcurl --version=1.0") | ||
|
||
# Upload the created libraries to remote | ||
tc.run("upload * -c -r=default") | ||
|
||
# Create new version of libraries in remote and remove them from cache | ||
tc.save({"conanfile.py": GenConanfile()}) | ||
tc.run("create . --name=foo --version=2.0") | ||
tc.run("create . --name=zlib --version=2.0") | ||
tc.run("upload * -c -r=default") | ||
tc.run("remove foo/2.0 -c") | ||
tc.run("remove zlib/2.0 -c") | ||
|
||
tc.save({"conanfile.py": GenConanfile("app", "1.0").with_requires("zlib/1.0", "libcurl/[>=1.0]")}) |
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 whole preparation of the test could be more compact and clear
tc.save({"conanfile.py": GenConanfile()}) | ||
tc.run("create . --name=zlib --version=1.0") | ||
tc.run("create . --name=foo --version=1.0") | ||
|
||
tc.save({"conanfile.py": GenConanfile().with_requires("foo/[>=1.0]")}) | ||
tc.run("create . --name=libcurl --version=1.0") | ||
|
||
# Upload the created libraries to remote | ||
tc.run("upload * -c -r=default") | ||
|
||
# Create new version of libraries in remote and remove them from cache | ||
tc.save({"conanfile.py": GenConanfile()}) | ||
tc.run("create . --name=foo --version=2.0") | ||
tc.run("create . --name=zlib --version=2.0") | ||
tc.run("upload * -c -r=default") | ||
tc.run("remove foo/2.0 -c") | ||
tc.run("remove zlib/2.0 -c") | ||
|
||
tc.save({"conanfile.py": GenConanfile("app", "1.0").with_requires("zlib/1.0", |
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.
Repeated to previous test, consider refactoring. Most likely you want a test that is parameterized, if is is very similar, just with or without lockfile.
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.
Getting there, some more comments and improvements, but getting closer :)
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.
Looking good
conan/cli/commands/graph.py
Outdated
except ConanException as message: | ||
ConanOutput().warning(f"{message} in remote {remote.name}") | ||
continue |
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.
When does this fail? Should it be a warning in all cases?
It is not the same that the remote is unavailable => should raise an error, that the package is not in the remote, which is ok, and shouldn't even warn
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 it okey to remove the message then? We need to catch the exception when it doesn't find anything but maybe the continue is enough.
Do we want to additionally handle the error you mention when it can't connect to the remote?
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.
yes, you need to treat the different errors differently. Connection errors are bad, should be raised. 404-not found are not really an error in this context, not even a warning.
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.
Improvements in tests pending too.
conan/cli/commands/graph.py
Outdated
continue | ||
except ConanException as message: | ||
ConanOutput().warning(f"{message} in remote {remote.name}") | ||
except ConanConnectionError as error: |
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 not fully correct. There are other exceptions like AuthenticationException, \ ForbiddenException, RequestErrorException
that are not a ConnectionError, and it still should be considered an error, not silently skipped. It is only when the server succesfully returns a 404-not found that we can continue
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.
Looks good.
I think that second except-raise is unnecessary
Co-authored-by: James <memsharded@gmail.com>
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.
LGTM!
Changelog: Feature: Add
conan graph outdated
command that lists the dependencies that have newer versions in remotesDocs: conan-io/docs#3641
The command looks for newer versions of a recipe and its dependencies in the remotes, and displays the available versions. It also shows the version ranges for each library.
It requires the path to a conanfile or an specific library with
--requires
.The remotes which should be looked at can be defined with
--remote
.Possible updates:
Closes #9823
#7778
develop
branch, documenting this one.