conan-io / hooks

Official Conan client hooks
MIT License
32 stars 46 forks source link

check for patches not referenced in conandata.yml #536

Closed ericLemanissier closed 4 months ago

ericLemanissier commented 5 months ago

reimplement part of https://github.com/ericLemanissier/conan-center-lint-patches/blob/main/lint_patches.py results are tracked in https://github.com/conan-io/conan-center-index/issues/21146

ericLemanissier commented 5 months ago

last PRs fixing offenders:

ericLemanissier commented 5 months ago

I tried all recipes in CCI with

#!/bin/bash
conan config set hooks.conan-center
export CONAN_HOOK_ERROR_LEVEL=40
last_package_folder=""
find . -mindepth 1 -maxdepth 1 -type d  -printf '%f\n' | while read -r package; do
    yq '.versions | to_entries[] | "\(.key) \(.value.folder)"' "$package/config.yml" -r | while IFS= read -r line; do
        IFS=' ' read -r version folder <<< "$line"
        if [ "$package/$folder" != "$last_package_folder" ]; then
            last_package_folder="$package/$folder"
            conan export $package/$folder "$package/$version@"
        fi
    done
done

     

Results:

Hooks errors not related to this change

(it looks like https://github.com/conan-io/conan-center-index/issues/20516#issue-1937384862 does not work any more):

uilianries commented 5 months ago

Nice! I see it as a good improvement, but I would prefer fixing all recipes first, because it's classified as error. Otherwise, any non-related PR would be broken.

ericLemanissier commented 5 months ago

sure, I'll do all the PRs

ericLemanissier commented 5 months ago

@uilianries done, I integrated the information in my message above

ericLemanissier commented 5 months ago

As you wanted, all the patches are now grouped on the same line instead of one line per patch. Here are two examples of logs generated:

[HOOK - conan-center.py] pre_export(): ERROR: [NO DANGLING PATCHES (KB-H078)] Following patch file(s) are/is not referenced in conandata.yml: patches/2.13.0-0001-fix-fallthrough.patch (https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#KB-H078-NO-DANGLING-PATCHES)
[HOOK - conan-center.py] pre_export(): ERROR: [NO DANGLING PATCHES (KB-H078)] Following patch file(s) are/is not referenced in conandata.yml: patches/1.1.1.patch, patches/fix-cmake-source-dir-and-targets.patch, patches/pstring.patch, patches/strlen.patch (https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#KB-H078-NO-DANGLING-PATCHES)

I don't think it's more readable, but as you want

ericLemanissier commented 5 months ago

@uilianries all the fixes have been merged. The only offenders remaining are either deprecated, or not compatible with conan 2.

ericLemanissier commented 5 months ago

@jcar87 What's the opinion of the team regarding this change ?

ericLemanissier commented 4 months ago

@jcar87 @uilianries can we please have an update on the status of this PR ?

ericLemanissier commented 4 months ago

https://github.com/conan-io/conan-center-index/pull/24165