public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/
Date: Sat, 14 May 2016 18:33:56 +0000 (UTC)	[thread overview]
Message-ID: <1463250580.b78d61dd3e4281a43523aea1a24e395a2674c3ab.dolsen@gentoo> (raw)

commit:     b78d61dd3e4281a43523aea1a24e395a2674c3ab
Author:     Dirkjan Ochtman <dirkjan <AT> ochtman <DOT> nl>
AuthorDate: Tue May  3 06:33:47 2016 +0000
Commit:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat May 14 18:29:40 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=b78d61dd

repoman/modules/.../pkgmetadata.py: Early return on metadata parse errors

 pym/repoman/modules/scan/metadata/pkgmetadata.py | 148 ++++++++++++-----------
 1 file changed, 75 insertions(+), 73 deletions(-)

diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 3c1c2d0..3b48b8e 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -102,89 +102,91 @@ class PkgMetadata(ScanBase, USEFlagChecks):
 			metadata_bad = True
 			self.qatracker.add_error("metadata.bad", "%s/metadata.xml: %s" % (xpkg, e))
 			del e
+			self.muselist = frozenset(self.musedict)
+			return False
+
+		if not hasattr(xml_parser, 'parser') or \
+			sys.hexversion < 0x2070000 or \
+			(sys.hexversion > 0x3000000 and sys.hexversion < 0x3020000):
+			# doctype is not parsed with python 2.6 or 3.1
+			pass
 		else:
-			if not hasattr(xml_parser, 'parser') or \
-				sys.hexversion < 0x2070000 or \
-				(sys.hexversion > 0x3000000 and sys.hexversion < 0x3020000):
-				# doctype is not parsed with python 2.6 or 3.1
-				pass
+			if "XML_DECLARATION" not in xml_info:
+				self.qatracker.add_error(
+					"metadata.bad", "%s/metadata.xml: "
+					"xml declaration is missing on first line, "
+					"should be '%s'" % (xpkg, metadata_xml_declaration))
 			else:
-				if "XML_DECLARATION" not in xml_info:
+				xml_version, xml_encoding, xml_standalone = \
+					xml_info["XML_DECLARATION"]
+				if xml_encoding is None or \
+					xml_encoding.upper() != metadata_xml_encoding:
+					if xml_encoding is None:
+						encoding_problem = "but it is undefined"
+					else:
+						encoding_problem = "not '%s'" % xml_encoding
 					self.qatracker.add_error(
 						"metadata.bad", "%s/metadata.xml: "
-						"xml declaration is missing on first line, "
-						"should be '%s'" % (xpkg, metadata_xml_declaration))
-				else:
-					xml_version, xml_encoding, xml_standalone = \
-						xml_info["XML_DECLARATION"]
-					if xml_encoding is None or \
-						xml_encoding.upper() != metadata_xml_encoding:
-						if xml_encoding is None:
-							encoding_problem = "but it is undefined"
-						else:
-							encoding_problem = "not '%s'" % xml_encoding
-						self.qatracker.add_error(
-							"metadata.bad", "%s/metadata.xml: "
-							"xml declaration encoding should be '%s', %s" %
-							(xpkg, metadata_xml_encoding, encoding_problem))
+						"xml declaration encoding should be '%s', %s" %
+						(xpkg, metadata_xml_encoding, encoding_problem))
 
-				if "DOCTYPE" not in xml_info:
-					metadata_bad = True
-					self.qatracker.add_error(
-						"metadata.bad",
-						"%s/metadata.xml: %s" % (xpkg, "DOCTYPE is missing"))
-				else:
-					doctype_name, doctype_system, doctype_pubid = \
-						xml_info["DOCTYPE"]
-					if doctype_system != metadata_dtd_uri:
-						if doctype_system is None:
-							system_problem = "but it is undefined"
-						else:
-							system_problem = "not '%s'" % doctype_system
-						self.qatracker.add_error(
-							"metadata.bad", "%s/metadata.xml: "
-							"DOCTYPE: SYSTEM should refer to '%s', %s" %
-							(xpkg, metadata_dtd_uri, system_problem))
-
-					if doctype_name != metadata_doctype_name:
-						self.qatracker.add_error(
-							"metadata.bad", "%s/metadata.xml: "
-							"DOCTYPE: name should be '%s', not '%s'" %
-							(xpkg, metadata_doctype_name, doctype_name))
-
-			# load USE flags from metadata.xml
-			try:
-				self.musedict = parse_metadata_use(_metadata_xml)
-			except portage.exception.ParseError as e:
+			if "DOCTYPE" not in xml_info:
 				metadata_bad = True
 				self.qatracker.add_error(
-					"metadata.bad", "%s/metadata.xml: %s" % (xpkg, e))
+					"metadata.bad",
+					"%s/metadata.xml: %s" % (xpkg, "DOCTYPE is missing"))
 			else:
-				for atom in chain(*self.musedict.values()):
-					if atom is None:
-						continue
-					try:
-						atom = Atom(atom)
-					except InvalidAtom as e:
+				doctype_name, doctype_system, doctype_pubid = \
+					xml_info["DOCTYPE"]
+				if doctype_system != metadata_dtd_uri:
+					if doctype_system is None:
+						system_problem = "but it is undefined"
+					else:
+						system_problem = "not '%s'" % doctype_system
+					self.qatracker.add_error(
+						"metadata.bad", "%s/metadata.xml: "
+						"DOCTYPE: SYSTEM should refer to '%s', %s" %
+						(xpkg, metadata_dtd_uri, system_problem))
+
+				if doctype_name != metadata_doctype_name:
+					self.qatracker.add_error(
+						"metadata.bad", "%s/metadata.xml: "
+						"DOCTYPE: name should be '%s', not '%s'" %
+						(xpkg, metadata_doctype_name, doctype_name))
+
+		# load USE flags from metadata.xml
+		try:
+			self.musedict = parse_metadata_use(_metadata_xml)
+		except portage.exception.ParseError as e:
+			metadata_bad = True
+			self.qatracker.add_error(
+				"metadata.bad", "%s/metadata.xml: %s" % (xpkg, e))
+		else:
+			for atom in chain(*self.musedict.values()):
+				if atom is None:
+					continue
+				try:
+					atom = Atom(atom)
+				except InvalidAtom as e:
+					self.qatracker.add_error(
+						"metadata.bad",
+						"%s/metadata.xml: Invalid atom: %s" % (xpkg, e))
+				else:
+					if atom.cp != xpkg:
 						self.qatracker.add_error(
 							"metadata.bad",
-							"%s/metadata.xml: Invalid atom: %s" % (xpkg, e))
-					else:
-						if atom.cp != xpkg:
-							self.qatracker.add_error(
-								"metadata.bad",
-								"%s/metadata.xml: Atom contains "
-								"unexpected cat/pn: %s" % (xpkg, atom))
-
-			# Run other metadata.xml checkers
-			try:
-				check_metadata(_metadata_xml, get_herd_base(
-					self.repoman_settings))
-			except (UnknownHerdsError, ) as e:
-				metadata_bad = True
-				self.qatracker.add_error(
-					"metadata.bad", "%s/metadata.xml: %s" % (xpkg, e))
-				del e
+							"%s/metadata.xml: Atom contains "
+							"unexpected cat/pn: %s" % (xpkg, atom))
+
+		# Run other metadata.xml checkers
+		try:
+			check_metadata(_metadata_xml, get_herd_base(
+				self.repoman_settings))
+		except (UnknownHerdsError, ) as e:
+			metadata_bad = True
+			self.qatracker.add_error(
+				"metadata.bad", "%s/metadata.xml: %s" % (xpkg, e))
+			del e
 
 		# Only carry out if in package directory or check forced
 		if not metadata_bad:


             reply	other threads:[~2016-05-14 18:34 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-14 18:33 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2016-05-14 18:33 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/scan/metadata/ Brian Dolbec
2016-05-14 18:33 Brian Dolbec
2016-05-14 18:33 Brian Dolbec
2016-05-14 18:33 Brian Dolbec
2016-05-14 18:33 Brian Dolbec
2016-05-14 18:33 Brian Dolbec
2016-05-14 18:33 Brian Dolbec
2016-05-14 18:33 Brian Dolbec
2016-05-14 18:33 Brian Dolbec
2016-05-08 21:21 Brian Dolbec
2016-05-08 21:21 Brian Dolbec
2016-05-08 21:21 Brian Dolbec
2016-05-08 21:21 Brian Dolbec
2016-05-08 21:21 Brian Dolbec
2016-05-08 21:21 Brian Dolbec
2016-05-08 21:21 Brian Dolbec
2016-05-08 21:21 Brian Dolbec
2016-05-08 21:21 Brian Dolbec
2016-05-05 16:06 Brian Dolbec
2016-05-05 16:02 Brian Dolbec
2016-05-04  6:24 Brian Dolbec
2016-05-04  6:09 Brian Dolbec
2016-05-04  3:45 Brian Dolbec
2016-05-03 20:58 Brian Dolbec
2016-05-03 20:58 Brian Dolbec
2016-05-03 17:43 Brian Dolbec
2016-05-03 17:43 Brian Dolbec
2016-05-03  9:33 Brian Dolbec
2016-05-03  9:33 Brian Dolbec
2016-05-03  9:33 Brian Dolbec
2016-05-03  9:33 Brian Dolbec
2016-05-03  9:33 Brian Dolbec
2016-04-25 15:32 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-03-15 19:00 Brian Dolbec
2016-01-06  4:21 Brian Dolbec

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=1463250580.b78d61dd3e4281a43523aea1a24e395a2674c3ab.dolsen@gentoo \
    --to=dolsen@gentoo.org \
    --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