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

cmd_clean command removes wrong packages #44

Open
antze-k opened this issue Oct 20, 2022 · 3 comments
Open

cmd_clean command removes wrong packages #44

antze-k opened this issue Oct 20, 2022 · 3 comments
Assignees

Comments

@antze-k
Copy link

antze-k commented Oct 20, 2022

The command removes all package revisions except for the latest one from a recipe, but not a package. This leads to the following: if I build two packages for a single recipe, for example, Debug and Release one, "conan clean" removes one of them (the one that was built the first, I suppose).

I think the correct behaviour would be if this:

all_prevs = conan_api.search.package_revisions(f"{rrev.repr_notime()}:*#*", remote=remote)
# ...

is replaced with this:

packages = conan_api.list.packages_configurations(rrev, remote=remote)
for package in packages:
    all_prevs = conan_api.search.package_revisions(repr(package), remote=remote)
    # ...

At least, with such fix the behaviour looks like what I expected, so far.

@memsharded memsharded self-assigned this Oct 20, 2022
@memsharded
Copy link
Member

I see, yes, I think you are right.

But I think the right solution is not to change the logic to adapt it, but to simplify the example, simplifying the assumptions to "a command that removes all recipe revisions of a package except the last one", not mixing the behavior for also package revisions. Checking with team for feedback.

@antze-k
Copy link
Author

antze-k commented Oct 20, 2022

Both functionalities are actually handy. When I found this example initially (along with the possibility of writing custom commands), it helped me a lot, because the use case "remove everything from the cache that I don't need anymore" is very common for me.

Anyway, it's an example, not a core Conan command, so I guess any decision is fine. I'd also like to remind that the whole command code is also available in the docs, so it has to be fixed in the docs repo as well. I could contribute and help with that if you like, whenever you're settled with the final decision.

@memsharded
Copy link
Member

Both functionalities are actually handy. When I found this example initially (along with the possibility of writing custom commands), it helped me a lot, because the use case "remove everything from the cache that I don't need anymore" is very common for me.

Yes, the functionality is handy, but this is not an example of cleaning things in the cache, it is an example of how to write a custom command, the focus should be in the command syntax, not very elaborate logic on the "clean" part. Lets see what @czoido thinks about it.

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

No branches or pull requests

3 participants