question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] Alternative to conandata.yml

See original GitHub issue

Our internal package repository is structured in a similar way to CCI. Thus we also place a conandata.yml file next to conanfile.py where we specify download urls and hashes for the sources of the package.

While this works great, it has one big drawback: when adding a new version of a library, the package gets a new revision (because the conandata.yml calculates into the package hash), and all previously build packages versions will be rebuild, though effectively nothing has changed for them.

Has anyone experimented with any alternative approaches to tackle this problem?

E.g. basically two things come to my mind: move the information from conandata.yml to config.yml (up one folder) which effectively is NOT part of the recipe, and have the conanfile.py be a template, into which that information is injected prior to conan exporting it. Or, somehow injecting it to the conan export command, the same way, --version 1.x.y is already injected to the recipe.

The latter approach definately needs some Conan feature to realize it, on the first one, you probably need some python / scripting logic to get from a template to an actual conanfile.py.

A jinja template for a conanfile like that could basically be like:

class CMakeConan(ConanFile):
    name = "cmake"
    version = {{ version }}
    settings = "os"

    def sources(self):
            download_info["url"] = {{ url }}
            download_info["sha256"] = {{ sha256 }}
            tools.get(**download_info)

Thus without a conandata.yml file, but the following config.yml

versions:
  "3.14.0":
    folder: all
    url: https://path/to/source-3.14.0.zip
    sha: a42503efae....
  "3.15.5":
    folder: all
    url: https://path/to/source-3.15.5.zip
    sha: 29371eaf49...

Does anybody take a similar approach? Any thoughts?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
KerstinKellercommented, Apr 6, 2021

Works like a charm! Thanks again.

1reaction
memshardedcommented, Apr 1, 2021

Any way to roll out the hook to everybody, except manually via conan config set or globally via distributing a common conan.conf?

Yes, conan config install works incrementally for conan.conf. So having the hook in the repo, plus a conan.conf that contains only the [hooks] section with your hook name to activate it, would apply it without touching the cache path that can be different for everybody.

Read more comments on GitHub >

github_iconTop Results From Across the Web

conandata.yml — conan 1.44.1 documentation
This YAML file can be used to declare specific information to be used inside the recipe. This file is specific to each recipe...
Read more >
Newest 'conan' Questions - Stack Overflow
Is there any way to write anything to conandata.yml file? I want calculate execution time of code and populate my conandata.yml with it....
Read more >
interpeer/caprock: A distributed object capability ... - Codeberg
CAProck has a similar purpose, and shares some design fundamentals. ... It helps strengthen authentication, a problem that is orthogonal/complementary to ...
Read more >
New downloads cache, store scm data in conandata.yml ...
Now, if you do a conan create . on this recipe and go to the package folder in the local cache you will...
Read more >
Conan Package Manager for C++ in Practice @ Core ... - JFrog
all right there's a question if does this exercise ... as an alternative to installing these ... which exists under conan data can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found