diff --git a/2.1/404.html b/2.1/404.html index 6f4fc47ef19..7b5865ef3e3 100644 --- a/2.1/404.html +++ b/2.1/404.html @@ -119,7 +119,7 @@

Page Not Found

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/Page Not Found.html b/2.1/Page Not Found.html index 2119f7f33d5..05feaa0408e 100644 --- a/2.1/Page Not Found.html +++ b/2.1/Page Not Found.html @@ -112,7 +112,7 @@

Page not found

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/_sources/examples/tools/autotools/autotools.rst.txt b/2.1/_sources/examples/tools/autotools/autotools.rst.txt index 4eb167b13a5..f12cf3a434d 100644 --- a/2.1/_sources/examples/tools/autotools/autotools.rst.txt +++ b/2.1/_sources/examples/tools/autotools/autotools.rst.txt @@ -1,8 +1,8 @@ .. _examples_autotools: -tools.autotools -=============== +Autotools +========= .. toctree:: diff --git a/2.1/_sources/examples/tools/cmake/cmake.rst.txt b/2.1/_sources/examples/tools/cmake/cmake.rst.txt index 86261e04e90..e741ef9eb5a 100644 --- a/2.1/_sources/examples/tools/cmake/cmake.rst.txt +++ b/2.1/_sources/examples/tools/cmake/cmake.rst.txt @@ -1,8 +1,8 @@ .. _examples_cmake: -tools.cmake -=========== +CMake +===== .. toctree:: diff --git a/2.1/_sources/examples/tools/files/files.rst.txt b/2.1/_sources/examples/tools/files/files.rst.txt index 49d15df2653..389f25f6610 100644 --- a/2.1/_sources/examples/tools/files/files.rst.txt +++ b/2.1/_sources/examples/tools/files/files.rst.txt @@ -1,8 +1,7 @@ .. _examples_files: - -tools.files -=========== +File interaction +================ .. toctree:: diff --git a/2.1/_sources/examples/tools/google/bazel.rst.txt b/2.1/_sources/examples/tools/google/bazel.rst.txt index d18cb956476..d21bfa514fb 100644 --- a/2.1/_sources/examples/tools/google/bazel.rst.txt +++ b/2.1/_sources/examples/tools/google/bazel.rst.txt @@ -1,8 +1,8 @@ .. _examples_tools_bazel: -tools.google -============ +Bazel +===== .. toctree:: :maxdepth: 2 diff --git a/2.1/_sources/examples/tools/meson/meson.rst.txt b/2.1/_sources/examples/tools/meson/meson.rst.txt index c906d46b76b..6ee08283f41 100644 --- a/2.1/_sources/examples/tools/meson/meson.rst.txt +++ b/2.1/_sources/examples/tools/meson/meson.rst.txt @@ -1,8 +1,8 @@ .. _examples_tools_meson: -tools.meson -=========== +Meson +===== .. toctree:: diff --git a/2.1/_sources/examples/tools/microsoft/msbuild.rst.txt b/2.1/_sources/examples/tools/microsoft/msbuild.rst.txt index d8619871bfa..579a8e1aa8d 100644 --- a/2.1/_sources/examples/tools/microsoft/msbuild.rst.txt +++ b/2.1/_sources/examples/tools/microsoft/msbuild.rst.txt @@ -1,8 +1,8 @@ .. _examples_tools_msbuild: -tools.microsoft -=============== +MSBuild +======= .. toctree:: diff --git a/2.1/_sources/examples/tools/scm/git/capture_scm/git_capture_scm.rst.txt b/2.1/_sources/examples/tools/scm/git/capture_scm/git_capture_scm.rst.txt index dc6c5de4bff..43854075fad 100644 --- a/2.1/_sources/examples/tools/scm/git/capture_scm/git_capture_scm.rst.txt +++ b/2.1/_sources/examples/tools/scm/git/capture_scm/git_capture_scm.rst.txt @@ -30,7 +30,6 @@ There we will find a small "hello" project, containing this ``conanfile.py``: from conan import ConanFile from conan.tools.cmake import CMake, cmake_layout from conan.tools.scm import Git - from conan.tools.files import load, update_conandata class helloRecipe(ConanFile): @@ -45,18 +44,13 @@ There we will find a small "hello" project, containing this ``conanfile.py``: def export(self): git = Git(self, self.recipe_folder) - scm_url, scm_commit = git.get_url_and_commit() - self.output.info(f"Obtained URL: {scm_url} and {scm_commit}") - # we store the current url and commit in conandata.yml - update_conandata(self, {"sources": {"commit": scm_commit, "url": scm_url}}) + # save the url and commit in conandata.yml + git.coordinates_to_conandata() def source(self): # we recover the saved url and commit from conandata.yml and use them to get sources git = Git(self) - sources = self.conan_data["sources"] - self.output.info(f"Cloning sources from: {sources}") - git.clone(url=sources["url"], target=".") - git.checkout(commit=sources["commit"]) + git.checkout_from_conandata_coordinates() ... @@ -77,26 +71,47 @@ please create a folder outside of the ``examples2`` repository, and copy the con # Finally create the package $ conan create . ... - hello/0.1: WARN: Current commit 8e8764c40bebabbe3ec57f9a0816a2c8e691f559 doesn't exist in remote origin + ======== Exporting recipe to the cache ======== + hello/0.1: Exporting package recipe: /myfolder/conanfile.py + hello/0.1: Calling export() + hello/0.1: RUN: git status . --short --no-branch --untracked-files + hello/0.1: RUN: git rev-list HEAD -n 1 --full-history -- "." + hello/0.1: RUN: git remote -v + hello/0.1: RUN: git branch -r --contains cb7815a58529130b49da952362ce8b28117dee53 + hello/0.1: RUN: git fetch origin --dry-run --depth=1 cb7815a58529130b49da952362ce8b28117dee53 + hello/0.1: WARN: Current commit cb7815a58529130b49da952362ce8b28117dee53 doesn't exist in remote origin This revision will not be buildable in other computer - hello/0.1: Obtained URL: /capture_scm and 8e8764c40bebabbe3ec57f9a0816a2c8e691f559 - hello/0.1: Copied 1 '.yml' file: conandata.yml + hello/0.1: RUN: git rev-parse --show-toplevel hello/0.1: Copied 1 '.py' file: conanfile.py + hello/0.1: Copied 1 '.yml' file: conandata.yml + hello/0.1: Exported to cache folder: /.conan2/p/hello237d6f9f65bba/e ... - hello/0.1: Cloning sources from: {'commit': '8e8764c40bebabbe3ec57f9a0816a2c8e691f559', 'url': '/capture_scm'} + ======== Installing packages ======== + hello/0.1: Calling source() in /.conan2/p/hello237d6f9f65bba/s + hello/0.1: Cloning git repo + hello/0.1: RUN: git clone "" "." + hello/0.1: Checkout: cb7815a58529130b49da952362ce8b28117dee53 + hello/0.1: RUN: git checkout cb7815a58529130b49da952362ce8b28117dee53 Let's explain step by step what is happening: -- When the recipe is exported to the Conan cache, the ``export()`` method executes, running ``scm_url, scm_commit = git.get_url_and_commit()``. See the :ref:`Git reference` for more information about these methods. +- When the recipe is exported to the Conan cache, the ``export()`` method executes, ``git.coordinates_to_conandata()``, + which stores the Git URL and commit in the ``conandata.yml`` file by internally calling ``git.get_url_and_commit()``. + See the :ref:`Git reference` for more information about these methods. - This obtains the URL of the repo pointing to the local ``/capture_scm`` and the commit ``8e8764c40bebabbe3ec57f9a0816a2c8e691f559`` - It warns that this information will **not** be enough to re-build from source this recipe once the package is uploaded to the server and is tried to be built from source in other computer, which will not contain the path pointed by ``/capture_scm``. This is expected, as the repository that we created doesn't have any remote defined. If our local clone had a remote defined and that remote contained the ``commit`` that we are building, the ``scm_url`` would point to the remote repository instead, making the build from source fully reproducible. - The ``export()`` method stores the ``url`` and ``commit`` information in the ``conandata.yml`` for future reproducibility. -- When the package needs to be built from sources and it calls the ``source()`` method, it recovers the information from the ``conandata.yml`` file, and calls ``git.clone()`` with it to retrieve the sources. In this case, it will be cloning from the local checkout in ``/capture_scm``, but if it had a remote defined, it will clone from it. +- When the package needs to be built from sources and it calls the ``source()`` method, + it recovers the information from the ``conandata.yml`` file inside the ``git.checkout_from_conandata_coordinates()`` method, + which internally calls ``git.clone()`` with it to retrieve the sources. + In this case, it will be cloning from the local checkout in ``/capture_scm``, but if it had a remote defined, it will clone from it. .. warning:: - To achieve reproducibility, it is very important for this **scm capture** technique that the current checkout is not dirty. If it was dirty, it would be impossible to guarantee future reproducibility of the build, so ``git.get_url_and_commit()`` can raise errors, and require to commit changes. If more than 1 commit is necessary, it would be recommended to squash those commits before pushing changes to upstream repositories. + To achieve reproducibility, it is very important for this **scm capture** technique that the current checkout is not dirty + If it was dirty, it would be impossible to guarantee future reproducibility of the build, so ``git.get_url_and_commit()`` can raise errors, + and require to commit changes. If more than 1 commit is necessary, it would be recommended to squash those commits before pushing changes to upstream repositories. If we do now a second ``conan create .``, as the repo is dirty we would get: diff --git a/2.1/changelog.html b/2.1/changelog.html index 619021e8263..7d9cdbb4f1c 100644 --- a/2.1/changelog.html +++ b/2.1/changelog.html @@ -826,7 +826,7 @@

