summaryrefslogtreecommitdiff
path: root/xmake/actions/require/impl
diff options
context:
space:
mode:
authorruki <[email protected]>2019-03-14 23:57:38 +0800
committerruki <[email protected]>2019-03-14 17:45:49 +0800
commit9036abe2d5d282bd19c9f6bdd2acee9ac03051fc (patch)
tree9de2c370b841128b754bd2590e4d0a82173bbe7f /xmake/actions/require/impl
parent1885d14af400ea5658dc89431fc1353184e40643 (diff)
fix uninstall and remove unlink for package
Diffstat (limited to 'xmake/actions/require/impl')
-rw-r--r--xmake/actions/require/impl/action/install.lua24
-rw-r--r--xmake/actions/require/impl/package.lua36
2 files changed, 15 insertions, 45 deletions
diff --git a/xmake/actions/require/impl/action/install.lua b/xmake/actions/require/impl/action/install.lua
index a032dd7aa..f55d8afd1 100644
--- a/xmake/actions/require/impl/action/install.lua
+++ b/xmake/actions/require/impl/action/install.lua
@@ -79,6 +79,7 @@ function main(package)
local installtask = function ()
-- install the third-party package directly, e.g. brew::pcre2/libpcre2-8, conan::OpenSSL/1.0.2n@conan/stable
+ local need_test = false
if package:is3rd() then
local script = package:script("install")
if script ~= nil then
@@ -102,11 +103,21 @@ function main(package)
-- save the package info to the manifest file
package:manifest_save()
-
- -- test it
- test(package)
+ need_test = true
end
end
+
+ -- fetch package and force to flush the cache
+ local fetchinfo = package:fetch({force = true})
+ if option.get("verbose") or option.get("diagnosis") then
+ print(fetchinfo)
+ end
+ assert(fetchinfo, "fetch %s failed!", tipname)
+
+ -- test it
+ if need_test then
+ test(package)
+ end
end
-- install package
@@ -116,13 +127,6 @@ function main(package)
process.asyncrun(installtask)
end
- -- fetch package and force to flush the cache
- local fetchinfo = package:fetch({force = true})
- if option.get("verbose") or option.get("diagnosis") then
- print(fetchinfo)
- end
- assert(fetchinfo, "fetch %s failed!", tipname)
-
-- trace
cprint("${color.success}${text.success}")
end,
diff --git a/xmake/actions/require/impl/package.lua b/xmake/actions/require/impl/package.lua
index dbed2aee8..06fa89a1e 100644
--- a/xmake/actions/require/impl/package.lua
+++ b/xmake/actions/require/impl/package.lua
@@ -601,48 +601,14 @@ function uninstall_packages(requires, opt)
-- remove all packages
local packages = {}
for _, instance in ipairs(load_packages(requires, opt)) do
- if os.isfile(instance:prefixfile()) then
-
- -- uninstall package from the prefix directory
- action.prefix.uninstall(instance)
-
- -- remove ok
+ if os.isfile(instance:manifest_file()) then
table.insert(packages, instance)
end
-
- -- remove the installed files
os.tryrm(instance:installdir())
end
return packages
end
--- only unlink packages from the prefix directory
-function unlink_packages(requires, opt)
-
- -- init options
- opt = opt or {}
-
- -- do not remove dependent packages
- opt.nodeps = true
-
- -- clear the detect cache
- detectcache.clear()
-
- -- unlink all packages
- local packages = {}
- for _, instance in ipairs(load_packages(requires, opt)) do
- if os.isfile(instance:prefixfile()) then
-
- -- uninstall package from the prefix directory
- action.prefix.uninstall(instance)
-
- -- remove ok
- table.insert(packages, instance)
- end
- end
- return packages
-end
-
-- search packages
function search_packages(names)