[augeas-devel] augeas: master - Shellvars: map comments with Util.comment and Util.empty
David Lutterkort
lutter at fedoraproject.org
Wed Apr 8 19:55:09 UTC 2009
Gitweb: http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=74a4df6e89d5e43558e0b88454581dacba3d2853
Commit: 74a4df6e89d5e43558e0b88454581dacba3d2853
Parent: 9d90b408dd1860487918daf57a280026a53c27c2
Author: Raphael Pinson <raphink at gmail.com>
AuthorDate: Wed Apr 8 12:48:03 2009 -0700
Committer: David Lutterkort <lutter at redhat.com>
CommitterDate: Wed Apr 8 12:48:03 2009 -0700
Shellvars: map comments with Util.comment and Util.empty
---
lenses/shellvars.aug | 5 +++--
lenses/tests/test_shellvars.aug | 4 ++--
tests/xpath.tests | 2 +-
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/lenses/shellvars.aug b/lenses/shellvars.aug
index 841669e..d3e4bbe 100644
--- a/lenses/shellvars.aug
+++ b/lenses/shellvars.aug
@@ -7,7 +7,8 @@ module Shellvars =
let key_re = /[A-Za-z0-9_]+(\[[0-9]+\])?/ - "unset" - "export"
let eq = Util.del_str "="
- let comment = [ del /(#.*)?[ \t]*\n/ "# \n" ]
+ let comment = Util.comment
+ let empty = Util.empty
let char = /[^() '"\t\n]|\\\\"/
let dquot = /"([^"\\\n]|\\\\.)*"/ (* " Emacs, relax *)
@@ -40,7 +41,7 @@ module Shellvars =
Util.del_ws_spc . store /[^= \t\n]+/ . eol
]
- let lns = (comment | source | kv | unset) *
+ let lns = (comment | empty | source | kv | unset) *
let sc_incl (n:string) = (incl ("/etc/sysconfig/" . n))
let filter_sysconfig =
diff --git a/lenses/tests/test_shellvars.aug b/lenses/tests/test_shellvars.aug
index b27f160..552d20c 100644
--- a/lenses/tests/test_shellvars.aug
+++ b/lenses/tests/test_shellvars.aug
@@ -17,14 +17,14 @@ unset ONBOOT
let key_brack = "SOME_KEY[1]=\nDEVICE=eth0\n"
test Shellvars.lns get eth_static =
- { }
+ { "#comment" = "Intel Corporation PRO/100 VE Network Connection" }
{ "DEVICE" = "eth0" }
{ "BOOTPROTO" = "static" }
{ "BROADCAST" = "172.31.0.255" }
{ "HWADDR" = "ab:cd:ef:12:34:56" }
{ "IPADDR" = "172.31.0.31"
{ "export" } }
- { }
+ { "#comment" = "DHCP_HOSTNAME=host.example.com" }
{ "NETMASK" = "255.255.255.0" }
{ "NETWORK" = "172.31.0.0" }
{ "unset" = "ONBOOT" }
diff --git a/tests/xpath.tests b/tests/xpath.tests
index 12ee3cc..9926c3e 100644
--- a/tests/xpath.tests
+++ b/tests/xpath.tests
@@ -146,7 +146,7 @@ test ipaddr-sibling //*[../ipaddr]
/files/etc/hosts/2/canonical = orange.watzmann.net
/files/etc/hosts/2/alias = orange
-test lircd-ancestor //*[ancestor::kudzu]
+test lircd-ancestor //*[ancestor::kudzu][label() != '#comment']
/augeas/files/etc/sysconfig/kudzu/path = /files/etc/sysconfig/kudzu
/augeas/files/etc/sysconfig/kudzu/lens
/augeas/files/etc/sysconfig/kudzu/lens/info = ...
More information about the augeas-devel
mailing list