public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "André Erdmann" <dywi@mailerd.de>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/
Date: Fri,  6 Jul 2012 22:19:08 +0000 (UTC)	[thread overview]
Message-ID: <1341612453.e62fd4e641081815efc596bc1d719596eede6f6b.dywi@gentoo> (raw)

commit:     e62fd4e641081815efc596bc1d719596eede6f6b
Author:     André Erdmann <dywi <AT> mailerd <DOT> de>
AuthorDate: Fri Jul  6 22:07:33 2012 +0000
Commit:     André Erdmann <dywi <AT> mailerd <DOT> de>
CommitDate: Fri Jul  6 22:07:33 2012 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/R_overlay.git;a=commit;h=e62fd4e6

DescriptionReader: no exception on field redef

The DescriptionReader now prints a warning if a field ('Title',..)
is specified more than once in a DESCRIPTION file.
Old behavior was to raise an exception.

	modified:   roverlay/rpackage/descriptionreader.py

---
 roverlay/rpackage/descriptionreader.py |   24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/roverlay/rpackage/descriptionreader.py b/roverlay/rpackage/descriptionreader.py
index fca19e9..bfb50bb 100644
--- a/roverlay/rpackage/descriptionreader.py
+++ b/roverlay/rpackage/descriptionreader.py
@@ -293,7 +293,7 @@ class DescriptionReader ( object ):
 					pass
 
 			else:
-				# line introduces a new field context, forget last one
+				# line has to introduce a new field context, forget last one
 				field_context = None
 
 				line_components = sline.partition (
@@ -301,13 +301,13 @@ class DescriptionReader ( object ):
 				)
 
 				if line_components [1]:
-					# line contains a field separator, set field context
+					# line contains a field separator => new context, set it
 					field_context_ref = self.field_definition.get (
 						line_components [0]
 					)
 
 					if field_context_ref is None:
-						# useless line, skip
+						# field not defined, skip
 						self.logger.info (
 							"Skipped a description field: '%s'.", line_components [0]
 						)
@@ -328,12 +328,20 @@ class DescriptionReader ( object ):
 							)
 
 						if field_context in raw:
-							raise Exception ( "field %s exists!" % field_context )
+							# some packages have multiple Title fields
+							# warn about that 'cause it could lead to confusing
+							# ebuild/metadata output
+							self.logger.warning (
+								"field {} redefined!".format ( field_context )
+							)
+
+							raw [field_context].append ( sline )
 
-						# add values to read_data, no need to check
-						#  line_components [2] 'cause [1] was a true str
-						# create a new empty list for this field_context
-						raw[field_context] = [ line_components [2].lstrip() ]
+						else:
+							# add values to read_data, no need to check
+							#  line_components [2] 'cause [1] was a true str
+							# create a new empty list for this field_context
+							raw[field_context] = [ line_components [2].lstrip() ]
 
 				else:
 					# reaching this branch means that



             reply	other threads:[~2012-07-06 22:19 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-06 22:19 André Erdmann [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-02-16  1:35 [gentoo-commits] proj/R_overlay:master commit in: roverlay/rpackage/ Benda XU
2013-08-21 13:51 André Erdmann
2013-08-21 13:51 André Erdmann
2013-08-20 21:46 André Erdmann
2013-07-25 13:28 André Erdmann
2013-07-25 13:25 André Erdmann
2013-07-25  8:47 André Erdmann
2013-07-25  8:47 André Erdmann
2013-07-23 18:34 [gentoo-commits] proj/R_overlay:gsoc13/next " André Erdmann
2013-07-23 18:34 ` [gentoo-commits] proj/R_overlay:master " André Erdmann
2013-07-11 16:29 André Erdmann
2013-04-25 16:44 André Erdmann
2013-02-09 20:45 André Erdmann
2012-08-07  8:50 André Erdmann
2012-07-30  8:52 André Erdmann
2012-07-03 17:48 André Erdmann
2012-07-02 16:52 André Erdmann
2012-06-29 22:48 André Erdmann
2012-06-28 15:55 André Erdmann
2012-06-28 15:55 André Erdmann
2012-06-27 14:46 André Erdmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1341612453.e62fd4e641081815efc596bc1d719596eede6f6b.dywi@gentoo \
    --to=dywi@mailerd.de \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox