(#11656) Documented missing errors from knowledge base

* Documented missing errors from knowledge base

* Update docs/error_knowledge_base.md

Co-authored-by: Ryan Thornton <thorntonryan@johndeere.com>

* Update docs/error_knowledge_base.md

Co-authored-by: SSE4 <tomskside@gmail.com>

* Update docs/error_knowledge_base.md

* Update error_knowledge_base.md

* attempt at summarizing "MANDATORY SETTINGS"

* add a better example for tool recipes

plus call out scripts recipes since thats a thing 🙈

* Update docs/error_knowledge_base.md

replace make with cmake because I can not read

* Update docs/error_knowledge_base.md

* Update docs/error_knowledge_base.md

* remove build script packages, too many exceptions

these are exceptional and probably a case by base is required

* note options with header only

Co-authored-by: Ryan Thornton <thorntonryan@johndeere.com>
Co-authored-by: SSE4 <tomskside@gmail.com>
This commit is contained in:
Chris Mc
2022-08-04 00:23:20 -07:00
committed by GitHub
parent 45c29a334f
commit 8432383343

View File

@@ -404,6 +404,7 @@ It may happen due to the usage of new features within recipe (such as `strip_roo
The policy of Conan Center Index to support only the latest version of the Conan Client, so it's safe to put the version Conan Center Index currently runs into the recipe.
Otherwise, it's not an easy task on its own to determine the minimal version that has to be specified: checking the Conan Client [Changelog](https://docs.conan.io/en/latest/changelog.html), one has to know in which Conan Client releases all the attributes, methods, build helpers, etc. used by the recipe were first introduced, and then select the most recent of them.
Consider adding the following code:
```python
required_conan_version = ">=1.43.0" # use the version that Conan Center Index runs
@@ -419,6 +420,7 @@ See also: [Submitting a Package](how_to_add_packages.md#submitting-a-package).
The recipe missess [short_paths](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#short-paths) attribute.
It may happen due to the very long paths within source, build or package directories during the package creating.
Consider adding the following code:
```python
class SomeRecipe(ConanFile):
...
@@ -426,7 +428,62 @@ class SomeRecipe(ConanFile):
short_paths = True
```
See also: (Maximum Path Length Limitation)[https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd].
See also: [Maximum Path Length Limitation](https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd).
#### **<a name="KB-H068">#KB-H068</a>: "TEST_TYPE MANAGEMENT"**
In Conan 2.0, see [migration guide](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#changes-in-the-test-package-recipe),
the `test_package/conanfile.py` needs to declare the requirement being tested explicitly. To be prepared you
have to set the attribute `test_type="explicit"` (this will be ignored in 2.0) to make Conan activate the explicit
mode, then declaring the requirement using the `self.tested_reference_str` that contains the reference being tested.
#### **<a name="KB-H069">#KB-H069</a>: "TEST PACKAGE - NO DEFAULT OPTIONS"**
This is to ensure the exact package that is built and uploaded is tested against. When `options` of `default_options` are modified in a
`test_package` it can possibly result in the graph being modified. The objective is to enforce quality of the packages and to avoid confusing
"missing packages" errors.
#### **<a name="KB-H070">#KB-H070</a>: "MANDATORY SETTINGS"**
> :information_source: This rule was put in place as it was deemed safe for evaluation however there is room for improvement
ConanCenter operates is profiles with a predefined list of settings, all of these much be present in the recipe to ensure `package_id`s are
computed correctly. Some libraries, for instance header-only, do not require all the settings and those should be deleted from the `package_id`.
This approach ensure consistency and reduces the learning curve.
Recipes should include:
```python
class SomeRecipe(ConanFile):
...
settings = "os", "compiler", "build_type", "arch"
```
- For header-only recipes ([example](https://github.com/conan-io/conan-center-index/blob/3a773e2d69ada3bd931252c43a48daf636ddfe87/recipes/eigen/all/conanfile.py#L35-L36)):
```python
def package_id(self):
self.info.header_only()
```
There is the case when the package is header-only, but the options affects the generated artifact, (e.g. kanguru, pagmo2 ...), so you need to use `self.info.settings.clear()` instead.
- For "tool" recipes ([example](https://github.com/conan-io/conan-center-index/blob/e604534bbe0ef56bdb1f8513b83404eff02aebc8/recipes/cmake/3.x.x/conanfile.py#L104-L105)) which only provide binaries, see [our packing policy](packaging_policy.md#settings) for more, should do as follows:
```python
def package_id(self):
del self.info.settings.compiler
```
#### **<a name="KB-H071">#KB-H071</a>: "INCLUDE PATH DOES NOT EXIST"**
It's erroneous to leave the default `include` directory when it's not present. Consider adding:
```python
def package_info(self):
self.cpp_info.includedirs = []
```
# Deprecated errors