-
-
Notifications
You must be signed in to change notification settings - Fork 812
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
Package "lock file" support to freeze dependencies #1567
Comments
I have supported it in #1587 We need only add add_requires("zlib")
set_policy("package.requires_lock", true)
target("test1")
set_kind("binary")
add_files("src/*.c")
add_packages("zlib") We can use $ cat ./xmake-requires.lock
{
__meta__ = {
version = "1.0"
},
["zlib#ddbdd8b8f76d455a8c0ef45fffe37160"] = {
arch = "x86_64",
buildhash = "b76a297309d14c09b42cfe3927260a51",
name = "zlib",
plat = "macosx",
repo = {
branch = "master",
commit = "df6cad5cf5701de3705c7afce54d732e1f5b14b9",
url = "https://gitee.com/tboox/xmake-repo.git"
},
version = "1.2.11"
},
["zlib~debug#d72a8a937b694e449bce540c8eb65a8a"] = {
arch = "x86_64",
buildhash = "e6a6fa6a86ad4fc7ae3c2cf7c60cc084",
name = "zlib",
plat = "macosx",
repo = {
branch = "master",
commit = "df6cad5cf5701de3705c7afce54d732e1f5b14b9",
url = "https://gitee.com/tboox/xmake-repo.git"
},
version = "1.2.11"
},
["zlib~shared#b286744a1898416faad2e5cab0104b2f"] = {
arch = "x86_64",
buildhash = "8e5b898b0f344715bac89cc6a1577506",
name = "zlib",
plat = "macosx",
repo = {
branch = "master",
commit = "df6cad5cf5701de3705c7afce54d732e1f5b14b9",
url = "https://gitee.com/tboox/xmake-repo.git"
},
version = "1.2.11"
}
} |
and we can run |
I noticed xmake only writes the lock file when installing dependencies, but what if the dependencies are already installed (from another project per example)? |
Also there may be a problem with local repositories: -- from my project xmake.lua, containing nazaraengine package
add_repositories("burgwar-repo xmake-repo") it gives this in xmake lock file:
then resetting xmake cache:
|
I have improved it. |
It works better, however I still have this issue:
With this in the lock file:
|
try it again. |
Seems better, I no longer have the error. However I have a lot of "build hash does not match" error (which doesn't make sense since I generated the lock right before using Here's the full verbose log:
Also it looks like it does unnecessary checkout the repo multiple times to the same hash |
I have improved it on dev. |
It works without any problem now. I tried it by forcing fmt version to 7.1.3 and then running
I feel it would be better with a message "upgraded fmt (7.1.3 => 8.0.1)", if that's not too much work 😄 |
At present, we can only calculate the key of the locked package based on the earliest requires info. At this time, the package configs have not been finalized, so we cannot correspond to the exact package configs and buildhash based on this key. But this does not affect the lock of the package version and warehouse. |
I added it |
Is your feature request related to a problem? Please describe.
When I check in requirement for my project, I want to make sure that everyone else (including the build server) use the exact same version until we intentionally upgrade. Using
add_requirement("foo ~1.2")
is helpful to constrain the version, but I don't want xmake to upgrade the package unless I explicitly e.g. runxmake upgrade-requirements
. If xrepo adds support for transitive dependencies (i.e. my package can depend on a different package), I'd like to be able to stick with a specific version of those dependencies as well.I also want to make sure that the dependencies haven't been tampered with, so I'd like some guarantee that the checksums in the package lua file haven't been modified without bumping the version.
Describe the solution you'd like
Many package managers (npm w/ package.lock, cargo w/ cargo.lock, pip freeze w/ requirements.txt, etc) use a
.lock
file that specifies more specific information about the dependencies I've installed.For xrepo, this could be a file that contains URLs to all my packages'
xmake.lua
files, the version of the packages, and the specific commit hash of thexmake.lua
file that should be used. By default, installing requirements via e.g.xmake
should default to using the specific package listed in the lock file if it is present, otherwise it should use the current rules to determine the version and record it in a .lock file. Then there should be an explicit command to update my packages that would re-evaluate any requirements listed in the xmake.lua and update xmake.lock to the latest version of the package that meets the requirements and the latest commit of the package'sxmake.lua
file.The text was updated successfully, but these errors were encountered: