diff options
| author | ruki <[email protected]> | 2018-10-11 22:54:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-10-11 11:28:34 +0800 |
| commit | 2b0891928e7c36256a95a90c37677ebdc7b5687d (patch) | |
| tree | 6f6da6443e5b5144af78b24f93b8ec66a4849331 /xmake/core/package/package.lua | |
| parent | 02ba003928edb4bc2aae98ba1156013d996284cb (diff) | |
improve to install local package
Diffstat (limited to 'xmake/core/package/package.lua')
| -rw-r--r-- | xmake/core/package/package.lua | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/xmake/core/package/package.lua b/xmake/core/package/package.lua index 0f1a32b8b..fdc01169d 100644 --- a/xmake/core/package/package.lua +++ b/xmake/core/package/package.lua @@ -203,7 +203,7 @@ end function _instance:installdir(...) -- make the given install directory - local dir = path.join(package.installdir(self:from("global"), self:debug(), self:plat(), self:arch()), self:name():sub(1, 1):lower(), self:name(), self:version_str(), ...) + local dir = path.join(package.installdir(self:debug(), self:plat(), self:arch()), self:name():sub(1, 1):lower(), self:name(), self:version_str(), ...) -- ensure the install directory if not os.isdir(dir) then @@ -236,7 +236,7 @@ end -- get the prefix info file function _instance:prefixfile() - return path.join(self:installdir(), "prefixinfo.txt") + return path.join(package.prefixinfodir(self:from("global"), self:debug(), self:plat(), self:arch()), self:name():sub(1, 1):lower(), self:name(), self:version_str(), "info.txt") end -- get prefix variables @@ -518,9 +518,13 @@ function _instance:fetch(opt) local system = opt.system or self:requireinfo().system -- fetch it from the prefix directories first + -- and add cache key to make a distinction with finding system package if not fetchinfo and system ~= true then - -- add cache key to make a distinction with finding system package - fetchinfo = self._find_package(self:name(), {prefixdirs = self:prefixdir(), system = false, cachekey = "fetch:prefix", force = opt.force}) + fetchinfo = self._find_package(self:name(), {prefixdirs = self:prefixdir(), + system = false, + global = self:from("local") and false or nil, + cachekey = "fetch:prefix", + force = opt.force or self:from("local")}) if fetchinfo then fetchfrom = self._FROMKIND end end @@ -639,8 +643,8 @@ function package.cachedir() end -- the install directory -function package.installdir(is_global, is_debug, plat, arch) - return path.join(is_global and global.directory() or config.directory(), "installed", plat or os.host(), arch or os.arch(), is_debug and "debug" or "release") +function package.installdir(is_debug, plat, arch) + return path.join(global.directory(), "installed", plat or os.host(), arch or os.arch(), is_debug and "debug" or "release") end -- get the prefix directory @@ -648,6 +652,11 @@ function package.prefixdir(is_global, is_debug, plat, arch) return path.join(is_global and global.directory() or config.directory(), "prefix", plat or os.host(), arch or os.arch(), is_debug and "debug" or "release") end +-- get the prefix info directory +function package.prefixinfodir(is_global, is_debug, plat, arch) + return path.join(is_global and global.directory() or config.directory(), "prefix", "info", plat or os.host(), arch or os.arch(), is_debug and "debug" or "release") +end + -- get the prefix info function package.prefixinfo(is_global, is_debug, plat, arch) local prefixfile = package.prefixfile(is_global, is_debug, plat, arch) @@ -656,7 +665,7 @@ end -- get the prefix info file function package.prefixfile(is_global, is_debug, plat, arch) - return path.join(package.prefixdir(is_global, is_global, plat, arch), "info.txt") + return path.join(package.prefixinfodir(is_global, is_global, plat, arch), "info.txt") end -- get environment variables |
