Git Product home page Git Product logo

Comments (4)

AbrilRBS avatar AbrilRBS commented on August 19, 2024 1

Hi @wuziq thanks for the question. You're mostly on point with your discoveries, and it does boil down to the trimming of the conandata.yml file!

We don't have this hook installed, so why are we seeing this behavior while building boost?

As I see, you're using the local recipes index remote type, and one of its goals is to match the behaviour of Conan Center Index, where we do trim the conandata for each version, so that recipes fetched from this remote type algo get trimmed.
You're not seeing this behaviour when compiling it because the trim happens internally within the local remote.

For you to get the same behaviour of locally created packages, you do need to have a post_export() hook that calls [conan.tools.files.conandata.trim_conandata()](https://docs.conan.io/2/reference/tools/files/basic.html#conan.tools.files.conandata.trim_conandata).
This file needs to go into your <conan2_home>/extenions/hooks/ folder (docs for naming conventions etc here), something like:

~/.conan2/extensions/hooks/hook_trim_conandata.py

from conan.tools.files.conandata import trim_conandata

def post_export(conanfile):
    trim_conandata(conanfile)

The way to share/install this across your developers would be using the conan config install command and associated features, docs here

Let me know if this helps :)

from conan.

wuziq avatar wuziq commented on August 19, 2024

Fascinating, thank you! This leads me to another question. When building our own private conan center index, should we not be calling conan create as I showed above? Should we be building the recipes differently? We don't mind using the hook, but we're curious whether we can avoid adding the hook.

We are following this: https://docs.conan.io/2/devops/conancenter/hosting_binaries.html It says to create a list of the packages we want, and to then call conan create --build=missing.

However, I just noticed in another document (https://docs.conan.io/2/devops/devops_local_recipes_index.html#building-binaries-from-a-private-conan-center-index-fork), it says to use conan install --requires=....

Which is correct?

Maybe we are not calling conan create correctly?

from conan.

AbrilRBS avatar AbrilRBS commented on August 19, 2024

Extra note about my prior message:
Note that trim_conandata() raises if any of your packages does not have a conandata.yml file. If this is undesired, pass False as the second parameter which will disable the behaviour and silently do nothing

When building our own private conan center index, should we not be calling conan create as I showed above?

You are calling conan create mostly correctly :) I'll explain the differences between the install and create below, but for now:

  • Positional arguments should come before names ones, so try to have conan create ./conan-center-index/recipes/zlib/all --build=missing --name zlib --version 1.3.1 -pr:a=default -r local-index instead of adding the path to the end of the command. This can save you from some hard to debug issues later on if we happen to change some syntax in the argument parser
  • No need to add --name=zlib, it is included in every CCI recipe by default
  • Use = to separate argument names from values (so --version=1.3.1 instead of --version 1.3.1), it will save you some possible issues too :)

The docs mention conan install because the idea there is that you're not creating the packages, but using them as part of the dependencies for a project you're running, but which you're not creating the package at that moment. Your conan create call is best suited for your case, as you want to create the zlib package and be able to later upload it to a remote/use it from your cache, which is different than having the recipe be available from a local recipes index :)

from conan.

wuziq avatar wuziq commented on August 19, 2024

Thank you!

from conan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.