Merge r4084
This commit is contained in:
parent
7e1a2a94ae
commit
8d2626f0fd
2 changed files with 11 additions and 10 deletions
|
@ -70,8 +70,9 @@ local default_savedir = "/tmp/.uvl"
|
||||||
-- @return Instance object
|
-- @return Instance object
|
||||||
UVL = util.class()
|
UVL = util.class()
|
||||||
|
|
||||||
function UVL.__init__( self, schemedir )
|
function UVL.__init__( self, schemedir, configdir )
|
||||||
self.schemedir = schemedir or default_schemedir
|
self.schemedir = schemedir or default_schemedir
|
||||||
|
self.configdir = configdir
|
||||||
self.packages = { }
|
self.packages = { }
|
||||||
self.beenthere = { }
|
self.beenthere = { }
|
||||||
self.depseen = { }
|
self.depseen = { }
|
||||||
|
@ -946,11 +947,11 @@ function uvlitem.parent(self)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function uvlitem._loadconf(self, co, c)
|
function uvlitem._loadconf(self, co, c, configdir)
|
||||||
co = co or self._configcache
|
co = co or self._configcache
|
||||||
if not co then
|
if not co then
|
||||||
local err
|
local err
|
||||||
co, err = uci.cursor():get_all(c)
|
co, err = uci.cursor(configdir):get_all(c)
|
||||||
|
|
||||||
if err then
|
if err then
|
||||||
self:error(ERR.UCILOAD(self, err))
|
self:error(ERR.UCILOAD(self, err))
|
||||||
|
@ -983,7 +984,7 @@ function scheme.__init__(self, scheme, co, c)
|
||||||
|
|
||||||
self.cref = { c }
|
self.cref = { c }
|
||||||
self.sref = { c }
|
self.sref = { c }
|
||||||
self.c = self:_loadconf(co, c)
|
self.c = self:_loadconf(co, c, scheme.configdir)
|
||||||
self.s = scheme
|
self.s = scheme
|
||||||
self.t = TYPE_SCHEME
|
self.t = TYPE_SCHEME
|
||||||
end
|
end
|
||||||
|
@ -1047,10 +1048,9 @@ function config.__init__(self, scheme, co, c)
|
||||||
if not c then
|
if not c then
|
||||||
c, co = co, nil
|
c, co = co, nil
|
||||||
end
|
end
|
||||||
|
|
||||||
self.cref = { c }
|
self.cref = { c }
|
||||||
self.sref = { c }
|
self.sref = { c }
|
||||||
self.c = self:_loadconf(co, c)
|
self.c = self:_loadconf(co, c, scheme.configdir)
|
||||||
self.s = scheme
|
self.s = scheme
|
||||||
self.t = TYPE_CONFIG
|
self.t = TYPE_CONFIG
|
||||||
end
|
end
|
||||||
|
@ -1098,7 +1098,7 @@ section = util.class(uvlitem)
|
||||||
function section.__init__(self, scheme, co, c, s)
|
function section.__init__(self, scheme, co, c, s)
|
||||||
self.cref = { c, s }
|
self.cref = { c, s }
|
||||||
self.sref = { c, co and co[s] and co[s]['.type'] or s }
|
self.sref = { c, co and co[s] and co[s]['.type'] or s }
|
||||||
self.c = self:_loadconf(co, c)
|
self.c = self:_loadconf(co, c, scheme.configdir)
|
||||||
self.s = scheme
|
self.s = scheme
|
||||||
self.t = TYPE_SECTION
|
self.t = TYPE_SECTION
|
||||||
end
|
end
|
||||||
|
@ -1149,7 +1149,7 @@ option = util.class(uvlitem)
|
||||||
function option.__init__(self, scheme, co, c, s, o)
|
function option.__init__(self, scheme, co, c, s, o)
|
||||||
self.cref = { c, s, o }
|
self.cref = { c, s, o }
|
||||||
self.sref = { c, co and co[s] and co[s]['.type'] or s, o }
|
self.sref = { c, co and co[s] and co[s]['.type'] or s, o }
|
||||||
self.c = self:_loadconf(co, c)
|
self.c = self:_loadconf(co, c, scheme.configdir)
|
||||||
self.s = scheme
|
self.s = scheme
|
||||||
self.t = TYPE_OPTION
|
self.t = TYPE_OPTION
|
||||||
end
|
end
|
||||||
|
@ -1202,7 +1202,7 @@ enum = util.class(option)
|
||||||
function enum.__init__(self, scheme, co, c, s, o, v)
|
function enum.__init__(self, scheme, co, c, s, o, v)
|
||||||
self.cref = { c, s, o, v }
|
self.cref = { c, s, o, v }
|
||||||
self.sref = { c, co and co[s] and co[s]['.type'] or s, o, v }
|
self.sref = { c, co and co[s] and co[s]['.type'] or s, o, v }
|
||||||
self.c = self:_loadconf(co, c)
|
self.c = self:_loadconf(co, c, scheme.configdir)
|
||||||
self.s = scheme
|
self.s = scheme
|
||||||
self.t = TYPE_ENUM
|
self.t = TYPE_ENUM
|
||||||
end
|
end
|
||||||
|
|
|
@ -200,7 +200,8 @@ elseif arguments[1] == "verify" or arguments[1] == "verify-scheme" then
|
||||||
( not options['no-strict-lists'] and true or false )
|
( not options['no-strict-lists'] and true or false )
|
||||||
|
|
||||||
local uvl = luci.uvl.UVL(
|
local uvl = luci.uvl.UVL(
|
||||||
type(options.schemedir) == "string" and options.schemedir
|
type(options.schemedir) == "string" and options.schemedir,
|
||||||
|
type(options.configdir) == "string" and options.configdir
|
||||||
)
|
)
|
||||||
|
|
||||||
local cso = luci.util.split( arguments[2], "." )
|
local cso = luci.util.split( arguments[2], "." )
|
||||||
|
|
Loading…
Reference in a new issue