Fix removing conan manifest recipe file by cleanup policy

Context

When using $ conan upload to publish a package and pass the option --all, conan client will upload the package recipe and all the generated binary packages to a specified remote.

The package recipe has its own conanmanifest.txt file, and the uploaded package also has its own conanmanifest.txt file. That means there are two legit conanmanifest.txt files for the same package: one for the recipe, and the other for the binary package:

Screenshot_2024-07-24_at_18.37.16

Now, how packages cleanup policy works? In the project settings, we configure the max no. of files we need to keep as duplicates for a package. So, if we configured this no. as "1", then the policy would detect that the conanmanifest.txt are duplicates, and it would remove one of them and keep the other.

And to make things worse, the file that would be deleted is the conanmanifest.txt of the recipe, since it was uploaded first, and the policy's behavior is to keep the latest uploaded file and remove the first uploaded one.

Without this conanmanifest.txt file of the recipe, $ conan is unable to find out how to get the needed information about the package, which is a needed step before executing $ conan upload.

To fix the issue, we need to instruct the Packages::Cleanup::ExecutePolicyService so it skips deleting the conanmanifest.txt file of the recipe when it tries to clean up the duplicates.

What does this MR do and why?

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Follow the same steps mentioned here. The error shouldn't be shown on this branch. However, on master, the error will be raised.

Related to #455041 (closed)

Edited by Moaz Khalifa

Merge request reports

Loading