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

[question] conan upload --only-recipe doesn't work with --list #15169

Closed
1 task done
PeteAudinate opened this issue Nov 23, 2023 · 12 comments · Fixed by #15312
Closed
1 task done

[question] conan upload --only-recipe doesn't work with --list #15169

PeteAudinate opened this issue Nov 23, 2023 · 12 comments · Fixed by #15312
Assignees
Labels
component: ux No changes to core business logic type: question
Milestone

Comments

@PeteAudinate
Copy link

What is your question?

The docs for conan upload say:

--only-recipe Upload only the recipe/s, not the binary packages.

However when using the --list argument, if the package list contains binary packages then they are uploaded regardless.

https://github.com/conan-io/conan/blob/release/2.0/conan/cli/commands/upload.py#L93 seems to confirm that --only-recipe is only used when converting from a pattern to a package list.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded
Copy link
Member

Hi @PeteAudinate

The --only-recipe is there in the upload and download commands to counter balance the default package_id="*". Because that is the default conan upload * will upload all the binaries, there is need for an option to upload only the recipe, and that cannot be done with just the "pattern" approach, and an explicit argument is required.

On the other hand, the conan list command do not default to list all binaries, and conan list * only list recipes, not binaries. Opting-in to list binaries is easy with a pattern approach conan list *:*.

This difference is because the expected default behavior and common user errors are different for different commands. conan upload not uploading binaries by default is confusing and unexpected, while conan list * listing all binaries for all versions for all recipes is both very slow and unexpected in the vast majority of cases.

@memsharded memsharded self-assigned this Nov 23, 2023
@PeteAudinate
Copy link
Author

PeteAudinate commented Nov 24, 2023

Thanks @memsharded, that makes sense.

We're using the following from https://docs.conan.io/2.0/examples/commands/pkglists.html#building-and-uploading-packages:

conan create . --format=json > create.json
conan list --graph=create.json --graph-binaries=build --format=json > pkglist.json
conan upload --list=pkglist.json -r=myremote -c

But in some cases we wanted to only upload the recipe that was built, but we couldn't find a way using the above.

The conan upload docs made us confident that adding --only-recipe to the above should only upload recipes. Your explanation for why it doesn't work makes sense, but isn't reflected in the docs.

@PeteAudinate
Copy link
Author

In our case, since we know the names of the package we want to upload, we can:

conan upload package_name --only-recipe -r=myremote

@memsharded
Copy link
Member

I think what you are looking for is the creating of pkglist.json.
Instead of

conan list --graph=create.json --graph-binaries=build --format=json > pkglist.json

using

conan list --graph=create.json --graph-recipes="*" --format=json > pkglist.json

will give you a pkglist.json that contains only the recipes, but not the binaries.

The conan upload docs made us confident that adding --only-recipe to the above should only upload recipes. Your explanation for why it doesn't work makes sense, but isn't reflected in the docs.

yes, this might need some clarification, or maybe even some UX fix, raising an error. The --only-recipe is an argument that applies to "pattern" based selection of packages. When the argument is a pkglist, this argument is not used.

@PeteAudinate
Copy link
Author

using

conan list --graph=create.json --graph-recipes="*" --format=json > pkglist.json

will give you a pkglist.json that contains only the recipes, but not the binaries

That seems to emit all recipes, not just the one that was built. So it's not quite equivalent to --graph-binaries=build. I tried --graph-recipes=build, but that emits "Local Cache": {}.

@memsharded
Copy link
Member

I see. There is no concept of "recipes that were built", only the packages are built, so only --graph-binaries can be used to filter based on that concept, and --graph-recipes can be used to filter by recipe status (with values as "Downloaded", etc).

In any case, is it really a problem? Conan avoids transfers completely if the revision already exist in the server, so uploading all graph dependencies recipes shouldn't be slow, as it will skip most of them. And recipes need to be in the server anyway, otherwise the graph and those packages will not be possible to be installed, because they will fail because of missing dependencies?

@PeteAudinate
Copy link
Author

Ha, good point! You're quite right, what we were attempting wasn't very sensible. Thanks :-).

@memsharded
Copy link
Member

Hi @PeteAudinate

Any further feedback here? Can we close the issue? Thanks!

@memsharded memsharded added type: question staled The issue has been inactive for a while and will be closed soon and removed stage: triaging labels Dec 20, 2023
@PeteAudinate
Copy link
Author

Thanks, happy to close. Though as you noted above, the docs or UX should make it clear that --only-recipes is ignored if --list is used.

@PeteAudinate PeteAudinate closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2023
@memsharded
Copy link
Member

Sure, I missed that part, lets fix that quickly.

@memsharded memsharded reopened this Dec 20, 2023
@memsharded memsharded added component: ux No changes to core business logic and removed staled The issue has been inactive for a while and will be closed soon labels Dec 20, 2023
@memsharded memsharded added this to the 2.1 milestone Dec 20, 2023
@AbrilRBS
Copy link
Member

We have decided to make --list and --recipe-only able to work together, in Conan 2.1 only the recipes for the listed packages will be uploaded if used with the --recipe-only option, thanks a lot for your feeback

@PeteAudinate
Copy link
Author

That's great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ux No changes to core business logic type: question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants