Gentoo Archives: gentoo-commits

From: "André Erdmann" <dywi@×××××××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
Date: Fri, 06 Jul 2012 22:19:48
Message-Id: 1341612453.e62fd4e641081815efc596bc1d719596eede6f6b.dywi@gentoo
1 commit: e62fd4e641081815efc596bc1d719596eede6f6b
2 Author: André Erdmann <dywi <AT> mailerd <DOT> de>
3 AuthorDate: Fri Jul 6 22:07:33 2012 +0000
4 Commit: André Erdmann <dywi <AT> mailerd <DOT> de>
5 CommitDate: Fri Jul 6 22:07:33 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e62fd4e6
7
8 DescriptionReader: no exception on field redef
9
10 The DescriptionReader now prints a warning if a field ('Title',..)
11 is specified more than once in a DESCRIPTION file.
12 Old behavior was to raise an exception.
13
14 modified: roverlay/rpackage/descriptionreader.py
15
16 ---
17 roverlay/rpackage/descriptionreader.py | 24 ++++++++++++++++--------
18 1 files changed, 16 insertions(+), 8 deletions(-)
19
20 diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
21 index fca19e9..bfb50bb 100644
22 --- a/roverlay/rpackage/descriptionreader.py
23 +++ b/roverlay/rpackage/descriptionreader.py
24 @@ -293,7 +293,7 @@ class DescriptionReader ( object ):
25 pass
26
27 else:
28 - # line introduces a new field context, forget last one
29 + # line has to introduce a new field context, forget last one
30 field_context = None
31
32 line_components = sline.partition (
33 @@ -301,13 +301,13 @@ class DescriptionReader ( object ):
34 )
35
36 if line_components [1]:
37 - # line contains a field separator, set field context
38 + # line contains a field separator => new context, set it
39 field_context_ref = self.field_definition.get (
40 line_components [0]
41 )
42
43 if field_context_ref is None:
44 - # useless line, skip
45 + # field not defined, skip
46 self.logger.info (
47 "Skipped a description field: '%s'.", line_components [0]
48 )
49 @@ -328,12 +328,20 @@ class DescriptionReader ( object ):
50 )
51
52 if field_context in raw:
53 - raise Exception ( "field %s exists!" % field_context )
54 + # some packages have multiple Title fields
55 + # warn about that 'cause it could lead to confusing
56 + # ebuild/metadata output
57 + self.logger.warning (
58 + "field {} redefined!".format ( field_context )
59 + )
60 +
61 + raw [field_context].append ( sline )
62
63 - # add values to read_data, no need to check
64 - # line_components [2] 'cause [1] was a true str
65 - # create a new empty list for this field_context
66 - raw[field_context] = [ line_components [2].lstrip() ]
67 + else:
68 + # add values to read_data, no need to check
69 + # line_components [2] 'cause [1] was a true str
70 + # create a new empty list for this field_context
71 + raw[field_context] = [ line_components [2].lstrip() ]
72
73 else:
74 # reaching this branch means that