2.0.0-beta1 (20-Jun-2022)

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/conan.pdf b/2.1/conan.pdf index 83ee85d6ae8..f1820d50434 100644 Binary files a/2.1/conan.pdf and b/2.1/conan.pdf differ diff --git a/2.1/devops.html b/2.1/devops.html index de2c6c49289..fc9e0ab7a05 100644 --- a/2.1/devops.html +++ b/2.1/devops.html @@ -139,7 +139,7 @@

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/devops/backup_sources/repositories/artifactory/creating_backup_sources_repo.html b/2.1/devops/backup_sources/repositories/artifactory/creating_backup_sources_repo.html index b9ce58f38cc..c45f270dc08 100644 --- a/2.1/devops/backup_sources/repositories/artifactory/creating_backup_sources_repo.html +++ b/2.1/devops/backup_sources/repositories/artifactory/creating_backup_sources_repo.html @@ -166,7 +166,7 @@

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/devops/backup_sources/sources_backup.html b/2.1/devops/backup_sources/sources_backup.html index 259892d6279..5a36f14e7ed 100644 --- a/2.1/devops/backup_sources/sources_backup.html +++ b/2.1/devops/backup_sources/sources_backup.html @@ -261,7 +261,7 @@

Upload the packages

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/devops/conancenter/hosting_binaries.html b/2.1/devops/conancenter/hosting_binaries.html index 77955419444..a78ed5168ea 100644 --- a/2.1/devops/conancenter/hosting_binaries.html +++ b/2.1/devops/conancenter/hosting_binaries.html @@ -158,7 +158,7 @@

Updating from upstream

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/devops/metadata.html b/2.1/devops/metadata.html index d30dcf6e555..43e6340226b 100644 --- a/2.1/devops/metadata.html +++ b/2.1/devops/metadata.html @@ -411,7 +411,7 @@

test_package as metadata

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/devops/save_restore.html b/2.1/devops/save_restore.html index 17a074312dc..2623b0f1a15 100644 --- a/2.1/devops/save_restore.html +++ b/2.1/devops/save_restore.html @@ -180,7 +180,7 @@

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/devops/using_conancenter.html b/2.1/devops/using_conancenter.html index 3b722e2b6b3..5bb330ddfcf 100644 --- a/2.1/devops/using_conancenter.html +++ b/2.1/devops/using_conancenter.html @@ -239,7 +239,7 @@

Control and customization

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/devops/versioning.html b/2.1/devops/versioning.html index fdcea96e020..947e08369b5 100644 --- a/2.1/devops/versioning.html +++ b/2.1/devops/versioning.html @@ -137,7 +137,7 @@

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/devops/versioning/resolve_prereleases.html b/2.1/devops/versioning/resolve_prereleases.html index b3a8137e26c..0a8c3177d48 100644 --- a/2.1/devops/versioning/resolve_prereleases.html +++ b/2.1/devops/versioning/resolve_prereleases.html @@ -181,7 +181,7 @@

© Copyright 2016-2024, JFrog. - Last updated on Apr 04, 2024. + Last updated on Apr 08, 2024.

diff --git a/2.1/examples.html b/2.1/examples.html index f95caef6a11..18ee7ab2b91 100644 --- a/2.1/examples.html +++ b/2.1/examples.html @@ -130,13 +130,13 @@
  • Conan recipe tools examples
  • Cross-building examples