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

conan remote remove fails with editable packages #5424

Closed
lasote opened this issue Jul 2, 2019 · 4 comments · Fixed by #5461

Comments

@lasote
Copy link
Contributor

commented Jul 2, 2019

Trying to update the metadata, it fails because the PackageEditableLayout has no update_metadata(). The main questions are:

  • Should the editable packages still have the metadata methods available?
    or
  • Should we force always to retrieve the PackageCacheLayout sometimes, e.g from the remote_registry.py?
Traceback (most recent call last):                                                                                                                                                                                                                                             
  File "/home/luism/workspace/conan_sources/conans/client/command.py", line 1832, in run                                                                                                                                                                                       
    method(args[0][1:])                                                                                                                                                                                                                                                        
  File "/home/luism/workspace/conan_sources/conans/client/command.py", line 1423, in remote                                                                                                                                                                                    
    return self._conan.remote_remove(remote_name)                                                                                                                                                                                                                              
  File "/home/luism/workspace/conan_sources/conans/client/conan_api.py", line 77, in wrapper                                                                                                                                                                                   
    return f(*args, **kwargs)
  File "/home/luism/workspace/conan_sources/conans/client/conan_api.py", line 922, in remote_remove
    return self._cache.registry.remove(remote_name)
  File "/home/luism/workspace/conan_sources/conans/client/cache/remote_registry.py", line 301, in remove
    with self._cache.package_layout(ref).update_metadata() as metadata:
AttributeError: 'PackageEditableLayout' object has no attribute 'update_metadata'
@lasote

This comment has been minimized.

Copy link
Contributor Author

commented Jul 2, 2019

@memsharded I would like to know what do you think about this.

@memsharded

This comment has been minimized.

Copy link
Member

commented Jul 2, 2019

I think that so far it doesn't make sense, as metadata are revisions (we don't have them while editable) and remote (same). If the package is in editable mode, I think doesn't make much sense to return PackageCacheLayout for it, so far the PacakgeEditableLayout have placeholder methods to provide better error messages.

@lasote

This comment has been minimized.

Copy link
Contributor Author

commented Jul 3, 2019

Agree. But then what, how to solve this issue? Should the remote remove just ignore the editable layouts? When the package is no longer in "editable mode" it will have metadata with a wrong remote (removed).

@memsharded

This comment has been minimized.

Copy link
Member

commented Jul 3, 2019

I see, you are right.

I think there are 2 approaches:

  • Explicit force to get the cache metadata, like: with self._cache.package_layout(ref, from-cache=True).update_metadata() as metadata:
  • Explicit disabling of editables, like in the RemoteRegistry.remove make cache.editables = {} and at the end of the function restore it.

I think at the moment I prefer the later one, until we have more cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.