Bump to 1.14.1
[platform/upstream/augeas.git] / lenses / tests / test_debctrl.aug
1 module Test_debctrl =
2
3  let source = "Source: libtest-distmanifest-perl\n"
4  let source_result =   { "Source" = "libtest-distmanifest-perl" }
5
6  test (Debctrl.simple_entry Debctrl.simple_src_keyword ) get source =
7     source_result
8
9  test (Debctrl.simple_entry Debctrl.simple_src_keyword ) get 
10   "Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>\n"
11    = {  "Maintainer" = "Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>"
12      }
13
14  let uploaders 
15    = "Uploaders: foo@bar, Dominique Dumont <dominique.dumont@xx.yyy>,\n"
16    . "  gregor herrmann <gregoa@xxx.yy>\n"
17
18  let uploaders_result =
19     { "Uploaders"
20        { "1" = "foo@bar"}
21        { "2" = "Dominique Dumont <dominique.dumont@xx.yyy>" }
22        { "3" = "gregor herrmann <gregoa@xxx.yy>" } }
23
24  test Debctrl.uploaders get uploaders = uploaders_result
25
26 (* test package dependencies *)
27 test Debctrl.version_depends get "( >= 5.8.8-12 )" = 
28    { "version" { "relation"  = ">=" } { "number"  = "5.8.8-12" } }
29
30 test Debctrl.arch_depends get "[ !hurd-i386]" = 
31    { "arch" { "prefix"  = "!" } { "name"  = "hurd-i386" } }
32
33 test Debctrl.arch_depends get "[ hurd-i386]" = 
34    { "arch" { "prefix"  = "" } { "name"  = "hurd-i386" } }
35
36 let p_depends_test = "perl ( >= 5.8.8-12 ) [ !hurd-i386]"
37
38 test Debctrl.package_depends get p_depends_test =
39    { "perl"
40        { "version"
41                    { "relation"  = ">=" }
42                    { "number"  = "5.8.8-12" } }
43        { "arch" { "prefix"  = "!" } { "name"  = "hurd-i386" } } }
44
45 let dependency_test = "perl-modules (>= 5.10) | libmodule-build-perl"
46
47 test Debctrl.dependency get dependency_test = 
48    { "or" { "perl-modules" 
49                 { "version" { "relation"  = ">=" } 
50                             { "number"  = "5.10" } } } }
51    { "or" { "libmodule-build-perl" } }
52
53 test (Debctrl.dependency_list "Build-Depends-Indep") get 
54   "Build-Depends-Indep: perl (>= 5.8.8-12) [ !hurd-i386], \n"
55   . "   perl-modules (>= 5.10) | libmodule-build-perl,\n"
56   . "   libcarp-assert-more-perl,\n"
57   . "   libconfig-tiny-perl\n"
58   = { "Build-Depends-Indep"
59        { "and" { "or" { "perl" 
60                         { "version"
61                           { "relation"  = ">=" }
62                           { "number"  = "5.8.8-12" } }
63                         { "arch" 
64                           { "prefix"  = "!" } 
65                           { "name"  = "hurd-i386" } } } } }
66        { "and" { "or" { "perl-modules" 
67                         { "version" { "relation"  = ">=" }  
68                                     { "number"  = "5.10" } } } }
69                { "or" { "libmodule-build-perl" } } }
70        { "and" { "or" { "libcarp-assert-more-perl" } } }
71        { "and" { "or" { "libconfig-tiny-perl" } } } }
72
73 test (Debctrl.dependency_list "Depends") get 
74   "Depends: ${perl:Depends}, ${misc:Depends},\n"
75   ." libparse-recdescent-perl (>= 1.90.0)\n"
76   = { "Depends"
77        {  "and" { "or" { "${perl:Depends}" }} }
78        {  "and" { "or" { "${misc:Depends}" }} }
79        {  "and" { "or" { "libparse-recdescent-perl"  
80                          { "version"
81                            { "relation"  = ">=" }
82                            { "number"  = "1.90.0" } } } } }
83     } 
84
85  let description = "Description: describe and edit configuration data\n"
86  ." Config::Model enables [...] must:\n"
87  ."    - if the configuration data\n"
88  ." .\n"
89  ." With the elements above, (...) on ReadLine.\n"
90
91  test Debctrl.description get description = 
92   { "Description" 
93     { "summary" = "describe and edit configuration data" }
94     { "text" = "Config::Model enables [...] must:" }
95     { "text" = "   - if the configuration data" }
96     { "text" = "." }            
97     { "text" = "With the elements above, (...) on ReadLine."} }
98  
99
100  let simple_bin_pkg1 = "Package: libconfig-model-perl\n"
101      . "Architecture: all\n"
102      . "Description: dummy1\n"
103      . " dummy text 1\n"
104
105  let simple_bin_pkg2 = "Package: libconfig-model2-perl\n"
106      . "Architecture: all\n"
107      . "Description: dummy2\n"
108      . " dummy text 2\n"
109
110  test Debctrl.src_entries get source.uploaders 
111  =  { "Source" = "libtest-distmanifest-perl" }
112                 { "Uploaders"
113                   { "1" = "foo@bar"}
114                   { "2" = "Dominique Dumont <dominique.dumont@xx.yyy>" }
115                   { "3" = "gregor herrmann <gregoa@xxx.yy>" } }
116
117  test Debctrl.bin_entries get simple_bin_pkg1 = 
118   { "Package" = "libconfig-model-perl" }
119   { "Architecture" = "all" } 
120   { "Description" { "summary" = "dummy1" } {"text" = "dummy text 1" } }
121
122  
123  let paragraph_simple = source . uploaders ."\n" 
124        . simple_bin_pkg1 . "\n" 
125        . simple_bin_pkg2 
126
127  test Debctrl.lns get paragraph_simple =
128    { "srcpkg"   { "Source" = "libtest-distmanifest-perl" }
129                 { "Uploaders"
130                   { "1" = "foo@bar"}
131                   { "2" = "Dominique Dumont <dominique.dumont@xx.yyy>" }
132                   { "3" = "gregor herrmann <gregoa@xxx.yy>" } } }
133    { "binpkg" { "Package" = "libconfig-model-perl" }
134                     { "Architecture" = "all" } 
135                     { "Description" { "summary" = "dummy1" } 
136                                     { "text" = "dummy text 1" } } }
137    { "binpkg" { "Package" = "libconfig-model2-perl" }
138                     { "Architecture" = "all" } 
139                     { "Description" { "summary" = "dummy2" } 
140                                     { "text" = "dummy text 2" } } } 
141
142
143 (* PUT TESTS *)
144
145 test Debctrl.src_entries
146      put uploaders  
147      after set "/Uploaders/1" "foo@bar"
148    =  uploaders
149
150 test Debctrl.src_entries
151      put uploaders  
152   after set "/Uploaders/1" "bar@bar" 
153  =  "Uploaders: bar@bar, Dominique Dumont <dominique.dumont@xx.yyy>,\n"
154    . "  gregor herrmann <gregoa@xxx.yy>\n"
155
156 test Debctrl.src_entries
157      put uploaders  
158      after set "/Uploaders/4" "baz@bar"
159    =  "Uploaders: foo@bar, Dominique Dumont <dominique.dumont@xx.yyy>,\n"
160    . "  gregor herrmann <gregoa@xxx.yy>,\n"
161    . " baz@bar\n"
162
163 test Debctrl.lns put (source."\nPackage: test\nDescription: foobar\n")
164   after
165   set "/srcpkg/Uploaders/1" "foo@bar" ;
166   set "/srcpkg/Uploaders/2" "Dominique Dumont <dominique.dumont@xx.yyy>" ;
167   set "/srcpkg/Uploaders/3" "gregor herrmann <gregoa@xxx.yy>" ;
168   set "/srcpkg/Build-Depends-Indep/and[1]/or/perl/version/relation" ">=" ;
169   set "/srcpkg/Build-Depends-Indep/and[1]/or/perl/version/number" "5.8.8-12" ;
170   set "/srcpkg/Build-Depends-Indep/and[1]/or/perl/arch/prefix" "!" ;
171   set "/srcpkg/Build-Depends-Indep/and[1]/or/perl/arch/name" "hurd-i386" ;
172   set "/srcpkg/Build-Depends-Indep/and[2]/or[1]/perl-modules/version/relation" ">=" ;
173   set "/srcpkg/Build-Depends-Indep/and[2]/or[1]/perl-modules/version/number" "5.10" ;
174   set "/srcpkg/Build-Depends-Indep/and[2]/or[2]/libmodule-build-perl" "";
175   set "/srcpkg/Build-Depends-Indep/and[3]/or/libcarp-assert-more-perl" "" ;
176   set "/srcpkg/Build-Depends-Indep/and[4]/or/libconfig-tiny-perl" "" ;
177   set "/binpkg[1]/Package" "libconfig-model-perl"  ; 
178   (* must remove description because set cannot insert Archi before description *)
179   rm  "/binpkg[1]/Description" ;
180   set "/binpkg/Architecture" "all"  ;
181   set "/binpkg[1]/Description/summary" "dummy1" ;
182   set "/binpkg[1]/Description/text" "dummy text 1" ;
183   set "/binpkg[2]/Package" "libconfig-model2-perl" ;
184   set "/binpkg[2]/Architecture" "all" ;
185   set "/binpkg[2]/Description/summary" "dummy2" ;
186   set "/binpkg[2]/Description/text" "dummy text 2" 
187   =  
188 "Source: libtest-distmanifest-perl
189 Uploaders: foo@bar,
190  Dominique Dumont <dominique.dumont@xx.yyy>,
191  gregor herrmann <gregoa@xxx.yy>
192 Build-Depends-Indep: perl ( >= 5.8.8-12 ) [ !hurd-i386 ],
193  perl-modules ( >= 5.10 ) | libmodule-build-perl,
194  libcarp-assert-more-perl,
195  libconfig-tiny-perl
196
197 Package: libconfig-model-perl
198 Architecture: all
199 Description: dummy1
200  dummy text 1
201
202 Package: libconfig-model2-perl
203 Architecture: all
204 Description: dummy2
205  dummy text 2
206 "
207
208 (* Test Augeas' own control file *)
209 let augeas_control = "Source: augeas
210 Priority: optional
211 Maintainer: Nicolas Valcárcel Scerpella (Canonical) <nicolas.valcarcel@canonical.com>
212 Uploaders: Free Ekanayaka <freee@debian.org>, Micah Anderson <micah@debian.org>
213 Build-Depends: debhelper (>= 5), autotools-dev, libreadline-dev, chrpath,
214  naturaldocs (>= 1.51-1), texlive-latex-base
215 Standards-Version: 3.9.2
216 Section: libs
217 Homepage: http://augeas.net/
218 DM-Upload-Allowed: yes
219
220 Package: augeas-tools
221 Section: admin
222 Architecture: any
223 Depends: ${shlibs:Depends}, ${misc:Depends}
224 Description: Augeas command line tools
225  Augeas is a configuration editing tool. It parses configuration files in their
226  native formats and transforms them into a tree. Configuration changes are made
227  by manipulating this tree and saving it back into native config files.
228  .
229  This package provides command line tools based on libaugeas0:
230  - augtool, a tool to manage configuration files.
231  - augparse, a testing and debugging tool for augeas lenses.
232
233 Package: libaugeas-dev
234 Section: libdevel
235 Architecture: any
236 Depends: libaugeas0 (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
237 Description: Development files for writing applications based on libaugeas0
238  Augeas is a configuration editing tool. It parses configuration files in their
239  native formats and transforms them into a tree. Configuration changes are made
240  by manipulating this tree and saving it back into native config files.
241  .
242  This package includes the development files to write programs using the Augeas
243  API.
244 "
245 test DebCtrl.lns get augeas_control =
246   { "srcpkg"
247     { "Source" = "augeas" }
248     { "Priority" = "optional" }
249     { "Maintainer" = "Nicolas Valcárcel Scerpella (Canonical) <nicolas.valcarcel@canonical.com>" }
250     { "Uploaders"
251       { "1" = "Free Ekanayaka <freee@debian.org>" }
252       { "2" = "Micah Anderson <micah@debian.org>" }
253     }
254     { "Build-Depends"
255       { "and"
256         { "or"
257           { "debhelper"
258             { "version"
259               { "relation" = ">=" }
260               { "number" = "5" }
261             }
262           }
263         }
264       }
265       { "and"
266         { "or"
267           { "autotools-dev" }
268         }
269       }
270       { "and"
271         { "or"
272           { "libreadline-dev" }
273         }
274       }
275       { "and"
276         { "or"
277           { "chrpath" }
278         }
279       }
280       { "and"
281         { "or"
282           { "naturaldocs"
283             { "version"
284               { "relation" = ">=" }
285               { "number" = "1.51-1" }
286             }
287           }
288         }
289       }
290       { "and"
291         { "or"
292           { "texlive-latex-base" }
293         }
294       }
295     }
296     { "Standards-Version" = "3.9.2" }
297     { "Section" = "libs" }
298     { "Homepage" = "http://augeas.net/" }
299     { "DM-Upload-Allowed" = "yes" }
300   }
301   { "binpkg"
302     { "Package" = "augeas-tools" }
303     { "Section" = "admin" }
304     { "Architecture" = "any" }
305     { "Depends"
306       { "and"
307         { "or"
308           { "${shlibs:Depends}" }
309         }
310       }
311       { "and"
312         { "or"
313           { "${misc:Depends}" }
314         }
315       }
316     }
317     { "Description"
318       { "summary" = "Augeas command line tools" }
319       { "text" = "Augeas is a configuration editing tool. It parses configuration files in their" }
320       { "text" = "native formats and transforms them into a tree. Configuration changes are made" }
321       { "text" = "by manipulating this tree and saving it back into native config files." }
322       { "text" = "." }
323       { "text" = "This package provides command line tools based on libaugeas0:" }
324       { "text" = "- augtool, a tool to manage configuration files." }
325       { "text" = "- augparse, a testing and debugging tool for augeas lenses." }
326     }
327   }
328   { "binpkg"
329     { "Package" = "libaugeas-dev" }
330     { "Section" = "libdevel" }
331     { "Architecture" = "any" }
332     { "Depends"
333       { "and"
334         { "or"
335           { "libaugeas0"
336             { "version"
337               { "relation" = "=" }
338               { "number" = "${binary:Version}" }
339             }
340           }
341         }
342       }
343       { "and"
344         { "or"
345           { "${shlibs:Depends}" }
346         }
347       }
348       { "and"
349         { "or"
350           { "${misc:Depends}" }
351         }
352       }
353     }
354     { "Description"
355       { "summary" = "Development files for writing applications based on libaugeas0" }
356       { "text" = "Augeas is a configuration editing tool. It parses configuration files in their" }
357       { "text" = "native formats and transforms them into a tree. Configuration changes are made" }
358       { "text" = "by manipulating this tree and saving it back into native config files." }
359       { "text" = "." }
360       { "text" = "This package includes the development files to write programs using the Augeas" }
361       { "text" = "API." }
362     }
363   }
364
365 (* Bug #267: Python module extensions, from Debian Python Policy, chapter 2 *)
366 let python_control = "Source: graphite-web
367 Maintainer: Will Pearson (Editure Key) <wpearson@editure.co.uk>
368 Section: python
369 Priority: optional
370 Build-Depends: debhelper (>= 7), python-support (>= 0.8.4)
371 Standards-Version: 3.7.2
372 XS-Python-Version: current
373
374 Package: python-graphite-web
375 Architecture: all
376 Depends: ${python:Depends}
377 XB-Python-Version: ${python:Versions}
378 Provides: ${python:Provides}
379 Description: Enterprise scalable realtime graphing
380 "
381 test Debctrl.lns get python_control =
382   { "srcpkg"
383     { "Source" = "graphite-web" }
384     { "Maintainer" = "Will Pearson (Editure Key) <wpearson@editure.co.uk>" }
385     { "Section" = "python" }
386     { "Priority" = "optional" }
387     { "Build-Depends"
388       { "and"
389         { "or"
390           { "debhelper"
391             { "version"
392               { "relation" = ">=" }
393               { "number" = "7" }
394             }
395           }
396         }
397       }
398       { "and"
399         { "or"
400           { "python-support"
401             { "version"
402               { "relation" = ">=" }
403               { "number" = "0.8.4" }
404             }
405           }
406         }
407       }
408     }
409     { "Standards-Version" = "3.7.2" }
410     { "XS-Python-Version" = "current" }
411   }
412   { "binpkg"
413     { "Package" = "python-graphite-web" }
414     { "Architecture" = "all" }
415     { "Depends"
416       { "and"
417         { "or"
418           { "${python:Depends}" }
419         }
420       }
421     }
422     { "XB-Python-Version" = "${python:Versions}" }
423     { "Provides"
424       { "and"
425         { "or"
426           { "${python:Provides}" }
427         }
428       }
429     }
430     { "Description"
431       { "summary" = "Enterprise scalable realtime graphing" }
432     }
433   }
434