- various fixes to the BootConf lens, thanks to william@ for providing a

few boot.conf results.
This commit is contained in:
jasper 2013-01-03 19:50:47 +00:00
parent 1cf8b76d84
commit 5b8846441b
4 changed files with 68 additions and 24 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.10 2013/01/02 20:28:08 jasper Exp $
# $OpenBSD: Makefile,v 1.11 2013/01/03 19:50:47 jasper Exp $
COMMENT= configuration editing tool and API
DISTNAME= augeas-1.0.0
REVISION= 8
REVISION= 9
CATEGORIES= sysutils devel
SHARED_LIBS += augeas 0.0 # 16.0

View File

@ -29,17 +29,19 @@ autoload xfm
************************************************************************)
(* View: comment *)
let comment = Util.comment
let comment = Util.comment
(* View: empty *)
let empty = Util.empty
let empty = Util.empty
(* View: eol *)
let eol = Util.eol
let eol = Util.eol
(* View: fspath *)
let fspath = Rx.fspath
let fspath = Rx.fspath
(* View: space *)
let space = Sep.space
let space = Sep.space
(* View: word *)
let word = Rx.word
let word = Rx.word
(* View: mem_spec *)
let mem_spec = /=[0-9]+[K|M|G]/ | /[-+]{1}[A-Za-z0-9]+\@[A-Za-z0-9]+/
(************************************************************************
* View: key_opt_value_line
@ -95,24 +97,18 @@ let echo = Build.key_value_line
"echo" space (store word)
(* View: boot
boot [image [-acds]]
XXX: the last arguments are not always needed, so make them optional *)
boot [image [-acds]] *)
let boot =
let image = [ label "image" . store fspath ]
in let arg = [ label "arg" . store word ]
in Build.key_value_line "boot" space (image . space . arg)
in key_opt_value_line "boot" (image . (space . arg)?)
(* View: machine
machine [command] *)
let machine =
let machine_entry = Build.key_value ("comaddr"|"memory")
space (store word)
| Build.flag ("diskinfo"|"regs")
in Build.key_value_line
"machine" space
(Build.opt_list
machine_entry
space)
let command = [ label "command" . store word ]
in let arg = [ label "arg" . store (word|mem_spec) ]
in key_opt_value_line "machine" (command . (space . arg)?)
(************************************************************************
* Lens

View File

@ -5,6 +5,17 @@ Module: Test_BootConf
module Test_bootconf =
test BootConf.boot get "boot\n" =
{ "boot" }
test BootConf.boot get "boot /bsd.rd\n" =
{ "boot"
{ "image" = "/bsd.rd"} }
test BootConf.boot get "boot tftp:bsd\n" =
{ "boot"
{ "image" = "tftp:bsd" } }
test BootConf.boot get "boot /bsd -s\n" =
{ "boot"
{ "image" = "/bsd" }
@ -13,22 +24,37 @@ test BootConf.boot get "boot /bsd -s\n" =
test BootConf.echo get "echo 42\n" =
{ "echo" = "42" }
test BootConf.ls get "ls /\n" =
test BootConf.ls get "ls /\n" =
{ "ls" = "/" }
test BootConf.ls get "ls //\n" =
test BootConf.ls get "ls //\n" =
{ "ls" = "//" }
test BootConf.ls get "ls /some/path/\n" =
test BootConf.ls get "ls /some/path/\n" =
{ "ls" = "/some/path/" }
test BootConf.machine get "machine diskinfo\n" =
{ "machine"
{ "diskinfo" } }
{ "command" = "diskinfo" } }
test BootConf.machine get "machine comaddr 0xdeadbeef\n" =
{ "machine"
{ "comaddr" = "0xdeadbeef" } }
{ "command" = "comaddr" }
{ "arg" = "0xdeadbeef" } }
test BootConf.machine get "machine memory\n" =
{ "machine"
{ "command" = "memory" } }
test BootConf.machine get "machine memory =64M\n" =
{ "machine"
{ "command" = "memory" }
{ "arg" = "=64M" } }
test BootConf.machine get "machine memory +0x2000000@0x1000000\n" =
{ "machine"
{ "command" = "memory" }
{ "arg" = "+0x2000000@0x1000000" } }
test BootConf.set get "set tty com0\n" =
{ "set"
@ -45,3 +71,6 @@ test BootConf.stty get "stty /dev/cuaU0 115200\n" =
test BootConf.stty get "stty /dev/cuaU0\n" =
{ "stty"
{ "device" = "/dev/cuaU0" } }
test BootConf.stty get "stty\n" =
{ "stty" }

View File

@ -0,0 +1,19 @@
$OpenBSD: patch-lenses_monit_aug,v 1.1 2013/01/03 19:50:47 jasper Exp $
commit 0efc183d740421e0811f473666c4f1849e9f0c3f
Author: Jasper Lievisse Adriaanse <jasper@humppa.nl>
Date: Thu Jan 3 16:54:18 2013 +0100
Also handle /etc/monitrc
Fixes ticket #326
--- lenses/monit.aug.orig Thu Jan 3 18:40:32 2013
+++ lenses/monit.aug Thu Jan 3 18:40:41 2013
@@ -65,6 +65,6 @@ let entry = (set|include|service)
let lns = (comment|empty|entry) *
let filter = incl "/etc/monit/monitrc"
- . Util.stdexcl
+ . incl "/etc/monitrc"
let xfm = transform lns filter