File: release.ml

package info (click to toggle)
dose3 3.3~beta1-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,936 kB
  • ctags: 2,055
  • sloc: ml: 12,421; ansic: 433; makefile: 332; python: 164; perl: 139; sh: 43
file content (85 lines) | stat: -rw-r--r-- 3,280 bytes parent folder | download
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
(******************************************************************************)
(*  This file is part of the Dose library http://www.irill.org/software/dose  *)
(*                                                                            *)
(*  Copyright (C) 2009-2011 Pietro Abate <pietro.abate@pps.jussieu.fr>        *)
(*                                                                            *)
(*  This library is free software: you can redistribute it and/or modify      *)
(*  it under the terms of the GNU Lesser General Public License as            *)
(*  published by the Free Software Foundation, either version 3 of the        *)
(*  License, or (at your option) any later version.  A special linking        *)
(*  exception to the GNU Lesser General Public License applies to this        *)
(*  library, see the COPYING file for more information.                       *)
(*                                                                            *)
(*  Work developed with the support of the Mancoosi Project                   *)
(*  http://www.mancoosi.org                                                   *)
(*                                                                            *)
(******************************************************************************)

(** Representation of a debian release files *) 

open ExtLib

type release = {
  fname : string;
  origin : string;
  label : string;
  suite : string;
  version: string;
  codename : string;
  date: string;
  architecture: string;
  component : string;
  notauto: bool;
  autoup: bool;
  description: string;
  md5sums: (string * string * string) list;
  sha1: (string * string * string) list;
  sha256: (string * string * string) list
}

let default_release = {
  fname = "";
  origin = "";
  label = "";
  suite = "";
  version = "";
  codename = "";
  date = "";
  architecture = "";
  component = "";
  notauto = false;
  autoup = false;
  description = "";
  md5sums = [];
  sha1 = [];
  sha256 = []
}

let parse_release_stanza fname par = {
  fname = Filename.basename (fname);
  origin = Packages.parse_s ~opt:"" Packages.parse_string "Origin" par;
  label = Packages.parse_s ~opt:"" Packages.parse_string "Label" par;
  suite = Packages.parse_s ~opt:"" Packages.parse_string "Suite" par;
  version = Packages.parse_s ~opt:"" Packages.parse_string "Version" par;
  codename = Packages.parse_s ~opt:"" Packages.parse_string "Codename" par;
  date = Packages.parse_s ~opt:"" Packages.parse_string "Date" par;
  architecture = Packages.parse_s ~opt:"" Packages.parse_string "Architectures" par;
  component = Packages.parse_s ~opt:"" Packages.parse_string "Components" par;
  notauto = Packages.parse_s ~opt:false Packages.parse_bool "NotAutomatic" par;
  autoup = Packages.parse_s ~opt:false Packages.parse_bool "ButAutomaticUpgrades" par;
  description = Packages.parse_s ~opt:"" Packages.parse_string "Description" par;
  md5sums = [];
  sha1 = [];
  sha256 = []
}

let release_parser stanza_parser fname p =
  match
  Format822_parser.doc_822_sign 
    Format822_lexer.token_822 p.Format822.lexbuf 
  with 
  |Some st -> Some (stanza_parser fname st)
  |None -> None

let parse_release_in fname ic =
  Format822.parse_from_ch (release_parser parse_release_stanza fname) ic