aboutsummaryrefslogtreecommitdiff
path: root/src/feature/syncinstall.nim
diff options
context:
space:
mode:
authorkitsunyan2018-05-20 11:07:35 +0000
committerkitsunyan2018-05-20 11:07:35 +0000
commit80b7087c8f8995cbadd038661b0dcdd39c7d08d5 (patch)
tree85e1f3d2a419ff6f5ff1b9a2c9a592d453e0d25d /src/feature/syncinstall.nim
parent396e9f44c4f5a79c7b9238835599387f6ff418fe (diff)
Allow to preserve built packages to user cache dir
Preserving is disabled by default now.
Diffstat (limited to 'src/feature/syncinstall.nim')
-rw-r--r--src/feature/syncinstall.nim15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/feature/syncinstall.nim b/src/feature/syncinstall.nim
index 4d0a564..269777a 100644
--- a/src/feature/syncinstall.nim
+++ b/src/feature/syncinstall.nim
@@ -585,7 +585,20 @@ proc installGroupFromSources(config: Config, commonArgs: seq[Argument],
let asdeps = install.filter(p => not (p.name in explicits)).map(p => p.file)
let asexplicit = install.filter(p => p.name in explicits).map(p => p.file)
- let installParams = sudoPrefix & (pkgLibDir & "/install") & config.cache &
+ let (cacheDir, cacheUser, cacheGroup) = if config.preserveBuilt == PreserveBuilt.internal:
+ (config.cache, 0, 0)
+ elif config.preserveBuilt == PreserveBuilt.user: (block:
+ let error = ensureUserCacheOrError(config, CacheKind.packages, true)
+ for e in error: printError(config.color, e)
+ let user = initialUser.get(currentUser)
+ let dir = config.userCacheInitial.cache(CacheKind.packages)
+ (dir, user.uid, user.gid))
+ else:
+ # pass -1 values to disable caching
+ ("", -1, -1)
+
+ let installParams = sudoPrefix & (pkgLibDir & "/install") &
+ cacheDir & $cacheUser & $cacheGroup &
$pacmanParams.len & pacmanParams & $asdeps.len & asdeps & $asexplicit.len & asexplicit
let code = forkWait(() => execResult(installParams))