aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Harvey <chris@basementcode.com>2010-07-08 08:57:41 -0400
committerChristopher Harvey <chris@basementcode.com>2010-07-08 08:57:41 -0400
commitdaa856073672aa361d83ff2803252335405b79ec (patch)
tree86fb7b26f09c20882980def4a6a46fcda56e3c2c
parentChanged the code that adds new nodes to the tree, so that it respects the ord... (diff)
downloadventoo-daa856073672aa361d83ff2803252335405b79ec.tar.gz
ventoo-daa856073672aa361d83ff2803252335405b79ec.tar.bz2
ventoo-daa856073672aa361d83ff2803252335405b79ec.zip
Added new lenses for future use.
-rw-r--r--lenses/packagemask.aug39
-rw-r--r--lenses/packageuse.aug25
2 files changed, 64 insertions, 0 deletions
diff --git a/lenses/packagemask.aug b/lenses/packagemask.aug
new file mode 100644
index 0000000..b61c215
--- /dev/null
+++ b/lenses/packagemask.aug
@@ -0,0 +1,39 @@
+(* Parsing /etc/portage/package.mask *)
+
+(*
+ It is still far from perfect, but at least it doesn't give "ambiguous concat"
+ anymore and work for packages without digits in package name.
+*)
+
+module Packagemask =
+ autoload xfm
+
+ let sep_spc = Util.del_ws_spc
+ let sep_tab = Util.del_ws_tab
+
+ let eol = del /[ \t]*\n/ "\n"
+ let indent = del /[ \t]*/ ""
+
+ let comment = Util.comment
+ let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ]
+
+ let operator = /[<>]?=?/
+
+ let package = /[a-z_\/-]+([a-z0-9_\/-]*[a-z_-])?/
+ let version = /[0-9]+(\.[0-9]+)*(-r[0-9]+)?/
+ let sep_version = del /-/ "-"
+
+ let word = /[^#<>= \n\t]+/
+
+ let record = [ seq "packagemask" . indent
+ . [ label "operator" . store operator ]
+ . [ label "package" . store package ]
+ . [ sep_version . label "version" . store version ]?
+ . (comment|eol)
+ ]
+
+ let lns = ( empty | comment | record ) *
+
+ let filter = (incl "/etc/portage/package.mask")
+ . (incl "/etc/portage/package.mask/*")
+ let xfm = transform lns filter
diff --git a/lenses/packageuse.aug b/lenses/packageuse.aug
new file mode 100644
index 0000000..10a4e27
--- /dev/null
+++ b/lenses/packageuse.aug
@@ -0,0 +1,25 @@
+(* Parsing /etc/portage/package.use *)
+
+module Packageuse =
+ autoload xfm
+
+ let sep_spc = Util.del_ws_spc
+ let sep_tab = Util.del_ws_tab
+
+ let eol = del /[ \t]*\n/ "\n"
+ let indent = del /[ \t]*/ ""
+
+ let comment = Util.comment
+ let empty = [ del /[ \t]*#?[ \t]*\n/ "\n" ]
+
+ let word = /[^# \n\t]+/
+ let record = [ seq "packageuse" . indent .
+ [ label "package" . store word ] . sep_tab .
+ [ label "use" . store word ] .
+ [ label "use" . sep_spc . store word ]*
+ . (comment|eol) ]
+
+ let lns = ( empty | comment | record ) *
+ let filter = (incl "/etc/portage/package.use")
+ . (incl "/etc/portage/package.use/*")
+ let xfm = transform lns filter