* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-29 5:01 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-29 5:01 UTC (permalink / raw
To: gentoo-commits
commit: e504f1d8a2634aabd852f70c3ecf3a51fe7e6525
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:56:25 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 29 04:52:57 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e504f1d8
repoman: Migrate more metadata checks to ebuild_metadata.py
.../modules/scan/metadata/ebuild_metadata.py | 32 ++++++++++++++++++++--
pym/repoman/scanner.py | 17 ------------
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 2dc1db2..77c947e 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -5,6 +5,8 @@
import re
import sys
+from repoman.qa_data import missingvars
+
if sys.hexversion >= 0x3000000:
basestring = str
@@ -16,7 +18,7 @@ class EbuildMetadata(object):
def __init__(self, **kwargs):
self.qatracker = kwargs.get('qatracker')
- def check(self, **kwargs):
+ def invalidchar(self, **kwargs):
ebuild = kwargs.get('ebuild')
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
@@ -28,9 +30,35 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ return {'continue': False}
+
+ def missing(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ for pos, missing_var in enumerate(missingvars):
+ if not ebuild.metadata.get(missing_var):
+ if kwargs.get('catdir') == "virtual" and \
+ missing_var in ("HOMEPAGE", "LICENSE"):
+ continue
+ if kwargs.get('live_ebuild') and missing_var == "KEYWORDS":
+ continue
+ myqakey = missingvars[pos] + ".missing"
+ self.qatracker.add_error(myqakey, '%s/%s.ebuild'
+ % (kwargs.get('xpkg'), kwargs.get('y_ebuild')))
+ return {'continue': False}
+
+ def old_virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+ return {'continue': False}
+ def virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ if kwargs.get('catdir') == "virtual":
+ for var in ("HOMEPAGE", "LICENSE"):
+ if ebuild.metadata.get(var):
+ myqakey = var + ".virtual"
+ self.qatracker.add_error(myqakey, ebuild.relative_path)
return {'continue': False}
@property
@@ -39,4 +67,4 @@ class EbuildMetadata(object):
@property
def runInEbuilds(self):
- return (True, [self.check])
+ return (True, [self.invalidchar, self.missing, self.old_virtual, self.virtual])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 3ea27b6..335590b 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -327,23 +327,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
-
- for pos, missing_var in enumerate(missingvars):
- if not dynamic_data['ebuild'].metadata.get(missing_var):
- if dynamic_data['catdir'] == "virtual" and \
- missing_var in ("HOMEPAGE", "LICENSE"):
- continue
- if dynamic_data['live_ebuild'] and missing_var == "KEYWORDS":
- continue
- myqakey = missingvars[pos] + ".missing"
- self.qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
-
- if dynamic_data['catdir'] == "virtual":
- for var in ("HOMEPAGE", "LICENSE"):
- if dynamic_data['ebuild'].metadata.get(var):
- myqakey = var + ".virtual"
- self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
-
if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
self.liveeclasscheck.check(
dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-05-14 18:33 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-05-14 18:33 UTC (permalink / raw
To: gentoo-commits
commit: 65fc4d8a8e0e841e7888893b3f020c4caeb84ecc
Author: Dirkjan Ochtman <dirkjan <AT> ochtman <DOT> nl>
AuthorDate: Mon Jan 25 19:40:29 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=65fc4d8a
repoman: Move parse_metadata_use function to the pkgmetadata.py
Add missing basestring compat code
pym/repoman/metadata.py | 50 ---------------------
pym/repoman/modules/scan/metadata/pkgmetadata.py | 56 +++++++++++++++++++++++-
2 files changed, 55 insertions(+), 51 deletions(-)
diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index a980184..7c64c8e 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -17,7 +17,6 @@ except ImportError:
# import our initialized portage instance
from repoman._portage import portage
-from portage import exception
from portage import os
from portage import shutil
from portage.output import green
@@ -34,55 +33,6 @@ metadata_xsd_uri = 'http://www.gentoo.org/xml-schema/metadata.xsd'
metadata_xsd_ctime_interval = 60 * 60 * 24 * 7 # 7 days
-def parse_metadata_use(xml_tree):
- """
- Records are wrapped in XML as per GLEP 56
- returns a dict with keys constisting of USE flag names and values
- containing their respective descriptions
- """
- uselist = {}
-
- usetags = xml_tree.findall("use")
- if not usetags:
- return uselist
-
- # It's possible to have multiple 'use' elements.
- for usetag in usetags:
- flags = usetag.findall("flag")
- if not flags:
- # DTD allows use elements containing no flag elements.
- continue
-
- for flag in flags:
- pkg_flag = flag.get("name")
- if pkg_flag is None:
- raise exception.ParseError("missing 'name' attribute for 'flag' tag")
- flag_restrict = flag.get("restrict")
-
- # emulate the Element.itertext() method from python-2.7
- inner_text = []
- stack = []
- stack.append(flag)
- while stack:
- obj = stack.pop()
- if isinstance(obj, basestring):
- inner_text.append(obj)
- continue
- if isinstance(obj.text, basestring):
- inner_text.append(obj.text)
- if isinstance(obj.tail, basestring):
- stack.append(obj.tail)
- stack.extend(reversed(obj))
-
- if pkg_flag not in uselist:
- uselist[pkg_flag] = {}
-
- # (flag_restrict can be None)
- uselist[pkg_flag][flag_restrict] = " ".join("".join(inner_text).split())
-
- return uselist
-
-
def fetch_metadata_xsd(metadata_xsd, repoman_settings):
"""
Fetch metadata.xsd if it doesn't exist or the ctime is older than
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index a7150a9..af53f4b 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -23,7 +23,7 @@ except (ImportError, SystemError, RuntimeError, Exception):
# import our initialized portage instance
from repoman._portage import portage
-from repoman.metadata import metadata_dtd_uri, parse_metadata_use
+from repoman.metadata import metadata_dtd_uri
from repoman.checks.herds.herdbase import get_herd_base
from repoman.checks.herds.metadata import check_metadata, UnknownHerdsError
from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint
@@ -32,16 +32,70 @@ from repoman.modules.scan.scanbase import ScanBase
from portage.exception import InvalidAtom
from portage import os
from portage import _encodings, _unicode_encode
+from portage import exception
from portage.dep import Atom
from .use_flags import USEFlagChecks
+if sys.hexversion >= 0x3000000:
+ # pylint: disable=W0622
+ basestring = str
+
metadata_xml_encoding = 'UTF-8'
metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \
% (metadata_xml_encoding,)
metadata_doctype_name = 'pkgmetadata'
+def parse_metadata_use(xml_tree):
+ """
+ Records are wrapped in XML as per GLEP 56
+ returns a dict with keys constisting of USE flag names and values
+ containing their respective descriptions
+ """
+ uselist = {}
+
+ usetags = xml_tree.findall("use")
+ if not usetags:
+ return uselist
+
+ # It's possible to have multiple 'use' elements.
+ for usetag in usetags:
+ flags = usetag.findall("flag")
+ if not flags:
+ # DTD allows use elements containing no flag elements.
+ continue
+
+ for flag in flags:
+ pkg_flag = flag.get("name")
+ if pkg_flag is None:
+ raise exception.ParseError("missing 'name' attribute for 'flag' tag")
+ flag_restrict = flag.get("restrict")
+
+ # emulate the Element.itertext() method from python-2.7
+ inner_text = []
+ stack = []
+ stack.append(flag)
+ while stack:
+ obj = stack.pop()
+ if isinstance(obj, basestring):
+ inner_text.append(obj)
+ continue
+ if isinstance(obj.text, basestring):
+ inner_text.append(obj.text)
+ if isinstance(obj.tail, basestring):
+ stack.append(obj.tail)
+ stack.extend(reversed(obj))
+
+ if pkg_flag not in uselist:
+ uselist[pkg_flag] = {}
+
+ # (flag_restrict can be None)
+ uselist[pkg_flag][flag_restrict] = " ".join("".join(inner_text).split())
+
+ return uselist
+
+
class PkgMetadata(ScanBase, USEFlagChecks):
'''Package metadata.xml checks'''
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-05-08 21:21 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-05-08 21:21 UTC (permalink / raw
To: gentoo-commits
commit: 6121c08bda7fe4bb96befcfb8fe3ad4263f0b770
Author: Dirkjan Ochtman <dirkjan <AT> ochtman <DOT> nl>
AuthorDate: Mon Jan 25 18:42:41 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun May 8 21:18:40 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=6121c08b
repoman: Move some metdata_* variables to module it's used
pym/repoman/metadata.py | 4 ----
pym/repoman/modules/scan/metadata/pkgmetadata.py | 9 ++++++---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index 7a514dc..a980184 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -28,10 +28,6 @@ if sys.hexversion >= 0x3000000:
if sys.hexversion >= 0x3000000:
basestring = str
-metadata_xml_encoding = 'UTF-8'
-metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \
- % (metadata_xml_encoding,)
-metadata_doctype_name = 'pkgmetadata'
metadata_dtd_uri = 'http://www.gentoo.org/dtd/metadata.dtd'
metadata_xsd_uri = 'http://www.gentoo.org/xml-schema/metadata.xsd'
# force refetch if the local copy creation time is older than this
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 3b48b8e..a7150a9 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -23,9 +23,7 @@ except (ImportError, SystemError, RuntimeError, Exception):
# import our initialized portage instance
from repoman._portage import portage
-from repoman.metadata import (
- metadata_xml_encoding, metadata_doctype_name,
- metadata_dtd_uri, metadata_xml_declaration, parse_metadata_use)
+from repoman.metadata import metadata_dtd_uri, parse_metadata_use
from repoman.checks.herds.herdbase import get_herd_base
from repoman.checks.herds.metadata import check_metadata, UnknownHerdsError
from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint
@@ -38,6 +36,11 @@ from portage.dep import Atom
from .use_flags import USEFlagChecks
+metadata_xml_encoding = 'UTF-8'
+metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \
+ % (metadata_xml_encoding,)
+metadata_doctype_name = 'pkgmetadata'
+
class PkgMetadata(ScanBase, USEFlagChecks):
'''Package metadata.xml checks'''
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-05-03 9:33 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-05-03 9:33 UTC (permalink / raw
To: gentoo-commits
commit: 52bce5a348c68a5af0def40f399943d3b1d4f509
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue May 3 09:01:29 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue May 3 09:13:56 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=52bce5a3
repoman: Migrate from XmlLint to etree.XMLSchema for validation
This change based on work by Dirkjan Ochtman <djc <AT> gentoo.org>
Updated the change from XML.DTD to XMLSchema.
Additionally:
Move the metadata.xsd path determination code to metadata.py.
Add the DISTDIR backup location and fetching of the file if missing or stale.
pym/repoman/metadata.py | 21 +++++++++++++++++++++
pym/repoman/modules/scan/metadata/pkgmetadata.py | 9 +++------
pym/repoman/scanner.py | 10 ++--------
3 files changed, 26 insertions(+), 14 deletions(-)
diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index 7c64c8e..a9ad3e8 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -99,3 +99,24 @@ def fetch_metadata_xsd(metadata_xsd, repoman_settings):
pass
return True
+
+
+def get_metadata_xsd(repo_settings):
+ '''Locate and or fetch the metadata.xsd file
+
+ @param repo_settings: RepoSettings instance
+ @returns: path to the metadata.xsd file
+ '''
+ metadata_xsd = None
+ for path in reversed(repo_settings.repo_config.eclass_db.porttrees):
+ path = os.path.join(path, 'metadata/xml-schema/metadata.xsd')
+ if os.path.exists(path):
+ metadata_xsd = path
+ break
+ if metadata_xsd is None:
+ metadata_xsd = os.path.join(
+ repo_settings.repoman_settings["DISTDIR"], 'metadata.xsd'
+ )
+
+ fetch_metadata_xsd(metadata_xsd, repo_settings.repoman_settings)
+ return metadata_xsd
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index c744c13..b231370 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -24,7 +24,6 @@ except (ImportError, SystemError, RuntimeError, Exception):
# import our initialized portage instance
from repoman._portage import portage
from repoman.metadata import metadata_dtd_uri
-from repoman._xml import XmlLint
from repoman.modules.scan.scanbase import ScanBase
from portage.exception import InvalidAtom
@@ -104,13 +103,11 @@ class PkgMetadata(ScanBase, USEFlagChecks):
repo_settings = kwargs.get('repo_settings')
self.qatracker = kwargs.get('qatracker')
self.options = kwargs.get('options')
- metadata_xsd = kwargs.get('metadata_xsd')
+ self.metadata_xsd = kwargs.get('metadata_xsd')
self.globalUseFlags = kwargs.get('uselist')
self.repoman_settings = repo_settings.repoman_settings
self.musedict = {}
self.muselist = set()
- self.xmllint = XmlLint(self.options, self.repoman_settings,
- metadata_xsd=metadata_xsd)
def check(self, **kwargs):
'''Performs the checks on the metadata.xml for the package
@@ -123,7 +120,6 @@ class PkgMetadata(ScanBase, USEFlagChecks):
xpkg = kwargs.get('xpkg')
checkdir = kwargs.get('checkdir')
checkdirlist = kwargs.get('checkdirlist').get()
- repolevel = kwargs.get('repolevel')
self.musedict = {}
if self.options.mode in ['manifest']:
@@ -205,7 +201,8 @@ class PkgMetadata(ScanBase, USEFlagChecks):
# Only carry out if in package directory or check forced
if not metadata_bad:
- if not self.xmllint.check(checkdir, repolevel):
+ validator = etree.XMLSchema(file=self.metadata_xsd)
+ if not validator.validate(_metadata_xml):
self.qatracker.add_error("metadata.bad", xpkg + "/metadata.xml")
del metadata_bad
self.muselist = frozenset(self.musedict)
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index fd07209..48d9001 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -10,6 +10,7 @@ from portage import normalize_path
from portage import os
from portage.output import green
from portage.util.futures.extendedfutures import ExtendedFuture
+from repoman.metadata import get_metadata_xsd
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_profile_keywords, setup_profile
from repoman.repos import repo_metadata
@@ -56,13 +57,6 @@ class Scanner(object):
portage.util.stack_lists([self.categories], incremental=1))
self.categories = self.repo_settings.repoman_settings.categories
- metadata_xsd = None
- for path in reversed(self.repo_settings.repo_config.eclass_db.porttrees):
- path = os.path.join(path, 'metadata/xml-schema/metadata.xsd')
- if os.path.exists(path):
- metadata_xsd = path
- break
-
self.portdb = repo_settings.portdb
self.portdb.settings = self.repo_settings.repoman_settings
# We really only need to cache the metadata that's necessary for visibility
@@ -187,7 +181,7 @@ class Scanner(object):
"qatracker": self.qatracker,
"vcs_settings": self.vcs_settings,
"options": self.options,
- "metadata_xsd": metadata_xsd,
+ "metadata_xsd": get_metadata_xsd(self.repo_settings),
"uselist": uselist,
"checks": checks,
"repo_metadata": self.repo_metadata,
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-05-03 9:33 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-05-03 9:33 UTC (permalink / raw
To: gentoo-commits
commit: 2ec2486fd56b4e673dbf544c5667dd7cf9d683bf
Author: Dirkjan Ochtman <dirkjan <AT> ochtman <DOT> nl>
AuthorDate: Mon Jan 25 18:42:41 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Tue May 3 06:38:34 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2ec2486f
repoman: Move some metdata_* variables to module it's used
pym/repoman/metadata.py | 4 ----
pym/repoman/modules/scan/metadata/pkgmetadata.py | 9 ++++++---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index 7a514dc..a980184 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -28,10 +28,6 @@ if sys.hexversion >= 0x3000000:
if sys.hexversion >= 0x3000000:
basestring = str
-metadata_xml_encoding = 'UTF-8'
-metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \
- % (metadata_xml_encoding,)
-metadata_doctype_name = 'pkgmetadata'
metadata_dtd_uri = 'http://www.gentoo.org/dtd/metadata.dtd'
metadata_xsd_uri = 'http://www.gentoo.org/xml-schema/metadata.xsd'
# force refetch if the local copy creation time is older than this
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 3b48b8e..a7150a9 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -23,9 +23,7 @@ except (ImportError, SystemError, RuntimeError, Exception):
# import our initialized portage instance
from repoman._portage import portage
-from repoman.metadata import (
- metadata_xml_encoding, metadata_doctype_name,
- metadata_dtd_uri, metadata_xml_declaration, parse_metadata_use)
+from repoman.metadata import metadata_dtd_uri, parse_metadata_use
from repoman.checks.herds.herdbase import get_herd_base
from repoman.checks.herds.metadata import check_metadata, UnknownHerdsError
from repoman._xml import _XMLParser, _MetadataTreeBuilder, XmlLint
@@ -38,6 +36,11 @@ from portage.dep import Atom
from .use_flags import USEFlagChecks
+metadata_xml_encoding = 'UTF-8'
+metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \
+ % (metadata_xml_encoding,)
+metadata_doctype_name = 'pkgmetadata'
+
class PkgMetadata(ScanBase, USEFlagChecks):
'''Package metadata.xml checks'''
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-04-25 15:32 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-04-25 15:32 UTC (permalink / raw
To: gentoo-commits
commit: 13197c7ce03e7fa88899589bfcfe6f3ebaac9112
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 17 08:06:28 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Apr 25 15:28:53 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=13197c7c
repoman: Use XML Schema for metadata.xml validation
pym/repoman/_xml.py | 16 +++++-----
pym/repoman/metadata.py | 39 ++++++++++++------------
pym/repoman/modules/scan/metadata/__init__.py | 2 +-
pym/repoman/modules/scan/metadata/pkgmetadata.py | 6 ++--
pym/repoman/scanner.py | 8 ++---
5 files changed, 36 insertions(+), 35 deletions(-)
diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index d55dda5..33a536a 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -12,7 +12,7 @@ from portage import os
from portage.output import red
from portage.process import find_binary
-from repoman.metadata import fetch_metadata_dtd
+from repoman.metadata import fetch_metadata_xsd
from repoman._subprocess import repoman_getstatusoutput
@@ -53,12 +53,12 @@ class _MetadataTreeBuilder(xml.etree.ElementTree.TreeBuilder):
class XmlLint(object):
- def __init__(self, options, repoman_settings, metadata_dtd=None):
- self.metadata_dtd = (metadata_dtd or
- os.path.join(repoman_settings["DISTDIR"], 'metadata.dtd'))
+ def __init__(self, options, repoman_settings, metadata_xsd=None):
+ self.metadata_xsd = (metadata_xsd or
+ os.path.join(repoman_settings["DISTDIR"], 'metadata.xsd'))
self.options = options
self.repoman_settings = repoman_settings
- self._is_capable = metadata_dtd is not None
+ self._is_capable = metadata_xsd is not None
self.binary = None
self._check_capable()
@@ -69,7 +69,7 @@ class XmlLint(object):
if not self.binary:
print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
elif not self._is_capable:
- if not fetch_metadata_dtd(self.metadata_dtd, self.repoman_settings):
+ if not fetch_metadata_xsd(self.metadata_xsd, self.repoman_settings):
sys.exit(1)
# this can be problematic if xmllint changes their output
self._is_capable = True
@@ -93,8 +93,8 @@ class XmlLint(object):
# xmlint can produce garbage output even on success, so only dump
# the ouput when it fails.
st, out = repoman_getstatusoutput(
- self.binary + " --nonet --noout --dtdvalid %s %s" % (
- portage._shell_quote(self.metadata_dtd),
+ self.binary + " --nonet --noout --schema %s %s" % (
+ portage._shell_quote(self.metadata_xsd),
portage._shell_quote(
os.path.join(checkdir, "metadata.xml"))))
if st != os.EX_OK:
diff --git a/pym/repoman/metadata.py b/pym/repoman/metadata.py
index e95ad41..7a514dc 100644
--- a/pym/repoman/metadata.py
+++ b/pym/repoman/metadata.py
@@ -33,8 +33,9 @@ metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \
% (metadata_xml_encoding,)
metadata_doctype_name = 'pkgmetadata'
metadata_dtd_uri = 'http://www.gentoo.org/dtd/metadata.dtd'
+metadata_xsd_uri = 'http://www.gentoo.org/xml-schema/metadata.xsd'
# force refetch if the local copy creation time is older than this
-metadata_dtd_ctime_interval = 60 * 60 * 24 * 7 # 7 days
+metadata_xsd_ctime_interval = 60 * 60 * 24 * 7 # 7 days
def parse_metadata_use(xml_tree):
@@ -86,36 +87,36 @@ def parse_metadata_use(xml_tree):
return uselist
-def fetch_metadata_dtd(metadata_dtd, repoman_settings):
+def fetch_metadata_xsd(metadata_xsd, repoman_settings):
"""
- Fetch metadata.dtd if it doesn't exist or the ctime is older than
- metadata_dtd_ctime_interval.
+ Fetch metadata.xsd if it doesn't exist or the ctime is older than
+ metadata_xsd_ctime_interval.
@rtype: bool
@return: True if successful, otherwise False
"""
must_fetch = True
- metadata_dtd_st = None
+ metadata_xsd_st = None
current_time = int(time.time())
try:
- metadata_dtd_st = os.stat(metadata_dtd)
+ metadata_xsd_st = os.stat(metadata_xsd)
except EnvironmentError as e:
if e.errno not in (errno.ENOENT, errno.ESTALE):
raise
del e
else:
- # Trigger fetch if metadata.dtd mtime is old or clock is wrong.
- if abs(current_time - metadata_dtd_st.st_ctime) \
- < metadata_dtd_ctime_interval:
+ # Trigger fetch if metadata.xsd mtime is old or clock is wrong.
+ if abs(current_time - metadata_xsd_st.st_ctime) \
+ < metadata_xsd_ctime_interval:
must_fetch = False
if must_fetch:
print()
print(
- "%s the local copy of metadata.dtd "
+ "%s the local copy of metadata.xsd "
"needs to be refetched, doing that now" % green("***"))
print()
- parsed_url = urlparse(metadata_dtd_uri)
+ parsed_url = urlparse(metadata_xsd_uri)
setting = 'FETCHCOMMAND_' + parsed_url.scheme.upper()
fcmd = repoman_settings.get(setting)
if not fcmd:
@@ -125,29 +126,29 @@ def fetch_metadata_dtd(metadata_dtd, repoman_settings):
return False
destdir = repoman_settings["DISTDIR"]
- fd, metadata_dtd_tmp = tempfile.mkstemp(
- prefix='metadata.dtd.', dir=destdir)
+ fd, metadata_xsd_tmp = tempfile.mkstemp(
+ prefix='metadata.xsd.', dir=destdir)
os.close(fd)
try:
if not portage.getbinpkg.file_get(
- metadata_dtd_uri, destdir, fcmd=fcmd,
- filename=os.path.basename(metadata_dtd_tmp)):
+ metadata_xsd_uri, destdir, fcmd=fcmd,
+ filename=os.path.basename(metadata_xsd_tmp)):
logging.error(
- "failed to fetch metadata.dtd from '%s'" % metadata_dtd_uri)
+ "failed to fetch metadata.xsd from '%s'" % metadata_xsd_uri)
return False
try:
portage.util.apply_secpass_permissions(
- metadata_dtd_tmp,
+ metadata_xsd_tmp,
gid=portage.data.portage_gid, mode=0o664, mask=0o2)
except portage.exception.PortageException:
pass
- shutil.move(metadata_dtd_tmp, metadata_dtd)
+ shutil.move(metadata_xsd_tmp, metadata_xsd)
finally:
try:
- os.unlink(metadata_dtd_tmp)
+ os.unlink(metadata_xsd_tmp)
except OSError:
pass
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index 98df9cf..1a6c0ed 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -18,7 +18,7 @@ module_spec = {
'functions': ['check'],
'func_desc': {
},
- 'mod_kwargs': ['repo_settings', 'qatracker', 'options', 'metadata_dtd',
+ 'mod_kwargs': ['repo_settings', 'qatracker', 'options', 'metadata_xsd',
],
'func_kwargs': {
'checkdir': (None, None),
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 9216d77..25907b3 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -46,17 +46,17 @@ class PkgMetadata(ScanBase):
@param repo_settings: settings instance
@param qatracker: QATracker instance
@param options: argparse options instance
- @param metadata_dtd: path of metadata.dtd
+ @param metadata_xsd: path of metadata.xsd
'''
super(PkgMetadata, self).__init__(**kwargs)
repo_settings = kwargs.get('repo_settings')
self.qatracker = kwargs.get('qatracker')
self.options = kwargs.get('options')
- metadata_dtd = kwargs.get('metadata_dtd')
+ metadata_xsd = kwargs.get('metadata_xsd')
self.repoman_settings = repo_settings.repoman_settings
self.musedict = {}
self.xmllint = XmlLint(self.options, self.repoman_settings,
- metadata_dtd=metadata_dtd)
+ metadata_xsd=metadata_xsd)
def check(self, **kwargs):
'''Performs the checks on the metadata.xml for the package
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 74bb7e3..508fedb 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -56,11 +56,11 @@ class Scanner(object):
portage.util.stack_lists([self.categories], incremental=1))
self.categories = self.repo_settings.repoman_settings.categories
- metadata_dtd = None
+ metadata_xsd = None
for path in reversed(self.repo_settings.repo_config.eclass_db.porttrees):
- path = os.path.join(path, 'metadata/dtd/metadata.dtd')
+ path = os.path.join(path, 'metadata/xml-schema/metadata.xsd')
if os.path.exists(path):
- metadata_dtd = path
+ metadata_xsd = path
break
self.portdb = repo_settings.portdb
@@ -189,7 +189,7 @@ class Scanner(object):
"qatracker": self.qatracker,
"vcs_settings": self.vcs_settings,
"options": self.options,
- "metadata_dtd": metadata_dtd,
+ "metadata_xsd": metadata_xsd,
"uselist": uselist,
"checks": self.checks,
"repo_metadata": self.repo_metadata,
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-03-12 18:10 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-03-12 18:10 UTC (permalink / raw
To: gentoo-commits
commit: 37cf2581b3261f4a5d0520e20255f343b63ca958
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:37:22 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Mar 12 17:57:38 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=37cf2581
repoman: Create a metadata UnusedCheck and final pkg checks
Create a plugin loop for any final pkg checks.
Create the one plugin for the unused use-descriptions in mteadata.xml.
pym/repoman/modules/scan/metadata/__init__.py | 9 +++++++
pym/repoman/modules/scan/metadata/unused.py | 32 ++++++++++++++++++++++++
pym/repoman/scanner.py | 36 ++++++++++++++++++++-------
3 files changed, 68 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index 4f376e1..f619764 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -55,6 +55,15 @@ module_spec = {
'func_desc': {
},
},
+ 'unused-metadata': {
+ 'name': "unused",
+ 'sourcefile': "unused",
+ 'class': "UnusedCheck",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/metadata/unused.py b/pym/repoman/modules/scan/metadata/unused.py
new file mode 100644
index 0000000..5eb6716
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -0,0 +1,32 @@
+
+
+class UnusedCheck(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ xpkg = kwargs.get('xpkg')
+ muselist = kwargs.get('muselist')
+ used_useflags = kwargs.get('used_useflags')
+ # check if there are unused local USE-descriptions in metadata.xml
+ # (unless there are any invalids, to avoid noise)
+ if kwargs.get('allvalid'):
+ for myflag in muselist.difference(used_useflags):
+ self.qatracker.add_error(
+ "metadata.warning",
+ "%s/metadata.xml: unused local USE-description: '%s'"
+ % (xpkg, myflag))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (False, [])
+
+ @property
+ def runInFinal(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 4f4f78b..2f717e2 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -270,7 +270,6 @@ class Scanner(object):
def _scan_ebuilds(self, ebuildlist, dynamic_data):
- xpkg = dynamic_data['xpkg']
# detect unused local USE-descriptions
dynamic_data['used_useflags'] = set()
@@ -318,11 +317,30 @@ class Scanner(object):
if y_ebuild_continue:
continue
- # check if there are unused local USE-descriptions in metadata.xml
- # (unless there are any invalids, to avoid noise)
- if dynamic_data['allvalid']:
- for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
- self.qatracker.add_error(
- "metadata.warning",
- "%s/metadata.xml: unused local USE-description: '%s'"
- % (xpkg, myflag))
+ # Final checks
+ # initialize per pkg plugin final checks here
+ # need to set it up for ==> self.modules_list or some other ordered list
+ xpkg_complete = False
+ for mod in [('unused', 'UnusedChecks')]:
+ if mod[0]:
+ mod_class = MODULE_CONTROLLER.get_class(mod[0])
+ print("Initializing class name:", mod_class.__name__)
+ self.modules[mod[1]] = mod_class(**self.kwargs)
+ print("scan_ebuilds final checks: module:", mod[1])
+ do_it, functions = self.modules[mod[1]].runInFinal
+ # print("do_it", do_it, "functions", functions)
+ if do_it:
+ for func in functions:
+ print("\tRunning function:", func)
+ rdata = func(**dynamic_data)
+ if rdata.get('continue', False):
+ xpkg_complete = True
+ print("\t>>> Continuing")
+ break
+ #print("rdata:", rdata)
+ dynamic_data.update(rdata)
+ #print("dynamic_data", dynamic_data)
+
+ if xpkg_complete:
+ return
+ return
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-03-12 18:10 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-03-12 18:10 UTC (permalink / raw
To: gentoo-commits
commit: 7cedfcc4825b291d38360ec8b90f3724161a5df6
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:29:07 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Mar 12 17:57:39 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=7cedfcc4
repoman: Fix a traceback due to xmlint not being installed for a manifest generation
Mike helped find teh fact that self.binary was None, causing the misleading traceback.
Tighten up the logic in XmlLint.
Bypass the PkgMetadata check for manifest mode.
floppym@naomi btrfs-progs % repoman manifest
>>> Creating Manifest for /home/floppym/repos/gentoo/sys-fs/btrfs-progs
Traceback (most recent call last):
File "/home/floppym/bin/repoman", line 37, in <module>
repoman_main(sys.argv[1:])
File "/home/floppym/src/portage/pym/repoman/main.py", line 111, in repoman_main
can_force = scanner.scan_pkgs(can_force)
File "/home/floppym/src/portage/pym/repoman/scanner.py", line 242, in scan_pkgs
rdata = func(**dynamic_data)
File "/home/floppym/src/portage/pym/repoman/modules/scan/metadata/pkgmetadata.py", line 180, in check
if not self.xmllint.check(checkdir, repolevel):
File "/home/floppym/src/portage/pym/repoman/_xml.py", line 98, in check
os.path.join(checkdir, "metadata.xml"))))
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
pym/repoman/_xml.py | 2 +-
pym/repoman/modules/scan/metadata/pkgmetadata.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index 2661f14..f7ff9fb 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -60,6 +60,7 @@ class XmlLint(object):
self.repoman_settings = repoman_settings
self._is_capable = metadata_dtd is not None
self.binary = None
+ self._is_capable = False
self._check_capable()
def _check_capable(self):
@@ -68,7 +69,6 @@ class XmlLint(object):
self.binary = find_binary('xmllint')
if not self.binary:
print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
- self._is_capable = False
elif not self._is_capable:
if not fetch_metadata_dtd(self.metadata_dtd, self.repoman_settings):
sys.exit(1)
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 220fd23..8e93457 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -71,6 +71,9 @@ class PkgMetadata(ScanBase):
repolevel = kwargs.get('repolevel')
self.musedict = {}
+ if self.options.mode in ['manifest']:
+ return {'continue': False, 'muselist': frozenset(self.musedict)}
+
# metadata.xml file check
if "metadata.xml" not in checkdirlist:
self.qatracker.add_error("metadata.missing", xpkg + "/metadata.xml")
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-03-11 0:41 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-03-11 0:41 UTC (permalink / raw
To: gentoo-commits
commit: 0885dd49d846ef5d896df623a3a7c3d48db06168
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:29:07 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Mar 10 23:47:35 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0885dd49
repoman: Fix a traceback due to xmlint not being installed for a manifest generation
Mike helped find teh fact that self.binary was None, causing the misleading traceback.
Tighten up the logic in XmlLint.
Bypass the PkgMetadata check for manifest mode.
floppym@naomi btrfs-progs % repoman manifest
>>> Creating Manifest for /home/floppym/repos/gentoo/sys-fs/btrfs-progs
Traceback (most recent call last):
File "/home/floppym/bin/repoman", line 37, in <module>
repoman_main(sys.argv[1:])
File "/home/floppym/src/portage/pym/repoman/main.py", line 111, in repoman_main
can_force = scanner.scan_pkgs(can_force)
File "/home/floppym/src/portage/pym/repoman/scanner.py", line 242, in scan_pkgs
rdata = func(**dynamic_data)
File "/home/floppym/src/portage/pym/repoman/modules/scan/metadata/pkgmetadata.py", line 180, in check
if not self.xmllint.check(checkdir, repolevel):
File "/home/floppym/src/portage/pym/repoman/_xml.py", line 98, in check
os.path.join(checkdir, "metadata.xml"))))
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
pym/repoman/_xml.py | 2 +-
pym/repoman/modules/scan/metadata/pkgmetadata.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index 2661f14..f7ff9fb 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -60,6 +60,7 @@ class XmlLint(object):
self.repoman_settings = repoman_settings
self._is_capable = metadata_dtd is not None
self.binary = None
+ self._is_capable = False
self._check_capable()
def _check_capable(self):
@@ -68,7 +69,6 @@ class XmlLint(object):
self.binary = find_binary('xmllint')
if not self.binary:
print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
- self._is_capable = False
elif not self._is_capable:
if not fetch_metadata_dtd(self.metadata_dtd, self.repoman_settings):
sys.exit(1)
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 220fd23..8e93457 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -71,6 +71,9 @@ class PkgMetadata(ScanBase):
repolevel = kwargs.get('repolevel')
self.musedict = {}
+ if self.options.mode in ['manifest']:
+ return {'continue': False, 'muselist': frozenset(self.musedict)}
+
# metadata.xml file check
if "metadata.xml" not in checkdirlist:
self.qatracker.add_error("metadata.missing", xpkg + "/metadata.xml")
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-03-07 21:53 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-03-07 21:53 UTC (permalink / raw
To: gentoo-commits
commit: 22937d639ec51f67a0d6ab8caa054d716cf43992
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:29:07 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Mar 7 21:21:34 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=22937d63
repoman: Fix a traceback due to xmlint not being installed for a manifest generation
Mike helped find teh fact that self.binary was None, causing the misleading traceback.
Tighten up the logic in XmlLint.
Bypass the PkgMetadata check for manifest mode.
floppym@naomi btrfs-progs % repoman manifest
>>> Creating Manifest for /home/floppym/repos/gentoo/sys-fs/btrfs-progs
Traceback (most recent call last):
File "/home/floppym/bin/repoman", line 37, in <module>
repoman_main(sys.argv[1:])
File "/home/floppym/src/portage/pym/repoman/main.py", line 111, in repoman_main
can_force = scanner.scan_pkgs(can_force)
File "/home/floppym/src/portage/pym/repoman/scanner.py", line 242, in scan_pkgs
rdata = func(**dynamic_data)
File "/home/floppym/src/portage/pym/repoman/modules/scan/metadata/pkgmetadata.py", line 180, in check
if not self.xmllint.check(checkdir, repolevel):
File "/home/floppym/src/portage/pym/repoman/_xml.py", line 98, in check
os.path.join(checkdir, "metadata.xml"))))
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
pym/repoman/_xml.py | 2 +-
pym/repoman/modules/scan/metadata/pkgmetadata.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index 2661f14..f7ff9fb 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -60,6 +60,7 @@ class XmlLint(object):
self.repoman_settings = repoman_settings
self._is_capable = metadata_dtd is not None
self.binary = None
+ self._is_capable = False
self._check_capable()
def _check_capable(self):
@@ -68,7 +69,6 @@ class XmlLint(object):
self.binary = find_binary('xmllint')
if not self.binary:
print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
- self._is_capable = False
elif not self._is_capable:
if not fetch_metadata_dtd(self.metadata_dtd, self.repoman_settings):
sys.exit(1)
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 220fd23..8e93457 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -71,6 +71,9 @@ class PkgMetadata(ScanBase):
repolevel = kwargs.get('repolevel')
self.musedict = {}
+ if self.options.mode in ['manifest']:
+ return {'continue': False, 'muselist': frozenset(self.musedict)}
+
# metadata.xml file check
if "metadata.xml" not in checkdirlist:
self.qatracker.add_error("metadata.missing", xpkg + "/metadata.xml")
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-31 20:03 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-31 20:03 UTC (permalink / raw
To: gentoo-commits
commit: 9a99663c3ec20d7a6b5379651cde93da32a54904
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:29:07 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 20:25:24 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9a99663c
repoman: Fix a traceback due to xmlint not being installed for a manifest generation
Mike helped find teh fact that self.binary was None, causing the misleading traceback.
Tighten up the logic in XmlLint.
Bypass the PkgMetadata check for manifest mode.
floppym@naomi btrfs-progs % repoman manifest
>>> Creating Manifest for /home/floppym/repos/gentoo/sys-fs/btrfs-progs
Traceback (most recent call last):
File "/home/floppym/bin/repoman", line 37, in <module>
repoman_main(sys.argv[1:])
File "/home/floppym/src/portage/pym/repoman/main.py", line 111, in repoman_main
can_force = scanner.scan_pkgs(can_force)
File "/home/floppym/src/portage/pym/repoman/scanner.py", line 242, in scan_pkgs
rdata = func(**dynamic_data)
File "/home/floppym/src/portage/pym/repoman/modules/scan/metadata/pkgmetadata.py", line 180, in check
if not self.xmllint.check(checkdir, repolevel):
File "/home/floppym/src/portage/pym/repoman/_xml.py", line 98, in check
os.path.join(checkdir, "metadata.xml"))))
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
pym/repoman/_xml.py | 2 +-
pym/repoman/modules/scan/metadata/pkgmetadata.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index 2661f14..f7ff9fb 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -60,6 +60,7 @@ class XmlLint(object):
self.repoman_settings = repoman_settings
self._is_capable = metadata_dtd is not None
self.binary = None
+ self._is_capable = False
self._check_capable()
def _check_capable(self):
@@ -68,7 +69,6 @@ class XmlLint(object):
self.binary = find_binary('xmllint')
if not self.binary:
print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
- self._is_capable = False
elif not self._is_capable:
if not fetch_metadata_dtd(self.metadata_dtd, self.repoman_settings):
sys.exit(1)
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 220fd23..8e93457 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -71,6 +71,9 @@ class PkgMetadata(ScanBase):
repolevel = kwargs.get('repolevel')
self.musedict = {}
+ if self.options.mode in ['manifest']:
+ return {'continue': False, 'muselist': frozenset(self.musedict)}
+
# metadata.xml file check
if "metadata.xml" not in checkdirlist:
self.qatracker.add_error("metadata.missing", xpkg + "/metadata.xml")
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-30 8:00 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-30 8:00 UTC (permalink / raw
To: gentoo-commits
commit: b6818e7a118a8e82a71b394ae2a5ee79576a1e4e
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:29:07 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 07:50:21 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b6818e7a
repoman: Fix a traceback due to xmlint not being installed for a manifest generation
Mike helped find teh fact that self.binary was None, causing the misleading traceback.
Tighten up the logic in XmlLint.
Bypass the PkgMetadata check for manifest mode.
floppym@naomi btrfs-progs % repoman manifest
>>> Creating Manifest for /home/floppym/repos/gentoo/sys-fs/btrfs-progs
Traceback (most recent call last):
File "/home/floppym/bin/repoman", line 37, in <module>
repoman_main(sys.argv[1:])
File "/home/floppym/src/portage/pym/repoman/main.py", line 111, in repoman_main
can_force = scanner.scan_pkgs(can_force)
File "/home/floppym/src/portage/pym/repoman/scanner.py", line 242, in scan_pkgs
rdata = func(**dynamic_data)
File "/home/floppym/src/portage/pym/repoman/modules/scan/metadata/pkgmetadata.py", line 180, in check
if not self.xmllint.check(checkdir, repolevel):
File "/home/floppym/src/portage/pym/repoman/_xml.py", line 98, in check
os.path.join(checkdir, "metadata.xml"))))
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
pym/repoman/_xml.py | 2 +-
pym/repoman/modules/scan/metadata/pkgmetadata.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index 2661f14..f7ff9fb 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -60,6 +60,7 @@ class XmlLint(object):
self.repoman_settings = repoman_settings
self._is_capable = metadata_dtd is not None
self.binary = None
+ self._is_capable = False
self._check_capable()
def _check_capable(self):
@@ -68,7 +69,6 @@ class XmlLint(object):
self.binary = find_binary('xmllint')
if not self.binary:
print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
- self._is_capable = False
elif not self._is_capable:
if not fetch_metadata_dtd(self.metadata_dtd, self.repoman_settings):
sys.exit(1)
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 220fd23..8e93457 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -71,6 +71,9 @@ class PkgMetadata(ScanBase):
repolevel = kwargs.get('repolevel')
self.musedict = {}
+ if self.options.mode in ['manifest']:
+ return {'continue': False, 'muselist': frozenset(self.musedict)}
+
# metadata.xml file check
if "metadata.xml" not in checkdirlist:
self.qatracker.add_error("metadata.missing", xpkg + "/metadata.xml")
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-30 6:58 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-30 6:58 UTC (permalink / raw
To: gentoo-commits
commit: 8af093b7bf74f27b1eb7cc0edd0f9ddaf817e66b
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:29:07 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 06:51:58 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8af093b7
repoman: Fix a traceback due to xmlint not being installed for a manifest generation
Mike helped find teh fact that self.binary was None, causing the misleading traceback.
Tighten up the logic in XmlLint.
Bypass the PkgMetadata check for manifest mode.
floppym@naomi btrfs-progs % repoman manifest
>>> Creating Manifest for /home/floppym/repos/gentoo/sys-fs/btrfs-progs
Traceback (most recent call last):
File "/home/floppym/bin/repoman", line 37, in <module>
repoman_main(sys.argv[1:])
File "/home/floppym/src/portage/pym/repoman/main.py", line 111, in repoman_main
can_force = scanner.scan_pkgs(can_force)
File "/home/floppym/src/portage/pym/repoman/scanner.py", line 242, in scan_pkgs
rdata = func(**dynamic_data)
File "/home/floppym/src/portage/pym/repoman/modules/scan/metadata/pkgmetadata.py", line 180, in check
if not self.xmllint.check(checkdir, repolevel):
File "/home/floppym/src/portage/pym/repoman/_xml.py", line 98, in check
os.path.join(checkdir, "metadata.xml"))))
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
pym/repoman/_xml.py | 2 +-
pym/repoman/modules/scan/metadata/pkgmetadata.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index 2661f14..f7ff9fb 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -60,6 +60,7 @@ class XmlLint(object):
self.repoman_settings = repoman_settings
self._is_capable = metadata_dtd is not None
self.binary = None
+ self._is_capable = False
self._check_capable()
def _check_capable(self):
@@ -68,7 +69,6 @@ class XmlLint(object):
self.binary = find_binary('xmllint')
if not self.binary:
print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
- self._is_capable = False
elif not self._is_capable:
if not fetch_metadata_dtd(self.metadata_dtd, self.repoman_settings):
sys.exit(1)
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 220fd23..8e93457 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -71,6 +71,9 @@ class PkgMetadata(ScanBase):
repolevel = kwargs.get('repolevel')
self.musedict = {}
+ if self.options.mode in ['manifest']:
+ return {'continue': False, 'muselist': frozenset(self.musedict)}
+
# metadata.xml file check
if "metadata.xml" not in checkdirlist:
self.qatracker.add_error("metadata.missing", xpkg + "/metadata.xml")
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-30 6:58 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-30 6:58 UTC (permalink / raw
To: gentoo-commits
commit: 8be9e2ce43f38c43d7ca2b7bd4971dc8f89609b1
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:31:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 30 06:33:55 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8be9e2ce
scanner.py: Migrate another metadata check to ebuild_metadata
pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
pym/repoman/scanner.py | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ if ebuild.metadata.get("PROVIDE"):
+ self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
return {'continue': False}
@property
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 006c3f7..803e5a3 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -327,8 +327,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['ebuild'].metadata.get("PROVIDE"):
- self.qatracker.add_error("virtual.oldstyle", dynamic_data['ebuild'].relative_path)
for pos, missing_var in enumerate(missingvars):
if not dynamic_data['ebuild'].metadata.get(missing_var):
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-29 5:01 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-29 5:01 UTC (permalink / raw
To: gentoo-commits
commit: e61e4a438eca1928fa3d4c765d2e8a1d34e1a4ca
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:37:22 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 29 04:53:00 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=e61e4a43
repoman: Create a metadata UnusedCheck and final pkg checks
Create a plugin loop for any final pkg checks.
Create the one plugin for the unused use-descriptions in mteadata.xml
pym/repoman/modules/scan/metadata/__init__.py | 9 +++++++
pym/repoman/modules/scan/metadata/unused.py | 32 ++++++++++++++++++++++++
pym/repoman/scanner.py | 36 ++++++++++++++++++++-------
3 files changed, 68 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index 4f376e1..f619764 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -55,6 +55,15 @@ module_spec = {
'func_desc': {
},
},
+ 'unused-metadata': {
+ 'name': "unused",
+ 'sourcefile': "unused",
+ 'class': "UnusedCheck",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/metadata/unused.py b/pym/repoman/modules/scan/metadata/unused.py
new file mode 100644
index 0000000..5eb6716
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -0,0 +1,32 @@
+
+
+class UnusedCheck(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ xpkg = kwargs.get('xpkg')
+ muselist = kwargs.get('muselist')
+ used_useflags = kwargs.get('used_useflags')
+ # check if there are unused local USE-descriptions in metadata.xml
+ # (unless there are any invalids, to avoid noise)
+ if kwargs.get('allvalid'):
+ for myflag in muselist.difference(used_useflags):
+ self.qatracker.add_error(
+ "metadata.warning",
+ "%s/metadata.xml: unused local USE-description: '%s'"
+ % (xpkg, myflag))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (False, [])
+
+ @property
+ def runInFinal(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 4472f88..e486282 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -272,7 +272,6 @@ class Scanner(object):
def _scan_ebuilds(self, ebuildlist, dynamic_data):
- xpkg = dynamic_data['xpkg']
# detect unused local USE-descriptions
dynamic_data['used_useflags'] = set()
@@ -320,11 +319,30 @@ class Scanner(object):
if y_ebuild_continue:
continue
- # check if there are unused local USE-descriptions in metadata.xml
- # (unless there are any invalids, to avoid noise)
- if dynamic_data['allvalid']:
- for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
- self.qatracker.add_error(
- "metadata.warning",
- "%s/metadata.xml: unused local USE-description: '%s'"
- % (xpkg, myflag))
+ # Final checks
+ # initialize per pkg plugin final checks here
+ # need to set it up for ==> self.modules_list or some other ordered list
+ xpkg_complete = False
+ for mod in [('unused', 'UnusedChecks')]:
+ if mod[0]:
+ mod_class = MODULE_CONTROLLER.get_class(mod[0])
+ print("Initializing class name:", mod_class.__name__)
+ self.modules[mod[1]] = mod_class(**self.kwargs)
+ print("scan_ebuilds final checks: module:", mod[1])
+ do_it, functions = self.modules[mod[1]].runInFinal
+ # print("do_it", do_it, "functions", functions)
+ if do_it:
+ for func in functions:
+ print("\tRunning function:", func)
+ rdata = func(**dynamic_data)
+ if rdata.get('continue', False):
+ xpkg_complete = True
+ print("\t>>> Continuing")
+ break
+ #print("rdata:", rdata)
+ dynamic_data.update(rdata)
+ #print("dynamic_data", dynamic_data)
+
+ if xpkg_complete:
+ return
+ return
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-29 5:01 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-29 5:01 UTC (permalink / raw
To: gentoo-commits
commit: fe11812f3f3aed9a6b3cdcfca1c0936a794193c8
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:31:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 29 04:52:57 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=fe11812f
scanner.py: Migrate another metadata check to ebuild_metadata
pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
pym/repoman/scanner.py | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ if ebuild.metadata.get("PROVIDE"):
+ self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
return {'continue': False}
@property
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index febbc1d..3ea27b6 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -327,8 +327,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['ebuild'].metadata.get("PROVIDE"):
- self.qatracker.add_error("virtual.oldstyle", dynamic_data['ebuild'].relative_path)
for pos, missing_var in enumerate(missingvars):
if not dynamic_data['ebuild'].metadata.get(missing_var):
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-27 23:15 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-27 23:15 UTC (permalink / raw
To: gentoo-commits
commit: 319db47c9c12492dc499632ef94c95916c8d4bd2
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:31:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 27 22:44:22 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=319db47c
scanner.py: Migrate another metadata check to ebuild_metadata
pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
pym/repoman/scanner.py | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ if ebuild.metadata.get("PROVIDE"):
+ self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
return {'continue': False}
@property
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index febbc1d..3ea27b6 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -327,8 +327,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['ebuild'].metadata.get("PROVIDE"):
- self.qatracker.add_error("virtual.oldstyle", dynamic_data['ebuild'].relative_path)
for pos, missing_var in enumerate(missingvars):
if not dynamic_data['ebuild'].metadata.get(missing_var):
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-27 23:15 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-27 23:15 UTC (permalink / raw
To: gentoo-commits
commit: adbae329b25f1c026b2a0f74e7c84809b14f7361
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 10:35:49 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Jan 27 22:44:21 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=adbae329
repoman: Migrate code from _scan_ebuilds to a new EbuildMetadata class and check
pym/repoman/modules/scan/metadata/__init__.py | 11 +++++-
.../modules/scan/metadata/ebuild_metadata.py | 39 ++++++++++++++++++++++
pym/repoman/scanner.py | 27 +--------------
3 files changed, 50 insertions(+), 27 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index ae9b18b..bacedf5 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -10,7 +10,7 @@ module_spec = {
'name': 'metadata',
'description': doc,
'provides':{
- 'metadata-module': {
+ 'pkg-metadata': {
'name': "pkgmetadata",
'sourcefile': "pkgmetadata",
'class': "PkgMetadata",
@@ -19,6 +19,15 @@ module_spec = {
'func_desc': {
},
},
+ 'ebuild-metadata': {
+ 'name': "ebuild_metadata",
+ 'sourcefile': "ebuild_metadata",
+ 'class': "EbuildMetadata",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
new file mode 100644
index 0000000..143a40e
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -0,0 +1,39 @@
+# -*- coding:utf-8 -*-
+
+'''Ebuild Metadata Checks'''
+
+import re
+import sys
+
+if sys.hexversion >= 0x3000000:
+ basestring = str
+
+NON_ASCII_RE = re.compile(r'[^\x00-\x7f]')
+
+
+class EbuildMetadata(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ for k, v in ebuild.metadata.items():
+ if not isinstance(v, basestring):
+ continue
+ m = NON_ASCII_RE.search(v)
+ if m is not None:
+ self.qatracker.add_error(
+ "variable.invalidchar",
+ "%s: %s variable contains non-ASCII "
+ "character at position %s" %
+ (ebuild.relative_path, k, m.start() + 1))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 8873ef4..abff1af 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -5,8 +5,6 @@ from __future__ import print_function, unicode_literals
import copy
import io
import logging
-import re
-import sys
from itertools import chain
from pprint import pformat
@@ -47,18 +45,10 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-
-if sys.hexversion >= 0x3000000:
- basestring = str
-
-NON_ASCII_RE = re.compile(r'[^\x00-\x7f]')
-
-
def sort_key(item):
return item[2].sub_path
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -314,7 +304,7 @@ class Scanner(object):
# initialize per ebuild plugin checks here
# need to set it up for ==> self.modules_list or some other ordered list
for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
- ('eapi', 'EAPIChecks')]:
+ ('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata')]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
logging.debug("Initializing class name: %s", mod_class.__name__)
@@ -341,21 +331,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
-
- for k, v in dynamic_data['ebuild'].metadata.items():
- if not isinstance(v, basestring):
- continue
- m = NON_ASCII_RE.search(v)
- if m is not None:
- self.qatracker.add_error(
- "variable.invalidchar",
- "%s: %s variable contains non-ASCII "
- "character at position %s" %
- (dynamic_data['ebuild'].relative_path, k, m.start() + 1))
-
- if not dynamic_data['src_uri_error']:
- self.thirdparty.check(dynamic_data['ebuild'].metadata, dynamic_data['ebuild'].relative_path)
-
if dynamic_data['ebuild'].metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", dynamic_data['ebuild'].relative_path)
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-23 1:42 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-23 1:42 UTC (permalink / raw
To: gentoo-commits
commit: 0fdd06062e2436366619c91ffa4b2b155e334762
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:31:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 01:30:34 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0fdd0606
scanner.py: Migrate another metadata check to ebuild_metadata
pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
pym/repoman/scanner.py | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ if ebuild.metadata.get("PROVIDE"):
+ self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
return {'continue': False}
@property
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e6a17cd..46f46f5 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,8 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['ebuild'].metadata.get("PROVIDE"):
- self.qatracker.add_error("virtual.oldstyle", dynamic_data['ebuild'].relative_path)
for pos, missing_var in enumerate(missingvars):
if not dynamic_data['ebuild'].metadata.get(missing_var):
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-23 1:42 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-23 1:42 UTC (permalink / raw
To: gentoo-commits
commit: c342a863e6e7825e695380d54a8f201319494129
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:56:25 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sat Jan 23 01:30:34 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=c342a863
repoman: Migrate more metadata checks to ebuild_metadata.py
.../modules/scan/metadata/ebuild_metadata.py | 32 ++++++++++++++++++++--
pym/repoman/scanner.py | 17 ------------
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 2dc1db2..77c947e 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -5,6 +5,8 @@
import re
import sys
+from repoman.qa_data import missingvars
+
if sys.hexversion >= 0x3000000:
basestring = str
@@ -16,7 +18,7 @@ class EbuildMetadata(object):
def __init__(self, **kwargs):
self.qatracker = kwargs.get('qatracker')
- def check(self, **kwargs):
+ def invalidchar(self, **kwargs):
ebuild = kwargs.get('ebuild')
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
@@ -28,9 +30,35 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ return {'continue': False}
+
+ def missing(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ for pos, missing_var in enumerate(missingvars):
+ if not ebuild.metadata.get(missing_var):
+ if kwargs.get('catdir') == "virtual" and \
+ missing_var in ("HOMEPAGE", "LICENSE"):
+ continue
+ if kwargs.get('live_ebuild') and missing_var == "KEYWORDS":
+ continue
+ myqakey = missingvars[pos] + ".missing"
+ self.qatracker.add_error(myqakey, '%s/%s.ebuild'
+ % (kwargs.get('xpkg'), kwargs.get('y_ebuild')))
+ return {'continue': False}
+
+ def old_virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+ return {'continue': False}
+ def virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ if kwargs.get('catdir') == "virtual":
+ for var in ("HOMEPAGE", "LICENSE"):
+ if ebuild.metadata.get(var):
+ myqakey = var + ".virtual"
+ self.qatracker.add_error(myqakey, ebuild.relative_path)
return {'continue': False}
@property
@@ -39,4 +67,4 @@ class EbuildMetadata(object):
@property
def runInEbuilds(self):
- return (True, [self.check])
+ return (True, [self.invalidchar, self.missing, self.old_virtual, self.virtual])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 46f46f5..d42fd33 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,23 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
-
- for pos, missing_var in enumerate(missingvars):
- if not dynamic_data['ebuild'].metadata.get(missing_var):
- if dynamic_data['catdir'] == "virtual" and \
- missing_var in ("HOMEPAGE", "LICENSE"):
- continue
- if dynamic_data['live_ebuild'] and missing_var == "KEYWORDS":
- continue
- myqakey = missingvars[pos] + ".missing"
- self.qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
-
- if dynamic_data['catdir'] == "virtual":
- for var in ("HOMEPAGE", "LICENSE"):
- if dynamic_data['ebuild'].metadata.get(var):
- myqakey = var + ".virtual"
- self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
-
if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
self.liveeclasscheck.check(
dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-22 20:55 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
To: gentoo-commits
commit: 17294ab164deeb0678c5db6833cf8dd1c13412aa
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:37:22 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:14 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=17294ab1
repoman: Create a metadata UnusedCheck and final pkg checks
Create a plugin loop for any final pkg checks.
Create the one plugin for the unused use-descriptions in mteadata.xml
pym/repoman/modules/scan/metadata/__init__.py | 8 ++++++
pym/repoman/modules/scan/metadata/unused.py | 32 ++++++++++++++++++++++++
pym/repoman/scanner.py | 36 ++++++++++++++++++++-------
3 files changed, 67 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index 6ab44f6..ed4a967 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -50,6 +50,14 @@ module_spec = {
'func_desc': {
},
},
+ 'unused-metadata': {
+ 'name': "unused",
+ 'class': "UnusedCheck",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/metadata/unused.py b/pym/repoman/modules/scan/metadata/unused.py
new file mode 100644
index 0000000..5eb6716
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -0,0 +1,32 @@
+
+
+class UnusedCheck(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ xpkg = kwargs.get('xpkg')
+ muselist = kwargs.get('muselist')
+ used_useflags = kwargs.get('used_useflags')
+ # check if there are unused local USE-descriptions in metadata.xml
+ # (unless there are any invalids, to avoid noise)
+ if kwargs.get('allvalid'):
+ for myflag in muselist.difference(used_useflags):
+ self.qatracker.add_error(
+ "metadata.warning",
+ "%s/metadata.xml: unused local USE-description: '%s'"
+ % (xpkg, myflag))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (False, [])
+
+ @property
+ def runInFinal(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 1cd37d0..4cc2e67 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -269,7 +269,6 @@ class Scanner(object):
def _scan_ebuilds(self, ebuildlist, dynamic_data):
- xpkg = dynamic_data['xpkg']
# detect unused local USE-descriptions
dynamic_data['used_useflags'] = set()
@@ -317,11 +316,30 @@ class Scanner(object):
if y_ebuild_continue:
continue
- # check if there are unused local USE-descriptions in metadata.xml
- # (unless there are any invalids, to avoid noise)
- if dynamic_data['allvalid']:
- for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
- self.qatracker.add_error(
- "metadata.warning",
- "%s/metadata.xml: unused local USE-description: '%s'"
- % (xpkg, myflag))
+ # Final checks
+ # initialize per pkg plugin final checks here
+ # need to set it up for ==> self.modules_list or some other ordered list
+ xpkg_complete = False
+ for mod in [('unused', 'UnusedChecks')]:
+ if mod[0]:
+ mod_class = MODULE_CONTROLLER.get_class(mod[0])
+ print("Initializing class name:", mod_class.__name__)
+ self.modules[mod[1]] = mod_class(**self.kwargs)
+ print("scan_ebuilds final checks: module:", mod[1])
+ do_it, functions = self.modules[mod[1]].runInFinal
+ # print("do_it", do_it, "functions", functions)
+ if do_it:
+ for func in functions:
+ print("\tRunning function:", func)
+ rdata = func(**dynamic_data)
+ if rdata.get('continue', False):
+ xpkg_complete = True
+ print("\t>>> Continuing")
+ break
+ #print("rdata:", rdata)
+ dynamic_data.update(rdata)
+ #print("dynamic_data", dynamic_data)
+
+ if xpkg_complete:
+ return
+ return
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-22 20:55 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
To: gentoo-commits
commit: 1ed552fd83a5795944afe8f1971ee831fd42c423
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:29:07 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:15 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1ed552fd
repoman: Fix a traceback due to xmlint not being installed for a manifest generation
Mike helped find teh fact that self.binary was None, causing the misleading traceback.
Tighten up the logic in XmlLint.
Bypass the PkgMetadata check for manifest mode.
floppym@naomi btrfs-progs % repoman manifest
>>> Creating Manifest for /home/floppym/repos/gentoo/sys-fs/btrfs-progs
Traceback (most recent call last):
File "/home/floppym/bin/repoman", line 37, in <module>
repoman_main(sys.argv[1:])
File "/home/floppym/src/portage/pym/repoman/main.py", line 111, in repoman_main
can_force = scanner.scan_pkgs(can_force)
File "/home/floppym/src/portage/pym/repoman/scanner.py", line 242, in scan_pkgs
rdata = func(**dynamic_data)
File "/home/floppym/src/portage/pym/repoman/modules/scan/metadata/pkgmetadata.py", line 180, in check
if not self.xmllint.check(checkdir, repolevel):
File "/home/floppym/src/portage/pym/repoman/_xml.py", line 98, in check
os.path.join(checkdir, "metadata.xml"))))
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
pym/repoman/_xml.py | 2 +-
pym/repoman/modules/scan/metadata/pkgmetadata.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index 2661f14..f7ff9fb 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -60,6 +60,7 @@ class XmlLint(object):
self.repoman_settings = repoman_settings
self._is_capable = metadata_dtd is not None
self.binary = None
+ self._is_capable = False
self._check_capable()
def _check_capable(self):
@@ -68,7 +69,6 @@ class XmlLint(object):
self.binary = find_binary('xmllint')
if not self.binary:
print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
- self._is_capable = False
elif not self._is_capable:
if not fetch_metadata_dtd(self.metadata_dtd, self.repoman_settings):
sys.exit(1)
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 220fd23..8e93457 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -71,6 +71,9 @@ class PkgMetadata(ScanBase):
repolevel = kwargs.get('repolevel')
self.musedict = {}
+ if self.options.mode in ['manifest']:
+ return {'continue': False, 'muselist': frozenset(self.musedict)}
+
# metadata.xml file check
if "metadata.xml" not in checkdirlist:
self.qatracker.add_error("metadata.missing", xpkg + "/metadata.xml")
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-22 20:55 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
To: gentoo-commits
commit: 5ad8ca64e95010fa6acc3862f8d95c551b3d7300
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:31:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:12 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5ad8ca64
scanner.py: Migrate another metadata check to ebuild_metadata
pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
pym/repoman/scanner.py | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ if ebuild.metadata.get("PROVIDE"):
+ self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
return {'continue': False}
@property
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e6a17cd..46f46f5 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,8 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['ebuild'].metadata.get("PROVIDE"):
- self.qatracker.add_error("virtual.oldstyle", dynamic_data['ebuild'].relative_path)
for pos, missing_var in enumerate(missingvars):
if not dynamic_data['ebuild'].metadata.get(missing_var):
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-22 20:55 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-22 20:55 UTC (permalink / raw
To: gentoo-commits
commit: 765e1a19e6f4d16ae279bf15b0ce120876cd5815
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:56:25 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Jan 22 18:44:12 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=765e1a19
repoman: Migrate more metadata checks to ebuild_metadata.py
.../modules/scan/metadata/ebuild_metadata.py | 32 ++++++++++++++++++++--
pym/repoman/scanner.py | 17 ------------
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 2dc1db2..77c947e 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -5,6 +5,8 @@
import re
import sys
+from repoman.qa_data import missingvars
+
if sys.hexversion >= 0x3000000:
basestring = str
@@ -16,7 +18,7 @@ class EbuildMetadata(object):
def __init__(self, **kwargs):
self.qatracker = kwargs.get('qatracker')
- def check(self, **kwargs):
+ def invalidchar(self, **kwargs):
ebuild = kwargs.get('ebuild')
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
@@ -28,9 +30,35 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ return {'continue': False}
+
+ def missing(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ for pos, missing_var in enumerate(missingvars):
+ if not ebuild.metadata.get(missing_var):
+ if kwargs.get('catdir') == "virtual" and \
+ missing_var in ("HOMEPAGE", "LICENSE"):
+ continue
+ if kwargs.get('live_ebuild') and missing_var == "KEYWORDS":
+ continue
+ myqakey = missingvars[pos] + ".missing"
+ self.qatracker.add_error(myqakey, '%s/%s.ebuild'
+ % (kwargs.get('xpkg'), kwargs.get('y_ebuild')))
+ return {'continue': False}
+
+ def old_virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+ return {'continue': False}
+ def virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ if kwargs.get('catdir') == "virtual":
+ for var in ("HOMEPAGE", "LICENSE"):
+ if ebuild.metadata.get(var):
+ myqakey = var + ".virtual"
+ self.qatracker.add_error(myqakey, ebuild.relative_path)
return {'continue': False}
@property
@@ -39,4 +67,4 @@ class EbuildMetadata(object):
@property
def runInEbuilds(self):
- return (True, [self.check])
+ return (True, [self.invalidchar, self.missing, self.old_virtual, self.virtual])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 46f46f5..d42fd33 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,23 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
-
- for pos, missing_var in enumerate(missingvars):
- if not dynamic_data['ebuild'].metadata.get(missing_var):
- if dynamic_data['catdir'] == "virtual" and \
- missing_var in ("HOMEPAGE", "LICENSE"):
- continue
- if dynamic_data['live_ebuild'] and missing_var == "KEYWORDS":
- continue
- myqakey = missingvars[pos] + ".missing"
- self.qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
-
- if dynamic_data['catdir'] == "virtual":
- for var in ("HOMEPAGE", "LICENSE"):
- if dynamic_data['ebuild'].metadata.get(var):
- myqakey = var + ".virtual"
- self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
-
if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
self.liveeclasscheck.check(
dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-21 18:30 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-21 18:30 UTC (permalink / raw
To: gentoo-commits
commit: 5c0d45afb60969aceba7391e42ca3a046871f6e5
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Jan 21 18:29:07 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Jan 21 18:29:07 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=5c0d45af
repoman: Fix a traceback due to xmlint not being installed for a manifest generation
Mike helped find teh fact that self.binary was None, causing the misleading traceback.
Tighten up the logic in XmlLint.
Bypass the PkgMetadata check for manifest mode.
floppym@naomi btrfs-progs % repoman manifest
>>> Creating Manifest for /home/floppym/repos/gentoo/sys-fs/btrfs-progs
Traceback (most recent call last):
File "/home/floppym/bin/repoman", line 37, in <module>
repoman_main(sys.argv[1:])
File "/home/floppym/src/portage/pym/repoman/main.py", line 111, in repoman_main
can_force = scanner.scan_pkgs(can_force)
File "/home/floppym/src/portage/pym/repoman/scanner.py", line 242, in scan_pkgs
rdata = func(**dynamic_data)
File "/home/floppym/src/portage/pym/repoman/modules/scan/metadata/pkgmetadata.py", line 180, in check
if not self.xmllint.check(checkdir, repolevel):
File "/home/floppym/src/portage/pym/repoman/_xml.py", line 98, in check
os.path.join(checkdir, "metadata.xml"))))
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
pym/repoman/_xml.py | 2 +-
pym/repoman/modules/scan/metadata/pkgmetadata.py | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/pym/repoman/_xml.py b/pym/repoman/_xml.py
index 43fc930..334377d 100644
--- a/pym/repoman/_xml.py
+++ b/pym/repoman/_xml.py
@@ -58,6 +58,7 @@ class XmlLint(object):
self.repoman_settings = repoman_settings
self._is_capable = metadata_dtd is not None
self.binary = None
+ self._is_capable = False
self._check_capable()
def _check_capable(self):
@@ -66,7 +67,6 @@ class XmlLint(object):
self.binary = find_binary('xmllint')
if not self.binary:
print(red("!!! xmllint not found. Can't check metadata.xml.\n"))
- self._is_capable = False
elif not self._is_capable:
if not fetch_metadata_dtd(self.metadata_dtd, self.repoman_settings):
sys.exit(1)
diff --git a/pym/repoman/modules/scan/metadata/pkgmetadata.py b/pym/repoman/modules/scan/metadata/pkgmetadata.py
index 220fd23..8e93457 100644
--- a/pym/repoman/modules/scan/metadata/pkgmetadata.py
+++ b/pym/repoman/modules/scan/metadata/pkgmetadata.py
@@ -71,6 +71,9 @@ class PkgMetadata(ScanBase):
repolevel = kwargs.get('repolevel')
self.musedict = {}
+ if self.options.mode in ['manifest']:
+ return {'continue': False, 'muselist': frozenset(self.musedict)}
+
# metadata.xml file check
if "metadata.xml" not in checkdirlist:
self.qatracker.add_error("metadata.missing", xpkg + "/metadata.xml")
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-18 19:23 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-18 19:23 UTC (permalink / raw
To: gentoo-commits
commit: 390cda1fe14dc7d6c66dc623fa48acc7155e5d3e
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:37:22 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 19:20:03 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=390cda1f
repoman: Create a metadata UnusedCheck and final pkg checks
Create a plugin loop for any final pkg checks.
Create the one plugin for the unused use-descriptions in mteadata.xml
pym/repoman/modules/scan/metadata/__init__.py | 8 ++++++
pym/repoman/modules/scan/metadata/unused.py | 32 ++++++++++++++++++++++++
pym/repoman/scanner.py | 36 ++++++++++++++++++++-------
3 files changed, 67 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index 6ab44f6..ed4a967 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -50,6 +50,14 @@ module_spec = {
'func_desc': {
},
},
+ 'unused-metadata': {
+ 'name': "unused",
+ 'class': "UnusedCheck",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/metadata/unused.py b/pym/repoman/modules/scan/metadata/unused.py
new file mode 100644
index 0000000..5eb6716
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -0,0 +1,32 @@
+
+
+class UnusedCheck(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ xpkg = kwargs.get('xpkg')
+ muselist = kwargs.get('muselist')
+ used_useflags = kwargs.get('used_useflags')
+ # check if there are unused local USE-descriptions in metadata.xml
+ # (unless there are any invalids, to avoid noise)
+ if kwargs.get('allvalid'):
+ for myflag in muselist.difference(used_useflags):
+ self.qatracker.add_error(
+ "metadata.warning",
+ "%s/metadata.xml: unused local USE-description: '%s'"
+ % (xpkg, myflag))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (False, [])
+
+ @property
+ def runInFinal(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 89eaa57..50dd259 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -269,7 +269,6 @@ class Scanner(object):
def _scan_ebuilds(self, ebuildlist, dynamic_data):
- xpkg = dynamic_data['xpkg']
# detect unused local USE-descriptions
dynamic_data['used_useflags'] = set()
@@ -317,11 +316,30 @@ class Scanner(object):
if y_ebuild_continue:
continue
- # check if there are unused local USE-descriptions in metadata.xml
- # (unless there are any invalids, to avoid noise)
- if dynamic_data['allvalid']:
- for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
- self.qatracker.add_error(
- "metadata.warning",
- "%s/metadata.xml: unused local USE-description: '%s'"
- % (xpkg, myflag))
+ # Final checks
+ # initialize per pkg plugin final checks here
+ # need to set it up for ==> self.modules_list or some other ordered list
+ xpkg_complete = False
+ for mod in [('unused', 'UnusedChecks')]:
+ if mod[0]:
+ mod_class = MODULE_CONTROLLER.get_class(mod[0])
+ print("Initializing class name:", mod_class.__name__)
+ self.modules[mod[1]] = mod_class(**self.kwargs)
+ print("scan_ebuilds final checks: module:", mod[1])
+ do_it, functions = self.modules[mod[1]].runInFinal
+ # print("do_it", do_it, "functions", functions)
+ if do_it:
+ for func in functions:
+ print("\tRunning function:", func)
+ rdata = func(**dynamic_data)
+ if rdata.get('continue', False):
+ xpkg_complete = True
+ print("\t>>> Continuing")
+ break
+ #print("rdata:", rdata)
+ dynamic_data.update(rdata)
+ #print("dynamic_data", dynamic_data)
+
+ if xpkg_complete:
+ return
+ return
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-18 19:23 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-18 19:23 UTC (permalink / raw
To: gentoo-commits
commit: fceec7352038d21e2bbd774fb4e0a270386ef74a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:31:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 19:20:03 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=fceec735
scanner.py: Migrate another metadata check to ebuild_metadata
pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
pym/repoman/scanner.py | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ if ebuild.metadata.get("PROVIDE"):
+ self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
return {'continue': False}
@property
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e6a17cd..46f46f5 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,8 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['ebuild'].metadata.get("PROVIDE"):
- self.qatracker.add_error("virtual.oldstyle", dynamic_data['ebuild'].relative_path)
for pos, missing_var in enumerate(missingvars):
if not dynamic_data['ebuild'].metadata.get(missing_var):
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-18 19:23 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-18 19:23 UTC (permalink / raw
To: gentoo-commits
commit: 22c3194ea5023a9b5c399642498f0b38c82e2530
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:56:25 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 19:20:03 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=22c3194e
repoman: Migrate more metadata checks to ebuild_metadata.py
.../modules/scan/metadata/ebuild_metadata.py | 32 ++++++++++++++++++++--
pym/repoman/scanner.py | 17 ------------
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 2dc1db2..77c947e 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -5,6 +5,8 @@
import re
import sys
+from repoman.qa_data import missingvars
+
if sys.hexversion >= 0x3000000:
basestring = str
@@ -16,7 +18,7 @@ class EbuildMetadata(object):
def __init__(self, **kwargs):
self.qatracker = kwargs.get('qatracker')
- def check(self, **kwargs):
+ def invalidchar(self, **kwargs):
ebuild = kwargs.get('ebuild')
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
@@ -28,9 +30,35 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ return {'continue': False}
+
+ def missing(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ for pos, missing_var in enumerate(missingvars):
+ if not ebuild.metadata.get(missing_var):
+ if kwargs.get('catdir') == "virtual" and \
+ missing_var in ("HOMEPAGE", "LICENSE"):
+ continue
+ if kwargs.get('live_ebuild') and missing_var == "KEYWORDS":
+ continue
+ myqakey = missingvars[pos] + ".missing"
+ self.qatracker.add_error(myqakey, '%s/%s.ebuild'
+ % (kwargs.get('xpkg'), kwargs.get('y_ebuild')))
+ return {'continue': False}
+
+ def old_virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+ return {'continue': False}
+ def virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ if kwargs.get('catdir') == "virtual":
+ for var in ("HOMEPAGE", "LICENSE"):
+ if ebuild.metadata.get(var):
+ myqakey = var + ".virtual"
+ self.qatracker.add_error(myqakey, ebuild.relative_path)
return {'continue': False}
@property
@@ -39,4 +67,4 @@ class EbuildMetadata(object):
@property
def runInEbuilds(self):
- return (True, [self.check])
+ return (True, [self.invalidchar, self.missing, self.old_virtual, self.virtual])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 46f46f5..d42fd33 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,23 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
-
- for pos, missing_var in enumerate(missingvars):
- if not dynamic_data['ebuild'].metadata.get(missing_var):
- if dynamic_data['catdir'] == "virtual" and \
- missing_var in ("HOMEPAGE", "LICENSE"):
- continue
- if dynamic_data['live_ebuild'] and missing_var == "KEYWORDS":
- continue
- myqakey = missingvars[pos] + ".missing"
- self.qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
-
- if dynamic_data['catdir'] == "virtual":
- for var in ("HOMEPAGE", "LICENSE"):
- if dynamic_data['ebuild'].metadata.get(var):
- myqakey = var + ".virtual"
- self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
-
if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
self.liveeclasscheck.check(
dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-11 8:01 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-11 8:01 UTC (permalink / raw
To: gentoo-commits
commit: b0034ee9cf3b37124cdda079d6b9cd3268632f8f
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:37:22 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 08:00:19 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b0034ee9
repoman: Create a metadata UnusedCheck and final pkg checks
Create a plugin loop for any final pkg checks.
Create the one plugin for the unused use-descriptions in mteadata.xml
pym/repoman/modules/scan/metadata/__init__.py | 8 ++++++
pym/repoman/modules/scan/metadata/unused.py | 32 ++++++++++++++++++++++++
pym/repoman/scanner.py | 36 ++++++++++++++++++++-------
3 files changed, 67 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index 6ab44f6..ed4a967 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -50,6 +50,14 @@ module_spec = {
'func_desc': {
},
},
+ 'unused-metadata': {
+ 'name': "unused",
+ 'class': "UnusedCheck",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/metadata/unused.py b/pym/repoman/modules/scan/metadata/unused.py
new file mode 100644
index 0000000..5eb6716
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -0,0 +1,32 @@
+
+
+class UnusedCheck(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ xpkg = kwargs.get('xpkg')
+ muselist = kwargs.get('muselist')
+ used_useflags = kwargs.get('used_useflags')
+ # check if there are unused local USE-descriptions in metadata.xml
+ # (unless there are any invalids, to avoid noise)
+ if kwargs.get('allvalid'):
+ for myflag in muselist.difference(used_useflags):
+ self.qatracker.add_error(
+ "metadata.warning",
+ "%s/metadata.xml: unused local USE-description: '%s'"
+ % (xpkg, myflag))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (False, [])
+
+ @property
+ def runInFinal(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 89eaa57..50dd259 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -269,7 +269,6 @@ class Scanner(object):
def _scan_ebuilds(self, ebuildlist, dynamic_data):
- xpkg = dynamic_data['xpkg']
# detect unused local USE-descriptions
dynamic_data['used_useflags'] = set()
@@ -317,11 +316,30 @@ class Scanner(object):
if y_ebuild_continue:
continue
- # check if there are unused local USE-descriptions in metadata.xml
- # (unless there are any invalids, to avoid noise)
- if dynamic_data['allvalid']:
- for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
- self.qatracker.add_error(
- "metadata.warning",
- "%s/metadata.xml: unused local USE-description: '%s'"
- % (xpkg, myflag))
+ # Final checks
+ # initialize per pkg plugin final checks here
+ # need to set it up for ==> self.modules_list or some other ordered list
+ xpkg_complete = False
+ for mod in [('unused', 'UnusedChecks')]:
+ if mod[0]:
+ mod_class = MODULE_CONTROLLER.get_class(mod[0])
+ print("Initializing class name:", mod_class.__name__)
+ self.modules[mod[1]] = mod_class(**self.kwargs)
+ print("scan_ebuilds final checks: module:", mod[1])
+ do_it, functions = self.modules[mod[1]].runInFinal
+ # print("do_it", do_it, "functions", functions)
+ if do_it:
+ for func in functions:
+ print("\tRunning function:", func)
+ rdata = func(**dynamic_data)
+ if rdata.get('continue', False):
+ xpkg_complete = True
+ print("\t>>> Continuing")
+ break
+ #print("rdata:", rdata)
+ dynamic_data.update(rdata)
+ #print("dynamic_data", dynamic_data)
+
+ if xpkg_complete:
+ return
+ return
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-11 8:01 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-11 8:01 UTC (permalink / raw
To: gentoo-commits
commit: a2f64aea6bee6ea90041a40dca374668a6cfa54a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:31:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 08:00:17 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a2f64aea
scanner.py: Migrate another metadata check to ebuild_metadata
pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
pym/repoman/scanner.py | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ if ebuild.metadata.get("PROVIDE"):
+ self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
return {'continue': False}
@property
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e6a17cd..46f46f5 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,8 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['ebuild'].metadata.get("PROVIDE"):
- self.qatracker.add_error("virtual.oldstyle", dynamic_data['ebuild'].relative_path)
for pos, missing_var in enumerate(missingvars):
if not dynamic_data['ebuild'].metadata.get(missing_var):
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-11 8:01 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-11 8:01 UTC (permalink / raw
To: gentoo-commits
commit: 0813e08992fde8e4292683a45ee00a4fcf96c938
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:56:25 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Mon Jan 11 08:00:17 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=0813e089
repoman: Migrate more metadata checks to ebuild_metadata.py
.../modules/scan/metadata/ebuild_metadata.py | 32 ++++++++++++++++++++--
pym/repoman/scanner.py | 17 ------------
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 2dc1db2..77c947e 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -5,6 +5,8 @@
import re
import sys
+from repoman.qa_data import missingvars
+
if sys.hexversion >= 0x3000000:
basestring = str
@@ -16,7 +18,7 @@ class EbuildMetadata(object):
def __init__(self, **kwargs):
self.qatracker = kwargs.get('qatracker')
- def check(self, **kwargs):
+ def invalidchar(self, **kwargs):
ebuild = kwargs.get('ebuild')
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
@@ -28,9 +30,35 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ return {'continue': False}
+
+ def missing(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ for pos, missing_var in enumerate(missingvars):
+ if not ebuild.metadata.get(missing_var):
+ if kwargs.get('catdir') == "virtual" and \
+ missing_var in ("HOMEPAGE", "LICENSE"):
+ continue
+ if kwargs.get('live_ebuild') and missing_var == "KEYWORDS":
+ continue
+ myqakey = missingvars[pos] + ".missing"
+ self.qatracker.add_error(myqakey, '%s/%s.ebuild'
+ % (kwargs.get('xpkg'), kwargs.get('y_ebuild')))
+ return {'continue': False}
+
+ def old_virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+ return {'continue': False}
+ def virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ if kwargs.get('catdir') == "virtual":
+ for var in ("HOMEPAGE", "LICENSE"):
+ if ebuild.metadata.get(var):
+ myqakey = var + ".virtual"
+ self.qatracker.add_error(myqakey, ebuild.relative_path)
return {'continue': False}
@property
@@ -39,4 +67,4 @@ class EbuildMetadata(object):
@property
def runInEbuilds(self):
- return (True, [self.check])
+ return (True, [self.invalidchar, self.missing, self.old_virtual, self.virtual])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 46f46f5..d42fd33 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,23 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
-
- for pos, missing_var in enumerate(missingvars):
- if not dynamic_data['ebuild'].metadata.get(missing_var):
- if dynamic_data['catdir'] == "virtual" and \
- missing_var in ("HOMEPAGE", "LICENSE"):
- continue
- if dynamic_data['live_ebuild'] and missing_var == "KEYWORDS":
- continue
- myqakey = missingvars[pos] + ".missing"
- self.qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
-
- if dynamic_data['catdir'] == "virtual":
- for var in ("HOMEPAGE", "LICENSE"):
- if dynamic_data['ebuild'].metadata.get(var):
- myqakey = var + ".virtual"
- self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
-
if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
self.liveeclasscheck.check(
dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-11 6:31 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-11 6:31 UTC (permalink / raw
To: gentoo-commits
commit: a75fbc2fb47f5f76e71ddbcc2c4e6a04067eeb97
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:56:25 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 22:59:35 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=a75fbc2f
repoman: Migrate more metadata checks to ebuild_metadata.py
.../modules/scan/metadata/ebuild_metadata.py | 32 ++++++++++++++++++++--
pym/repoman/scanner.py | 17 ------------
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 2dc1db2..77c947e 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -5,6 +5,8 @@
import re
import sys
+from repoman.qa_data import missingvars
+
if sys.hexversion >= 0x3000000:
basestring = str
@@ -16,7 +18,7 @@ class EbuildMetadata(object):
def __init__(self, **kwargs):
self.qatracker = kwargs.get('qatracker')
- def check(self, **kwargs):
+ def invalidchar(self, **kwargs):
ebuild = kwargs.get('ebuild')
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
@@ -28,9 +30,35 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ return {'continue': False}
+
+ def missing(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ for pos, missing_var in enumerate(missingvars):
+ if not ebuild.metadata.get(missing_var):
+ if kwargs.get('catdir') == "virtual" and \
+ missing_var in ("HOMEPAGE", "LICENSE"):
+ continue
+ if kwargs.get('live_ebuild') and missing_var == "KEYWORDS":
+ continue
+ myqakey = missingvars[pos] + ".missing"
+ self.qatracker.add_error(myqakey, '%s/%s.ebuild'
+ % (kwargs.get('xpkg'), kwargs.get('y_ebuild')))
+ return {'continue': False}
+
+ def old_virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+ return {'continue': False}
+ def virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ if kwargs.get('catdir') == "virtual":
+ for var in ("HOMEPAGE", "LICENSE"):
+ if ebuild.metadata.get(var):
+ myqakey = var + ".virtual"
+ self.qatracker.add_error(myqakey, ebuild.relative_path)
return {'continue': False}
@property
@@ -39,4 +67,4 @@ class EbuildMetadata(object):
@property
def runInEbuilds(self):
- return (True, [self.check])
+ return (True, [self.invalidchar, self.missing, self.old_virtual, self.virtual])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 46f46f5..d42fd33 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,23 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
-
- for pos, missing_var in enumerate(missingvars):
- if not dynamic_data['ebuild'].metadata.get(missing_var):
- if dynamic_data['catdir'] == "virtual" and \
- missing_var in ("HOMEPAGE", "LICENSE"):
- continue
- if dynamic_data['live_ebuild'] and missing_var == "KEYWORDS":
- continue
- myqakey = missingvars[pos] + ".missing"
- self.qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
-
- if dynamic_data['catdir'] == "virtual":
- for var in ("HOMEPAGE", "LICENSE"):
- if dynamic_data['ebuild'].metadata.get(var):
- myqakey = var + ".virtual"
- self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
-
if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
self.liveeclasscheck.check(
dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-10 20:17 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
To: gentoo-commits
commit: 928fe92aaacdb806743c3815cf15ab60f767adbe
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 4 08:37:22 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 20:15:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=928fe92a
repoman: Create a metadata UnusedCheck and final pkg checks
Create a plugin loop for any final pkg checks.
Create the one plugin for the unused use-descriptions in mteadata.xml
pym/repoman/modules/scan/metadata/__init__.py | 8 ++++++
pym/repoman/modules/scan/metadata/unused.py | 32 ++++++++++++++++++++++++
pym/repoman/scanner.py | 36 ++++++++++++++++++++-------
3 files changed, 67 insertions(+), 9 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index 6ab44f6..ed4a967 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -50,6 +50,14 @@ module_spec = {
'func_desc': {
},
},
+ 'unused-metadata': {
+ 'name': "unused",
+ 'class': "UnusedCheck",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/metadata/unused.py b/pym/repoman/modules/scan/metadata/unused.py
new file mode 100644
index 0000000..5eb6716
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/unused.py
@@ -0,0 +1,32 @@
+
+
+class UnusedCheck(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ xpkg = kwargs.get('xpkg')
+ muselist = kwargs.get('muselist')
+ used_useflags = kwargs.get('used_useflags')
+ # check if there are unused local USE-descriptions in metadata.xml
+ # (unless there are any invalids, to avoid noise)
+ if kwargs.get('allvalid'):
+ for myflag in muselist.difference(used_useflags):
+ self.qatracker.add_error(
+ "metadata.warning",
+ "%s/metadata.xml: unused local USE-description: '%s'"
+ % (xpkg, myflag))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (False, [])
+
+ @property
+ def runInFinal(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 89eaa57..50dd259 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -269,7 +269,6 @@ class Scanner(object):
def _scan_ebuilds(self, ebuildlist, dynamic_data):
- xpkg = dynamic_data['xpkg']
# detect unused local USE-descriptions
dynamic_data['used_useflags'] = set()
@@ -317,11 +316,30 @@ class Scanner(object):
if y_ebuild_continue:
continue
- # check if there are unused local USE-descriptions in metadata.xml
- # (unless there are any invalids, to avoid noise)
- if dynamic_data['allvalid']:
- for myflag in dynamic_data['muselist'].difference(dynamic_data['used_useflags']):
- self.qatracker.add_error(
- "metadata.warning",
- "%s/metadata.xml: unused local USE-description: '%s'"
- % (xpkg, myflag))
+ # Final checks
+ # initialize per pkg plugin final checks here
+ # need to set it up for ==> self.modules_list or some other ordered list
+ xpkg_complete = False
+ for mod in [('unused', 'UnusedChecks')]:
+ if mod[0]:
+ mod_class = MODULE_CONTROLLER.get_class(mod[0])
+ print("Initializing class name:", mod_class.__name__)
+ self.modules[mod[1]] = mod_class(**self.kwargs)
+ print("scan_ebuilds final checks: module:", mod[1])
+ do_it, functions = self.modules[mod[1]].runInFinal
+ # print("do_it", do_it, "functions", functions)
+ if do_it:
+ for func in functions:
+ print("\tRunning function:", func)
+ rdata = func(**dynamic_data)
+ if rdata.get('continue', False):
+ xpkg_complete = True
+ print("\t>>> Continuing")
+ break
+ #print("rdata:", rdata)
+ dynamic_data.update(rdata)
+ #print("dynamic_data", dynamic_data)
+
+ if xpkg_complete:
+ return
+ return
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-10 20:17 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
To: gentoo-commits
commit: f1546d59102e763ad74097401ab68e3c996d250e
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 10:35:49 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 20:15:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f1546d59
repoman: Migrate code from _scan_ebuilds to a new EbuildMetadata class and check
pym/repoman/modules/scan/metadata/__init__.py | 10 +++++-
.../modules/scan/metadata/ebuild_metadata.py | 39 ++++++++++++++++++++++
pym/repoman/scanner.py | 27 +--------------
3 files changed, 49 insertions(+), 27 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/__init__.py b/pym/repoman/modules/scan/metadata/__init__.py
index 7327ec0..eba6565 100644
--- a/pym/repoman/modules/scan/metadata/__init__.py
+++ b/pym/repoman/modules/scan/metadata/__init__.py
@@ -10,7 +10,7 @@ module_spec = {
'name': 'metadata',
'description': doc,
'provides':{
- 'metadata-module': {
+ 'pkg-metadata': {
'name': "pkgmetadata",
'class': "PkgMetadata",
'description': doc,
@@ -18,6 +18,14 @@ module_spec = {
'func_desc': {
},
},
+ 'ebuild-metadata': {
+ 'name': "ebuild_metadata",
+ 'class': "EbuildMetadata",
+ 'description': doc,
+ 'functions': ['check'],
+ 'func_desc': {
+ },
+ },
}
}
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
new file mode 100644
index 0000000..143a40e
--- /dev/null
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -0,0 +1,39 @@
+# -*- coding:utf-8 -*-
+
+'''Ebuild Metadata Checks'''
+
+import re
+import sys
+
+if sys.hexversion >= 0x3000000:
+ basestring = str
+
+NON_ASCII_RE = re.compile(r'[^\x00-\x7f]')
+
+
+class EbuildMetadata(object):
+
+ def __init__(self, **kwargs):
+ self.qatracker = kwargs.get('qatracker')
+
+ def check(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ for k, v in ebuild.metadata.items():
+ if not isinstance(v, basestring):
+ continue
+ m = NON_ASCII_RE.search(v)
+ if m is not None:
+ self.qatracker.add_error(
+ "variable.invalidchar",
+ "%s: %s variable contains non-ASCII "
+ "character at position %s" %
+ (ebuild.relative_path, k, m.start() + 1))
+ return {'continue': False}
+
+ @property
+ def runInPkgs(self):
+ return (False, [])
+
+ @property
+ def runInEbuilds(self):
+ return (True, [self.check])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index a8aa2f3..6f3fb53 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -5,8 +5,6 @@ from __future__ import print_function, unicode_literals
import copy
import io
import logging
-import re
-import sys
from itertools import chain
from pprint import pformat
@@ -47,18 +45,10 @@ MODULE_CONTROLLER = Modules(path=MODULES_PATH, namepath="repoman.modules.scan")
MODULE_NAMES = MODULE_CONTROLLER.module_names[:]
-
-if sys.hexversion >= 0x3000000:
- basestring = str
-
-NON_ASCII_RE = re.compile(r'[^\x00-\x7f]')
-
-
def sort_key(item):
return item[2].sub_path
-
class Scanner(object):
'''Primary scan class. Operates all the small Q/A tests and checks'''
@@ -311,7 +301,7 @@ class Scanner(object):
# initialize per ebuild plugin checks here
# need to set it up for ==> self.modules_list or some other ordered list
for mod in [('ebuild', 'Ebuild'), ('live', 'LiveEclassChecks'),
- ('eapi', 'EAPIChecks')]:
+ ('eapi', 'EAPIChecks'), ('ebuild_metadata', 'EbuildMetadata')]:
if mod[0]:
mod_class = MODULE_CONTROLLER.get_class(mod[0])
logging.debug("Initializing class name: %s", mod_class.__name__)
@@ -338,21 +328,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
-
- for k, v in dynamic_data['ebuild'].metadata.items():
- if not isinstance(v, basestring):
- continue
- m = NON_ASCII_RE.search(v)
- if m is not None:
- self.qatracker.add_error(
- "variable.invalidchar",
- "%s: %s variable contains non-ASCII "
- "character at position %s" %
- (dynamic_data['ebuild'].relative_path, k, m.start() + 1))
-
- if not dynamic_data['src_uri_error']:
- self.thirdparty.check(dynamic_data['ebuild'].metadata, dynamic_data['ebuild'].relative_path)
-
if dynamic_data['ebuild'].metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", dynamic_data['ebuild'].relative_path)
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-10 20:17 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-10 20:17 UTC (permalink / raw
To: gentoo-commits
commit: cece35a90acbbf960ee93893038cccb1a36a9c11
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:31:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 20:15:08 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=cece35a9
scanner.py: Migrate another metadata check to ebuild_metadata
pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
pym/repoman/scanner.py | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ if ebuild.metadata.get("PROVIDE"):
+ self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
return {'continue': False}
@property
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e6a17cd..46f46f5 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,8 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['ebuild'].metadata.get("PROVIDE"):
- self.qatracker.add_error("virtual.oldstyle", dynamic_data['ebuild'].relative_path)
for pos, missing_var in enumerate(missingvars):
if not dynamic_data['ebuild'].metadata.get(missing_var):
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-10 3:26 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-10 3:26 UTC (permalink / raw
To: gentoo-commits
commit: 2df2c8204bcb6f54b3cbc7f22951fdcb897ac34f
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:31:26 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 03:23:50 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2df2c820
scanner.py: Migrate another metadata check to ebuild_metadata
pym/repoman/modules/scan/metadata/ebuild_metadata.py | 3 +++
pym/repoman/scanner.py | 2 --
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 143a40e..2dc1db2 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -28,6 +28,9 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ if ebuild.metadata.get("PROVIDE"):
+ self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+
return {'continue': False}
@property
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index e6a17cd..46f46f5 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,8 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
- if dynamic_data['ebuild'].metadata.get("PROVIDE"):
- self.qatracker.add_error("virtual.oldstyle", dynamic_data['ebuild'].relative_path)
for pos, missing_var in enumerate(missingvars):
if not dynamic_data['ebuild'].metadata.get(missing_var):
^ permalink raw reply related [flat|nested] 37+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/
@ 2016-01-10 3:26 Brian Dolbec
0 siblings, 0 replies; 37+ messages in thread
From: Brian Dolbec @ 2016-01-10 3:26 UTC (permalink / raw
To: gentoo-commits
commit: 9f58a4fc9e62c30f02c1284e8e0ae7af361c6f78
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 3 11:56:25 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Sun Jan 10 03:23:50 2016 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=9f58a4fc
repoman: Migrate more metadata checks to ebuild_metadata.py
.../modules/scan/metadata/ebuild_metadata.py | 32 ++++++++++++++++++++--
pym/repoman/scanner.py | 17 ------------
2 files changed, 30 insertions(+), 19 deletions(-)
diff --git a/pym/repoman/modules/scan/metadata/ebuild_metadata.py b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
index 2dc1db2..77c947e 100644
--- a/pym/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/pym/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -5,6 +5,8 @@
import re
import sys
+from repoman.qa_data import missingvars
+
if sys.hexversion >= 0x3000000:
basestring = str
@@ -16,7 +18,7 @@ class EbuildMetadata(object):
def __init__(self, **kwargs):
self.qatracker = kwargs.get('qatracker')
- def check(self, **kwargs):
+ def invalidchar(self, **kwargs):
ebuild = kwargs.get('ebuild')
for k, v in ebuild.metadata.items():
if not isinstance(v, basestring):
@@ -28,9 +30,35 @@ class EbuildMetadata(object):
"%s: %s variable contains non-ASCII "
"character at position %s" %
(ebuild.relative_path, k, m.start() + 1))
+ return {'continue': False}
+
+ def missing(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ for pos, missing_var in enumerate(missingvars):
+ if not ebuild.metadata.get(missing_var):
+ if kwargs.get('catdir') == "virtual" and \
+ missing_var in ("HOMEPAGE", "LICENSE"):
+ continue
+ if kwargs.get('live_ebuild') and missing_var == "KEYWORDS":
+ continue
+ myqakey = missingvars[pos] + ".missing"
+ self.qatracker.add_error(myqakey, '%s/%s.ebuild'
+ % (kwargs.get('xpkg'), kwargs.get('y_ebuild')))
+ return {'continue': False}
+
+ def old_virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
if ebuild.metadata.get("PROVIDE"):
self.qatracker.add_error("virtual.oldstyle", ebuild.relative_path)
+ return {'continue': False}
+ def virtual(self, **kwargs):
+ ebuild = kwargs.get('ebuild')
+ if kwargs.get('catdir') == "virtual":
+ for var in ("HOMEPAGE", "LICENSE"):
+ if ebuild.metadata.get(var):
+ myqakey = var + ".virtual"
+ self.qatracker.add_error(myqakey, ebuild.relative_path)
return {'continue': False}
@property
@@ -39,4 +67,4 @@ class EbuildMetadata(object):
@property
def runInEbuilds(self):
- return (True, [self.check])
+ return (True, [self.invalidchar, self.missing, self.old_virtual, self.virtual])
diff --git a/pym/repoman/scanner.py b/pym/repoman/scanner.py
index 46f46f5..d42fd33 100644
--- a/pym/repoman/scanner.py
+++ b/pym/repoman/scanner.py
@@ -324,23 +324,6 @@ class Scanner(object):
if y_ebuild_continue:
continue
-
- for pos, missing_var in enumerate(missingvars):
- if not dynamic_data['ebuild'].metadata.get(missing_var):
- if dynamic_data['catdir'] == "virtual" and \
- missing_var in ("HOMEPAGE", "LICENSE"):
- continue
- if dynamic_data['live_ebuild'] and missing_var == "KEYWORDS":
- continue
- myqakey = missingvars[pos] + ".missing"
- self.qatracker.add_error(myqakey, xpkg + "/" + y_ebuild + ".ebuild")
-
- if dynamic_data['catdir'] == "virtual":
- for var in ("HOMEPAGE", "LICENSE"):
- if dynamic_data['ebuild'].metadata.get(var):
- myqakey = var + ".virtual"
- self.qatracker.add_error(myqakey, dynamic_data['ebuild'].relative_path)
-
if dynamic_data['live_ebuild'] and self.repo_settings.repo_config.name == "gentoo":
self.liveeclasscheck.check(
dynamic_data['pkg'], xpkg, dynamic_data['ebuild'], y_ebuild, dynamic_data['ebuild'].keywords, self.repo_metadata['pmaskdict'])
^ permalink raw reply related [flat|nested] 37+ messages in thread
end of thread, other threads:[~2016-05-14 18:34 UTC | newest]
Thread overview: 37+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-29 5:01 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/modules/scan/metadata/ Brian Dolbec
-- strict thread matches above, loose matches on Subject: below --
2016-05-14 18:33 Brian Dolbec
2016-05-08 21:21 Brian Dolbec
2016-05-03 9:33 Brian Dolbec
2016-05-03 9:33 Brian Dolbec
2016-04-25 15:32 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-11 0:41 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-01-31 20:03 Brian Dolbec
2016-01-30 8:00 Brian Dolbec
2016-01-30 6:58 Brian Dolbec
2016-01-30 6:58 Brian Dolbec
2016-01-29 5:01 Brian Dolbec
2016-01-29 5:01 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-23 1:42 Brian Dolbec
2016-01-23 1:42 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-11 8:01 Brian Dolbec
2016-01-11 8:01 Brian Dolbec
2016-01-11 8:01 Brian Dolbec
2016-01-11 6:31 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 3:26 Brian Dolbec
2016-01-10 3:26 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox