diff options
| author | ruki <[email protected]> | 2019-03-16 00:45:13 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-03-15 22:31:18 +0800 |
| commit | 08488b9e3a4e38e9cfe4f018d18a91f61b78e7fc (patch) | |
| tree | 9c6418a2923ef8cd1b914627569b530062a886cb | |
| parent | e5c057bac9799f8b7f94a2f5f7d5c14a53b675e6 (diff) | |
fix install package
| -rw-r--r-- | xmake/actions/require/impl/action/install.lua | 13 | ||||
| -rw-r--r-- | xmake/modules/package/manager/xmake/find_package.lua | 14 |
2 files changed, 15 insertions, 12 deletions
diff --git a/xmake/actions/require/impl/action/install.lua b/xmake/actions/require/impl/action/install.lua index 0dd3a731b..0e8e8972e 100644 --- a/xmake/actions/require/impl/action/install.lua +++ b/xmake/actions/require/impl/action/install.lua @@ -100,6 +100,9 @@ function main(package) filter.call(script, package) end end + + -- save the package info to the manifest file + package:manifest_save() need_test = true end end @@ -111,14 +114,9 @@ function main(package) end assert(fetchinfo, "fetch %s failed!", tipname) - -- need continue to test it? + -- test it if need_test then - - -- test it test(package) - - -- save the package info to the manifest file - package:manifest_save() end end @@ -145,6 +143,9 @@ function main(package) -- trace cprint("${color.failure}${text.failure}") + -- remove the invalid package directory + os.tryrm(package:installdir()) + -- failed if not package:requireinfo().optional then raise("install failed!") diff --git a/xmake/modules/package/manager/xmake/find_package.lua b/xmake/modules/package/manager/xmake/find_package.lua index 1264e72a6..0c6461480 100644 --- a/xmake/modules/package/manager/xmake/find_package.lua +++ b/xmake/modules/package/manager/xmake/find_package.lua @@ -133,12 +133,14 @@ function _find_package_from_repo(name, opt) end -- update the project references file - local projectdir = os.projectdir() - if projectdir and os.isdir(projectdir) then - local references_file = path.join(installdir, "references.txt") - local references = os.isfile(references_file) and io.load(references_file) or {} - references[projectdir] = os.date("%y%m%d") - io.save(references_file, references) + if result then + local projectdir = os.projectdir() + if projectdir and os.isdir(projectdir) then + local references_file = path.join(installdir, "references.txt") + local references = os.isfile(references_file) and io.load(references_file) or {} + references[projectdir] = os.date("%y%m%d") + io.save(references_file, references) + end end -- get version |
