Repository navigation
[CMake] List an external mirror for every downloaded builtin archive - #23963
Conversation
90fd4fa to
63ed4c5
Compare
|
Thanks for the review! @ferdymercury, does it look okay for you now? |
Might change with #23948 and #23354 One unrelated question: are there plans to make CppInterOp also behave like an external? Rather than copy-pasting the whole code at every sha commit upgrade? If the main reason against this is to make sure that ROOT compiles without internet, there could be an easy workaround that could be given clear 'instructions' to those subset of users:
Or just always using git submodules and forgetting about AddExternalProject. After https://stackoverflow.com/a/49427199/7471760 life is much easier with submodules. |
ferdymercury
left a comment
There was a problem hiding this comment.
Cool, thanks.
Nitpick: OpenSSL, xrootd and cfitsio varibles start with PACKAGE_HASH rather than ROOT_PACKAGE_HASH like the majority.
Maybe one day when we have reduced the required patches (hopefully during next year). Until then, we treat CppInterOp and cppjit like LLVM/Clang: tracked as a copy of the source code with well-specified patches, including a CI check that the the differences don't drift beyond the current patches.
You're asking the right question here! Building without internet is indeed a requirement, and we discussed this also in #23877 (comment) with @linev. Fortunately, there is a native mechanism to allow this, with ExternalProject_Add' s Git submodules are maybe a nice solution if you want to use random tags and commits for the builtins, but then it's more difficult again to use mirrors. GitHub is often having hick-ups these days. And given there are clear release artifacts for all of our builtins (except for civetweb, until its next release), the tarball solution works quite well and I don't see a compelling reason to move away from them. Would you prefer submodules for some specific reason? We changed already a lot for the builtins in 6.42, which will already create quite some churn for packagers... We should be careful that we don't have this in every release. |
Thanks! No reason not to address the nitpick. Will update. |
All source archives of the builtin_* options were downloaded from a single location, the CERN mirror (lcgpackages, or root.cern for libjpeg-turbo and libpng). This lists a second, external mirror for each of them, so that the download keeps working when the CERN network is unreachable: CMake tries the URLs in order. Every external URL was verified to serve the byte-identical file (same SHA256 as the pinned one): 18 from GitHub (clad, ftgl, gtest, jsroot, lz4, lzma, mathjax, nlohmann, openssl, openui5, pcre, tbb, vdt, xrootd, xxhash, zlib, zstd, and libjpeg-turbo's tag archive), the rest from the upstream project sites (fftw.org, savannah for freetype, osgeo for libtiff, HEASARC for cfitsio, statmath.wu.ac.at for unuran, ftp.gnu.org for gsl, geuz.org for gl2ps, SourceForge for giflib and libpng). The git clones (civetweb, AdaptiveCpp, clad with CLAD_GIT_TAG) are not archives and stay as they are. Along the way: * Since the version now appears in two URLs, every builtin keeps it in a single variable (added for clad, jsroot, mathjax and tbb; tbb's ROOT_TBB_VERSION was referenced for the parent scope but never set), and the SHA256 is kept in a *_HASH variable on the line right after the version, so that a version bump cannot forget the hash (added where it was missing: cfitsio, clad, fftw3, gsl, jsroot, mathjax, openssl, openui5, tbb, vdt, xrootd). The single-use *_URL variables are dropped and the URLs are written inline in the ExternalProject_Add call. * The unuran tarball on LCG turned out to be the pristine upstream release, so its stale "repackaged" comment is removed. * giflib uses the LCG copy instead of root.cern, like the other builtins.
63ed4c5 to
5b08d05
Compare
sounds great.
No, no problem, as long as there is an alternative solution that does not imply keeping mirroring all file changes at each upgrade.
This is to me a more involved solution (and bloating the git repo size) than just using addExternalProject (or the future DOWNLOAD_DIR) plus "git apply MYPATCHES.diff". For example, the clang patches are just 100KB size: https://github.com/llvm/llvm-project/compare/release/22.x...root-project:llvm-project:ROOT-llvm22.diff so you could remove the interpreter/llvm-project directory and only copy the source into your build directory via ExternalProject or via download_dir, and then PATCH_COMMAND that hard-coded diff. That way, at every upgrade, you only need to update that diff file and HASH. The benefit would be that you would save 300Mb in disk space in you root_src source folder. Git repository size is already 2GB, and LLVM receives many file changes every release, far less than the modified patches, so to keep it from growing indefinitely (until patches are no longer needed or clang-repl is used). |
|
This is a little bit of a tangent from this PR, but the point with the repo size is an important one I think. However, the interpreter packages are different because they are pretty much co-developed with ROOT itself by the same people. So having all code together in one repo is a major simplification for day-to-day developer work and onboarding. But I hope that one day as the interpreter code stabilizes, we can do what you suggest 🙂 |
builtins/unuran/CMakeLists.txt only set PATCH_COMMAND when <SOURCE_DIR>/src/CMakeLists.txt did not exist yet, checked at configure time against whatever the build tree held from the previous build. The check was meant to avoid re-applying the patch to an already patched tree, but it defeats the step ordering that ExternalProject already provides: the patch stamp depends on the download stamp, so the patch step re-runs exactly when a fresh tree has been extracted. Whenever the download step re-runs in an existing build tree, it replaces <SOURCE_DIR> with the pristine upstream tarball, which has no src/CMakeLists.txt (upstream unuran is autotools only). With the patch step gone, the configure step then fails with CMake Error: The source directory ".../BUILTIN_UNURAN/src" does not appear to contain CMakeLists.txt. The download re-runs whenever the URL list changes, so this broke the incremental opensuse CI build of the previous commit, which added a second mirror, and it would have broken every future version bump of the builtin in the same way, since the source directory path does not depend on the version. Set PATCH_COMMAND unconditionally, as interpreter/cling/tools/plugins/clad already does, and let ExternalProject decide when to run it. The step only re-runs on an already patched tree if its stamp file is removed by hand.
|
/backport to 6.42 |
|
Preparing to backport PR #23963 to branch 6.42 requested by guitargeek |
|
This PR has been backported to branch 6.42: #23973 |
|
unuran seems to complain in https://github.com/root-project/root/actions/runs/41820421662/job/126541889380?pr=23979 do we need a clean-build label temporarily? |
Unfortunately yes, at least until the next inremental build is done (I guess in half an hour). I would just wait for that, then rebase the PR on master and push. Like this, we avoid the full rebuild. |
All source archives of the builtin_* options were downloaded from a single location, the CERN mirror (lcgpackages, or root.cern for libjpeg-turbo and libpng). This lists a second, external mirror for each of them, so that the download keeps working when the CERN network is unreachable: CMake tries the URLs in order.
Every external URL was verified to serve the byte-identical file (same SHA256 as the pinned one): 18 from GitHub (clad, ftgl, gtest, jsroot, lz4, lzma, mathjax, nlohmann, openssl, openui5, pcre, tbb, vdt, xrootd, xxhash, zlib, zstd, and libjpeg-turbo's tag archive), the rest from the upstream project sites (fftw.org, savannah for freetype, osgeo for libtiff, HEASARC for cfitsio, statmath.wu.ac.at for unuran, ftp.gnu.org for gsl, geuz.org for gl2ps, SourceForge for giflib and libpng). The git clones (civetweb, AdaptiveCpp, clad with CLAD_GIT_TAG) are not archives and stay as they are.
Along the way:
Since the version now appears in two URLs, every builtin keeps it in a single variable (added for clad, jsroot, mathjax and tbb; tbb's ROOT_TBB_VERSION was referenced for the parent scope but never set), and the SHA256 is kept in a *_HASH variable on the line right after the version, so that a version bump cannot forget the hash (added where it was missing: cfitsio, clad, fftw3, gsl, jsroot, mathjax, openssl, openui5, tbb, vdt, xrootd). The single-use *_URL variables are dropped and the URLs are written inline in the ExternalProject_Add call.
The unuran tarball on LCG turned out to be the pristine upstream release, so its stale "repackaged" comment is removed.
giflib uses the LCG copy instead of root.cern, like the other builtins.