blob: b61c215d9247375326d48ddf07a8282690f1ff52 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
|