diff options
| author | ruki <[email protected]> | 2021-05-27 00:37:12 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-05-27 00:37:12 +0800 |
| commit | cabfdf44c5b08ad2dfeb425eb5e372cbff6c37fe (patch) | |
| tree | 03bd24507f64fa722eeb66d6ba0072db3c5ae08d /xmake/modules/private/action/require/impl | |
| parent | 02d3e2cd9743435dc37a7b51ace4a638e7661a75 (diff) | |
improve to import packages again
Diffstat (limited to 'xmake/modules/private/action/require/impl')
| -rw-r--r-- | xmake/modules/private/action/require/impl/import_packages.lua | 2 | ||||
| -rw-r--r-- | xmake/modules/private/action/require/impl/repository.lua | 20 |
2 files changed, 9 insertions, 13 deletions
diff --git a/xmake/modules/private/action/require/impl/import_packages.lua b/xmake/modules/private/action/require/impl/import_packages.lua index 1b875314e..d01660aa1 100644 --- a/xmake/modules/private/action/require/impl/import_packages.lua +++ b/xmake/modules/private/action/require/impl/import_packages.lua @@ -35,7 +35,7 @@ function main(requires, opt) local importpath, count = installdir:replace(rootdir, packagedir, {plain = true}) -- import this package - if importpath and count == 1 and not instance:fetch({force = true}) then + if importpath and count == 1 then print("importing %s-%s %s", instance:displayname(), instance:version_str(), package.get_configs_str(instance)) cprint(" ${yellow}<-${clear} %s", importpath) os.tryrm(installdir) diff --git a/xmake/modules/private/action/require/impl/repository.lua b/xmake/modules/private/action/require/impl/repository.lua index 6fc72d49c..6a0471f8b 100644 --- a/xmake/modules/private/action/require/impl/repository.lua +++ b/xmake/modules/private/action/require/impl/repository.lua @@ -19,33 +19,29 @@ -- -- imports +import("core.base.global") import("core.package.repository") -- get all repositories function repositories() - - -- get it from cache it if _g._REPOSITORIES then return _g._REPOSITORIES end - -- get all repositories (local first) local repos = table.join(repository.repositories(false), repository.repositories(true)) - - -- save repositories _g._REPOSITORIES = repos - - -- ok return repos end -- the remote repositories have been pulled? function pulled() - for _, repo in ipairs(repositories()) do - -- repository not found? or xmake has been re-installed - local updatefile = path.join(repo:directory(), "updated") - if not os.isdir(repo:directory()) or (os.isfile(updatefile) and os.mtime(os.programfile()) > os.mtime(updatefile)) then - return false + if global.get("network") ~= "private" then + for _, repo in ipairs(repositories()) do + -- repository not found? or xmake has been re-installed + local updatefile = path.join(repo:directory(), "updated") + if not os.isdir(repo:directory()) or (os.isfile(updatefile) and os.mtime(os.programfile()) > os.mtime(updatefile)) then + return false + end end end return true |
