|
Packit Service |
a2ae7a |
(*
|
|
Packit Service |
a2ae7a |
Module: AptPreferences
|
|
Packit Service |
a2ae7a |
Apt/preferences module for Augeas
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Author: Raphael Pinson <raphael.pinson@camptocamp.com>
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module AptPreferences =
|
|
Packit Service |
a2ae7a |
autoload xfm
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: Entries
|
|
Packit Service |
a2ae7a |
************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: colon *)
|
|
Packit Service |
a2ae7a |
let colon = del /:[ \t]*/ ": "
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: pin_gen
|
|
Packit Service |
a2ae7a |
A generic pin
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Parameters:
|
|
Packit Service |
a2ae7a |
lbl:string - the label *)
|
|
Packit Service |
a2ae7a |
let pin_gen (lbl:string) = store lbl
|
|
Packit Service |
a2ae7a |
. [ label lbl . Sep.space . store Rx.no_spaces ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: pin_keys *)
|
|
Packit Service |
a2ae7a |
let pin_keys =
|
|
Packit Service |
a2ae7a |
let space_in = store /[^, \r\t\n][^,\n]*[^, \r\t\n]|[^, \t\n\r]/
|
|
Packit Service |
a2ae7a |
in Build.key_value /[aclnov]/ Sep.equal space_in
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: pin_options *)
|
|
Packit Service |
a2ae7a |
let pin_options =
|
|
Packit Service |
a2ae7a |
let comma = Util.delim ","
|
|
Packit Service |
a2ae7a |
in store "release" . Sep.space
|
|
Packit Service |
a2ae7a |
. Build.opt_list pin_keys comma
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: version_pin *)
|
|
Packit Service |
a2ae7a |
let version_pin = pin_gen "version"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: origin_pin *)
|
|
Packit Service |
a2ae7a |
let origin_pin = pin_gen "origin"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: pin *)
|
|
Packit Service |
a2ae7a |
let pin =
|
|
Packit Service |
a2ae7a |
let pin_value = pin_options | version_pin | origin_pin
|
|
Packit Service |
a2ae7a |
in Build.key_value_line "Pin" colon pin_value
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: entries *)
|
|
Packit Service |
a2ae7a |
let entries = Build.key_value_line ("Explanation"|"Package"|"Pin-Priority")
|
|
Packit Service |
a2ae7a |
colon (store Rx.space_in)
|
|
Packit Service |
a2ae7a |
| pin
|
|
Packit Service |
a2ae7a |
| Util.comment
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: record *)
|
|
Packit Service |
a2ae7a |
let record = [ seq "record" . entries+ ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: Lens
|
|
Packit Service |
a2ae7a |
************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: lns *)
|
|
Packit Service |
a2ae7a |
let lns = Util.empty* . (Build.opt_list record Util.eol+ . Util.empty*)?
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: filter *)
|
|
Packit Service |
a2ae7a |
let filter = incl "/etc/apt/preferences"
|
|
Packit Service |
a2ae7a |
. incl "/etc/apt/preferences.d/*"
|
|
Packit Service |
a2ae7a |
. Util.stdexcl
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
let xfm = transform lns filter
|