Skip to content

How to inject manually downloaded 3rd party source code of a conan center recipe? #4578

Open

Description

@Jochen0x90h

Hi!
Due to a firewall, conan can't download for example libiconv-1.17.tar.gz form https://ftpmirror.gnu.org/gnu/libiconv/. Is there a way to download it manually and then tell conan to use it instead of downloading it? I already tried core.sources:download_urls = ["http://localhost:8080/", "origin"] in global.conf and then use a python http server, but it needs a complex .json file next to the downloaded file itself (which is renamed to the hash using sha256sum).

Is the format of the .json documented? Or is there another way to inject libiconv-1.17.tar.gz?

Thanks,
Jochen

Activity

  1. self-assigned this
    on Nov 9, 2026
  2. memsharded commented on Nov 9, 2026

    @memsharded
    Member

    Hi @Jochen0x90h

    Thanks for your question.

    If you can execute Conan commands in an internet connected machine, then something like:

    conan graph info --requires=libiconv/version -c tools.build:download_source=True
    conan cache backup-upload
    

    with the configuration as defined in https://docs.conan.io/2/devops/backup_sources/sources_backup.html

    That will manage to download the sources then upload only the tarball to your http repo, without creating or uploading packages, just the source tarball, with the files it needs.
    It is also possible to do a conan source --version=<version> command on the recipe to force the download, then run conan cache backup-upload.

    Please let me know if this helps

  3. memsharded commented on Nov 9, 2026

    @memsharded
    Member

    I am creating an example in the docs for this explicit use case: #4579

  4. Jochen0x90h commented on Nov 9, 2026

    @Jochen0x90h
    Author

    I'm looking for a manual process, i.e. obtain a missing tarball somewhere else (other page or via USB stick), then rename it to its sha256 using sha256sum and then put it somewhere where conan finds it. It almost works when putting it into a directory and serve it with python -m http.server 8080, but conan also needs a .json file next to it. Conan could simply ignore a missing .json file or is any essential information in it? I now found the solution of copying and modifying the recipe to let it point to some file:/// url and then exporting it again.

  5. memsharded commented on Nov 9, 2026

    @memsharded
    Member

    At the moment, as the backup-sources feature was designed to be uploaded by Conan and not manually, the .json file is necessary.
    But it is relatively simple, my PR above is showing an example:

    {
          "references": {
            "libiconv/1.17": [
              "https://ftpmirror.gnu.org/gnu/libiconv/libiconv-1.17.tar.gz",
              "https://ftp.gnu.org/gnu/libiconv/libiconv-1.17.tar.gz"
            ]
          },
          "timestamp": 1794226585
        }

    Named the same as the other file but with the .json extension
    Even if you are doing it manually, it would be a good thing to create and upload this file, to keep record of the original internet URL it was downloaded from and also to which package it belongs.
    Maybe you can try to create the file and upload it? If you are automating the process with a script (recall you can create Conan custom commands for any automation tasks around Conan), then it sounds quite doable.

  6. Jochen0x90h commented on Nov 11, 2026

    @Jochen0x90h
    Author

    Thanks, I will try it out (for now the patched recipe works)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions