Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build cache #90

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Build cache #90

wants to merge 12 commits into from

Conversation

maddanio
Copy link
Contributor

@maddanio maddanio commented Jan 11, 2021

  • optionally cache builds based on package hash
  • the package hash is generated from the recipe and recursively dependencies
  • currently only respects dependencies from recipes and not such from the package itself
  • also introduces a file lock in the cache to avoid undefined behavior with concurrent cget runs
  • introduces --recipe-deps-only option to ignore dependencies inside source, which greatly speeds up cached installations

@ghost
Copy link

ghost commented Jan 11, 2021

DeepCode's analysis on #cd6ce6 found:

  • ⚠️ 2 warnings, ℹ️ 2 minor issues. 👇

Top issues

Description Example fixes
hashlib.sha1 is insecure. Consider changing it to a secure hashing algorithm (e.g. SHA256). Occurrences: 🔧 Example fixes
Missing close for zipfile.ZipFile, add close or use a with block. Occurrences: 🔧 Example fixes
standard import "import os, shutil, shlex, six, inspect, click, contextlib, uuid, sys, functools, hashlib" should be placed before "import os, shutil, shlex, six, inspect, click, contextlib, uuid, sys, functools, hashlib" Occurrences: 🔧 Example fixes

👉 View analysis in DeepCode’s Dashboard | Configure the bot

builder.build(target='install', variant=pb.variant)
if util.USE_SYMLINKS: util.symlink_dir(install_dir, self.prefix)
else: util.copy_dir(install_dir, self.prefix)
package_hash = self.hash_pkg(pb)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably need to include the toolchain settings in the hash. We could hash the cget/cget.cmake file but we also need to hash any files included in cget.cmake(like when the user is using cget init -t my-toolchain.cmake.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well, for me thats not so relevant right now, but yeah, for completeness sure. i was leaving some slack to get it working at all, and in doubt just clear the cache. btw, we will also here run into the problem that sub-dependencies inherit their parents cmake defines, which is unclean

cget/util.py Show resolved Hide resolved
@pfultz2
Copy link
Owner

pfultz2 commented Jan 21, 2021

Also, there are CI error. Are you able to look into those?

@maddanio
Copy link
Contributor Author

turns out it is not as simple. the way I make it work in my fork is by isolating packages against each other. i.e. i remove all references to the build local cget dir in the toolchain file and instead pass a list of CMAKE_PREFIX_PATH to the build. in the next step to make this more robust I should also fix the define inheritance, i.e. that dependents inherit the defines of the packages they where built from. you want me to pull those bits in here?

@pfultz2
Copy link
Owner

pfultz2 commented Jan 27, 2021

turns out it is not as simple. the way I make it work in my fork is by isolating packages against each other. i.e. i remove all references to the build local cget dir in the toolchain file and instead pass a list of CMAKE_PREFIX_PATH to the build.

That should probably only happen when the build-cache is enabled(otherwise it should fallback on the old behavior).

next step to make this more robust I should also fix the define inheritance, i.e. that dependents inherit the defines of the packages they where built from. you want me to pull those bits in here?

There should be a different flag for defines that dont inherit as this is a breaking change. Furthermore, the hash should use the inherited defines to compute the hash.

@maddanio
Copy link
Contributor Author

turns out it is not as simple. the way I make it work in my fork is by isolating packages against each other. i.e. i remove all references to the build local cget dir in the toolchain file and instead pass a list of CMAKE_PREFIX_PATH to the build.

That should probably only happen when the build-cache is enabled(otherwise it should fallback on the old behavior).

Not actually sure. What is the advantage of the merged prefix? Using specific prefixes should always work afaics.

next step to make this more robust I should also fix the define inheritance, i.e. that dependents inherit the defines of the packages they where built from. you want me to pull those bits in here?

There should be a different flag for defines that dont inherit as this is a breaking change. Furthermore, the hash should use the inherited defines to compute the hash.

So the inheriting was intended? It seemed to me that it was incidental because it effectively means the order of requirements will change the result. Also usually defines made in one packet are not meant for others?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants