[augeas-devel] [PATCH] Rewrite dput.aug using inifile.aug
Raphael Pinson
raphink at gmail.com
Fri Jul 25 11:54:21 UTC 2008
# HG changeset patch
# User Raphael Pinson <raphink at gmail.com>
# Date 1216986841 -7200
# Node ID f1ade288e3ea62d5799229c2a8610f6e1b4e86b2
# Parent f575bc6e9cbb2a04037800d5a75a75bf84a62ed6
Rewrite dput.aug using inifile.aug
Add a few keywords from man dput.cf
Fix test file after rewrite
diff -r f575bc6e9cbb -r f1ade288e3ea lenses/dput.aug
--- a/lenses/dput.aug Fri Jul 25 13:46:13 2008 +0200
+++ b/lenses/dput.aug Fri Jul 25 13:54:01 2008 +0200
@@ -1,60 +1,33 @@
(* Dput module for Augeas *)
(* Author: Raphael Pinson <raphink at gmail.com> *)
(* *)
-(* Status: most settings supported *)
module Dput =
autoload xfm
+ let setting = IniFile.entry "allow_non-us_software"
+ | IniFile.entry "allow_unsigned_uploads"
+ | IniFile.entry "check_version"
+ | IniFile.entry "default_host_main"
+ | IniFile.entry "default_host_non-us"
+ | IniFile.entry "fqdn"
+ | IniFile.entry "hash"
+ | IniFile.entry "incoming"
+ | IniFile.entry "login"
+ | IniFile.entry "method"
+ | IniFile.entry "passive_ftp"
+ | IniFile.entry "post_upload_command"
+ | IniFile.entry "pre_upload_command"
+ | IniFile.entry "progress_indicator"
+ | IniFile.entry "run_dinstall"
+ | IniFile.entry "run_lintian"
+ | IniFile.entry "scp_compress"
+ | IniFile.entry "ssh_config_options"
- (* Define useful shortcuts *)
+ let record = IniFile.record "target" setting
- let eol = Util.del_str "\n"
- let del_to_eol = del /[^\n]*/ ""
- let value_sep = del /[ \t]*=[ \t]*/ "="
- let value_to_eol = store /([^ \t\n][^\n]*)?/
-
-
- (* Define kw_arg function *)
-
- let kw_arg (kw:string) = [ key kw . value_sep . value_to_eol . eol ]
-
-
- (* Define comment and empty strings *)
-
- let comment = [ label "comment" . del /#[ \t]*/ "#" . store /([^ \t\n][^\n]*)?/ . eol ]
- let empty = [ del /[ \t]*/ "" . eol ]
-
-
- (* Define record *)
-
- let target = Util.del_str "[" . store /[^]= ]+/ . Util.del_str "]". eol
-
- let settings = kw_arg "allow_non-us_software"
- | kw_arg "allow_unsigned_uploads"
- | kw_arg "check_version"
- | kw_arg "default_host_main"
- | kw_arg "default_host_non-us"
- | kw_arg "fqdn"
- | kw_arg "hash"
- | kw_arg "incoming"
- | kw_arg "login"
- | kw_arg "method"
- | kw_arg "passive_ftp"
- | kw_arg "post_upload_command"
- | kw_arg "pre_upload_command"
- | kw_arg "run_dinstall"
- | kw_arg "run_lintian"
- | kw_arg "scp_compress"
-
-
- let record = [ label "target" . target . settings* ]
-
-
- (* Define lens *)
-
- let lns = ( comment | record | empty )*
+ let lns = IniFile.lns record
let filter = (incl "/etc/dput.cf")
. (incl "~/.dput.cf")
diff -r f575bc6e9cbb -r f1ade288e3ea lenses/tests/test_dput.aug
--- a/lenses/tests/test_dput.aug Fri Jul 25 13:46:13 2008 +0200
+++ b/lenses/tests/test_dput.aug Fri Jul 25 13:54:01 2008 +0200
@@ -69,50 +69,45 @@ post_upload_command = /usr/bin/mini-dins
{ "run_dinstall" = "0" }
{ "check_version" = "0" }
{ "scp_compress" = "0" }
- { "post_upload_command" = "" }
- { "pre_upload_command" = "" }
+ { "post_upload_command" }
+ { "pre_upload_command" }
{ "passive_ftp" = "1" }
- { "default_host_non-us" = "" }
+ { "default_host_non-us" }
{ "default_host_main" = "hebex" }
- }
- {}
+ {} }
{ "target" = "hebex"
{ "fqdn" = "condor.infra.s1.p.fti.net" }
{ "login" = "anonymous" }
{ "method" = "ftp" }
{ "incoming" = "/incoming/hebex" }
{ "passive_ftp" = "0" }
- }
- {}
+ {} }
{ "target" = "dop/desktop"
{ "fqdn" = "condor.infra.s1.p.fti.net" }
{ "login" = "anonymous" }
{ "method" = "ftp" }
{ "incoming" = "/incoming/dop/desktop" }
{ "passive_ftp" = "0" }
- }
- {}
+ {} }
{ "target" = "jp-non-us"
{ "fqdn" = "hp.debian.or.jp" }
{ "incoming" = "/pub/Incoming/upload-non-US" }
{ "login" = "anonymous" }
- }
- {}
- { "comment" = "DISABLED due to being repaired currently" }
- { "comment" = "[erlangen]" }
- { "comment" = "fqdn = ftp.uni-erlangen.de" }
- { "comment" = "incoming = /public/pub/Linux/debian/UploadQueue/" }
- { "comment" = "login = anonymous" }
- {}
+ {}
+ { "comment" = "DISABLED due to being repaired currently" }
+ { "comment" = "[erlangen]" }
+ { "comment" = "fqdn = ftp.uni-erlangen.de" }
+ { "comment" = "incoming = /public/pub/Linux/debian/UploadQueue/" }
+ { "comment" = "login = anonymous" }
+ {} }
{ "target" = "ftp-master"
{ "fqdn" = "ftp-master.debian.org" }
{ "incoming" = "/pub/UploadQueue/" }
{ "login" = "anonymous" }
{ "post_upload_command" = "/usr/bin/mini-dinstall --batch" }
- }
- { "comment" = "And if you want to override one of the defaults, add it here." }
- { "comment" = "# For example, comment out the next line" }
- { "comment" = "# login = another_username" }
- { "comment" = "# post_upload_command = /path/to/some/script" }
- { "comment" = "# pre_upload_command = /path/to/some/script" }
- { "comment" = "" }
+ { "comment" = "And if you want to override one of the defaults, add it here." }
+ { "comment" = "# For example, comment out the next line" }
+ { "comment" = "# login = another_username" }
+ { "comment" = "# post_upload_command = /path/to/some/script" }
+ { "comment" = "# pre_upload_command = /path/to/some/script" }
+ { "comment" } }
More information about the augeas-devel
mailing list