aboutsummaryrefslogtreecommitdiff
path: root/src/config.nim
diff options
context:
space:
mode:
authorkitsunyan2018-05-05 18:42:14 +0000
committerkitsunyan2018-05-05 18:42:14 +0000
commit9c7c88d41a3a4f59602f1e4b42635551379ccc99 (patch)
treeb506d9ac6487aeb332fa36bcca6ae601ae26a7ef /src/config.nim
parent4b07b34b80ecbf8cfb88945a56ce021525b74741 (diff)
Copy built packages to package cache directory
Diffstat (limited to 'src/config.nim')
-rw-r--r--src/config.nim8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/config.nim b/src/config.nim
index ad57550..19dc0d6 100644
--- a/src/config.nim
+++ b/src/config.nim
@@ -21,12 +21,14 @@ type
PacmanConfig* = object of CommonConfig
rootOption*: Option[string]
dbOption*: Option[string]
+ cacheOption*: Option[string]
gpgOption*: Option[string]
colorMode*: ColorMode
Config* = object of CommonConfig
root*: string
db*: string
+ cache*: string
tmpRootInitial*: string
tmpRootCurrent*: string
color*: bool
@@ -105,12 +107,16 @@ proc db*(config: PacmanConfig): string =
let workRoot = if root == "/": "" else: root
workRoot & localStateDir & "/lib/pacman/"
+proc cache*(config: PacmanConfig): string =
+ config.cacheOption.get(localStateDir & "/cache/pacman/pkg")
+
proc obtainConfig*(config: PacmanConfig): Config =
let (configTable, _) = readConfigFile(sysConfDir & "/pakku.conf")
let options = configTable.opt("options").map(t => t[]).get(initTable[string, string]())
let root = config.root
let db = config.db
+ let cache = config.cache
let color = config.colorMode.get
proc obtainTmpDir(user: User): string =
@@ -127,7 +133,7 @@ proc obtainConfig*(config: PacmanConfig): Config =
let viewNoDefault = options.hasKey("ViewNoDefault")
let preBuildCommand = options.opt("PreBuildCommand")
- Config(root: root, db: db,
+ Config(root: root, db: db, cache: cache,
tmpRootInitial: tmpRootInitial, tmpRootCurrent: tmpRootCurrent, color: color,
dbs: config.dbs, arch: config.arch, debug: config.debug, progressBar: config.progressBar,
verbosePkgList: config.verbosePkgList, pgpKeyserver: config.pgpKeyserver,