diff options
| author | ruki <[email protected]> | 2019-03-21 23:47:48 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-03-21 16:46:50 +0800 |
| commit | f19667675aca8ddfe6c3c42c69ad1cc6843679e3 (patch) | |
| tree | 5709ed8302a812c7a51ac3dcc15b7a81fc15489d | |
| parent | 00b33c9ccb53beea35f33ce354c719cb7ae30d7b (diff) | |
fix uninstall package bug
| -rw-r--r-- | xmake/actions/require/impl/action/install.lua | 7 | ||||
| -rw-r--r-- | xmake/actions/require/uninstall.lua | 2 | ||||
| -rw-r--r-- | xmake/core/package/package.lua | 5 |
3 files changed, 11 insertions, 3 deletions
diff --git a/xmake/actions/require/impl/action/install.lua b/xmake/actions/require/impl/action/install.lua index bce8e12a9..804836e9e 100644 --- a/xmake/actions/require/impl/action/install.lua +++ b/xmake/actions/require/impl/action/install.lua @@ -25,6 +25,7 @@ -- imports import("core.base.option") import("core.project.target") +import("lib.detect.find_file") import("test") import(".utils.filter") @@ -32,12 +33,14 @@ import(".utils.filter") function _patch_pkgconfig(package) -- get lib/pkgconfig/*.pc file - local pcfile = path.join(package:installdir(), "lib", "pkgconfig", package:name() .. ".pc") - if os.isfile(pcfile) then + local pkgconfigdir = path.join(package:installdir(), "lib", "pkgconfig") + local pcfile = os.isdir(pkgconfigdir) and find_file("*.pc", pkgconfigdir) or nil + if not pcfile then return end -- trace + pcfile = path.join(pkgconfigdir, package:name() .. ".pc") vprint("patching %s ..", pcfile) -- fetch package diff --git a/xmake/actions/require/uninstall.lua b/xmake/actions/require/uninstall.lua index e9170eee5..022783cb0 100644 --- a/xmake/actions/require/uninstall.lua +++ b/xmake/actions/require/uninstall.lua @@ -56,7 +56,7 @@ function main(package_names) local requires = {} for _, name in ipairs(package_names) do for _, require_str in ipairs(project_requires) do - if require_str:split(' ')[1]:lower():find(name:lower()) then + if require_str:split(' ')[1]:lower() == name:lower() then table.insert(requires, require_str) end end diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index eeae38819..9c1acf634 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -735,6 +735,11 @@ function _instance:fetchdeps() end end end + if fetchinfo then + for name, values in pairs(fetchinfo) do + fetchinfo[name] = table.unwrap(table.unique(table.wrap(values))) + end + end return fetchinfo end |
