commit: 953b4649f95d188a860de0ee3d48fbe762445925 Author: Magnus Granberg <zorry <AT> gentoo <DOT> org> AuthorDate: Mon Aug 10 20:03:07 2015 +0000 Commit: Magnus Granberg <zorry <AT> gentoo <DOT> org> CommitDate: Mon Aug 10 20:03:07 2015 +0000 URL: https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=953b4649
update more repoman files pym/tbc/repoman/_portage.py | 2 +- pym/tbc/repoman/_xml.py | 6 ++--- pym/tbc/repoman/argparser.py | 16 +++++++++--- pym/tbc/repoman/check_missingslot.py | 29 ++++++++++++++++++++++ pym/tbc/repoman/checks/ebuilds/eclasses/ruby.py | 2 +- pym/tbc/repoman/checks/ebuilds/keywords.py | 8 +++--- .../checks/ebuilds/variables/description.py | 2 +- .../repoman/checks/ebuilds/variables/restrict.py | 4 +-- pym/tbc/repoman/metadata.py | 5 +++- pym/tbc/repoman/modules/commit/repochecks.py | 4 +-- pym/tbc/repoman/qa_data.py | 8 ++++-- pym/tbc/repoman/qa_tracker.py | 2 +- pym/tbc/repoman/utilities.py | 15 +++++------ 13 files changed, 75 insertions(+), 28 deletions(-) diff --git a/pym/tbc/repoman/_portage.py b/pym/tbc/repoman/_portage.py index 4aacedc..0f611f7 100644 --- a/pym/tbc/repoman/_portage.py +++ b/pym/tbc/repoman/_portage.py @@ -9,7 +9,7 @@ and not listed in those subsequent portage imports. All modules should import portage from this one -from tbc.repoman._portage import portage +from repoman._portage import portage Then continue to import the remaining portage modules needed ''' diff --git a/pym/tbc/repoman/_xml.py b/pym/tbc/repoman/_xml.py index 16bc76f..7bf6698 100644 --- a/pym/tbc/repoman/_xml.py +++ b/pym/tbc/repoman/_xml.py @@ -3,14 +3,14 @@ import sys import xml # import our initialized portage instance -from tbc.repoman._portage import portage +from repoman._portage import portage from portage import os from portage.output import red from portage.process import find_binary -from tbc.repoman.metadata import fetch_metadata_dtd -from tbc.repoman._subprocess import repoman_getstatusoutput +from repoman.metadata import fetch_metadata_dtd +from repoman._subprocess import repoman_getstatusoutput class _XMLParser(xml.etree.ElementTree.XMLParser): diff --git a/pym/tbc/repoman/argparser.py b/pym/tbc/repoman/argparser.py index 1b85cc3..1c9bd45 100644 --- a/pym/tbc/repoman/argparser.py +++ b/pym/tbc/repoman/argparser.py @@ -8,7 +8,7 @@ import logging import sys # import our initialized portage instance -from tbc.repoman._portage import portage +from repoman._portage import portage from portage import util from portage.util._argparse import ArgumentParser @@ -97,6 +97,11 @@ def parse_args(argv, qahelp, repoman_default_opts): help='Commit with QA violations') parser.add_argument( + '-S', '--straight-to-stable', dest='straight_to_stable', + default=False, action='store_true', + help='Allow committing straight to stable') + + parser.add_argument( '--vcs', dest='vcs', help='Force using specific VCS instead of autodetection') @@ -110,7 +115,8 @@ def parse_args(argv, qahelp, repoman_default_opts): parser.add_argument( '-x', '--xmlparse', dest='xml_parse', action='store_true', - default=False, help='forces the metadata.xml parse check to be carried out') + default=False, + help='forces the metadata.xml parse check to be carried out') parser.add_argument( '--if-modified', choices=('y', 'n'), default='n', @@ -119,7 +125,8 @@ def parse_args(argv, qahelp, repoman_default_opts): parser.add_argument( '-i', '--ignore-arches', dest='ignore_arches', action='store_true', - default=False, help='ignore arch-specific failures (where arch != host)') + default=False, + help='ignore arch-specific failures (where arch != host)') parser.add_argument( "--ignore-default-opts", @@ -128,7 +135,8 @@ def parse_args(argv, qahelp, repoman_default_opts): parser.add_argument( '-I', '--ignore-masked', dest='ignore_masked', action='store_true', - default=False, help='ignore masked packages (not allowed with commit mode)') + default=False, + help='ignore masked packages (not allowed with commit mode)') parser.add_argument( '--include-arches', diff --git a/pym/tbc/repoman/check_missingslot.py b/pym/tbc/repoman/check_missingslot.py new file mode 100644 index 0000000..3f79435 --- /dev/null +++ b/pym/tbc/repoman/check_missingslot.py @@ -0,0 +1,29 @@ +# repoman: missing slot check +# Copyright 2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +"""This module contains the check used to find missing slot values +in dependencies.""" + +from portage.eapi import eapi_has_slot_operator + +def check_missingslot(atom, mytype, eapi, portdb, qatracker, relative_path, my_aux): + # If no slot or slot operator is specified in RDEP... + if (not atom.blocker and not atom.slot and not atom.slot_operator + and mytype == 'RDEPEND' and eapi_has_slot_operator(eapi)): + # Check whether it doesn't match more than one. + atom_matches = portdb.xmatch("match-all", atom) + dep_slots = frozenset( + portdb.aux_get(cpv, ['SLOT'])[0].split('/')[0] + for cpv in atom_matches) + + if len(dep_slots) > 1: + # See if it is a DEPEND as well. It's a very simple & dumb + # check but should suffice for catching it. + depend = my_aux['DEPEND'].split() + if atom not in depend: + return + + qatracker.add_error("dependency.missingslot", relative_path + + ": %s: '%s' matches more than one slot, please specify an explicit slot and/or use the := or :* slot operator" % + (mytype, atom)) diff --git a/pym/tbc/repoman/checks/ebuilds/eclasses/ruby.py b/pym/tbc/repoman/checks/ebuilds/eclasses/ruby.py index 03d6918..e8d36ea 100644 --- a/pym/tbc/repoman/checks/ebuilds/eclasses/ruby.py +++ b/pym/tbc/repoman/checks/ebuilds/eclasses/ruby.py @@ -3,7 +3,7 @@ Performs Ruby eclass checks ''' -from tbc.repoman.qa_data import ruby_deprecated +from repoman.qa_data import ruby_deprecated class RubyEclassChecks(object): diff --git a/pym/tbc/repoman/checks/ebuilds/keywords.py b/pym/tbc/repoman/checks/ebuilds/keywords.py index bec7a1d..235c751 100644 --- a/pym/tbc/repoman/checks/ebuilds/keywords.py +++ b/pym/tbc/repoman/checks/ebuilds/keywords.py @@ -7,11 +7,12 @@ Perform KEYWORDS related checks class KeywordChecks(object): '''Perform checks on the KEYWORDS of an ebuild''' - def __init__(self, qatracker): + def __init__(self, qatracker, options): ''' @param qatracker: QATracker instance ''' self.qatracker = qatracker + self.options = options self.slot_keywords = {} def prepare(self): @@ -35,8 +36,9 @@ class KeywordChecks(object): @param kwlist: A list of all global keywords. @param profiles: A list of all profiles. ''' - self._checkAddedWithStableKeywords( - package, ebuild, y_ebuild, keywords, changed) + if not self.options.straight_to_stable: + self._checkAddedWithStableKeywords( + package, ebuild, y_ebuild, keywords, changed) self._checkForDroppedKeywords( pkg, ebuild, ebuild_archs, live_ebuild) diff --git a/pym/tbc/repoman/checks/ebuilds/variables/description.py b/pym/tbc/repoman/checks/ebuilds/variables/description.py index e25217c..a2b1057 100644 --- a/pym/tbc/repoman/checks/ebuilds/variables/description.py +++ b/pym/tbc/repoman/checks/ebuilds/variables/description.py @@ -3,7 +3,7 @@ Perform checks on the DESCRIPTION variable. ''' -from tbc.repoman.qa_data import max_desc_len +from repoman.qa_data import max_desc_len class DescriptionChecks(object): diff --git a/pym/tbc/repoman/checks/ebuilds/variables/restrict.py b/pym/tbc/repoman/checks/ebuilds/variables/restrict.py index 4c46a8a..215b792 100644 --- a/pym/tbc/repoman/checks/ebuilds/variables/restrict.py +++ b/pym/tbc/repoman/checks/ebuilds/variables/restrict.py @@ -4,9 +4,9 @@ Perform checks on the RESTRICT variable. ''' # import our initialized portage instance -from tbc.repoman._portage import portage +from repoman._portage import portage -from tbc.repoman.qa_data import valid_restrict +from repoman.qa_data import valid_restrict class RestrictChecks(object): diff --git a/pym/tbc/repoman/metadata.py b/pym/tbc/repoman/metadata.py index ed61620..f2b63a7 100644 --- a/pym/tbc/repoman/metadata.py +++ b/pym/tbc/repoman/metadata.py @@ -12,7 +12,7 @@ except ImportError: # import our initialized portage instance -from tbc.repoman._portage import portage +from repoman._portage import portage from portage import exception from portage import os @@ -21,6 +21,9 @@ from portage.output import green if sys.hexversion >= 0x3000000: basestring = str +if sys.hexversion >= 0x3000000: + basestring = str + metadata_xml_encoding = 'UTF-8' metadata_xml_declaration = '<?xml version="1.0" encoding="%s"?>' \ % (metadata_xml_encoding,) diff --git a/pym/tbc/repoman/modules/commit/repochecks.py b/pym/tbc/repoman/modules/commit/repochecks.py index a5ede23..2839864 100644 --- a/pym/tbc/repoman/modules/commit/repochecks.py +++ b/pym/tbc/repoman/modules/commit/repochecks.py @@ -1,8 +1,8 @@ from portage.output import red -from tbc.repoman.errors import err -from tbc.repoman.vcs.vcs import detect_vcs_conflicts +from repoman.errors import err +from repoman.vcs.vcs import detect_vcs_conflicts def commit_check(repolevel, reposplit): diff --git a/pym/tbc/repoman/qa_data.py b/pym/tbc/repoman/qa_data.py index 34a51b7..b262992 100644 --- a/pym/tbc/repoman/qa_data.py +++ b/pym/tbc/repoman/qa_data.py @@ -4,7 +4,7 @@ import logging from _emerge.Package import Package # import our initialized portage instance -from tbc.repoman._portage import portage +from repoman._portage import portage # 14 is the length of DESCRIPTION="" max_desc_len = 100 @@ -45,6 +45,9 @@ qahelp = { "dependency.badtilde": ( "Uses the ~ dep operator with a non-zero revision part," " which is useless (the revision is ignored)"), + "dependency.missingslot": ( + "RDEPEND matches more than one SLOT but does not specify a " + "slot and/or use the := or :* slot operator"), "dependency.perlcore": ( "This ebuild directly depends on a package in perl-core;" " it should use the corresponding virtual instead."), @@ -237,6 +240,7 @@ qawarnings = set(( "dependency.badindev", "dependency.badmaskedindev", "dependency.badtilde", + "dependency.missingslot", "dependency.perlcore", "DESCRIPTION.toolong", "EAPI.deprecated", @@ -278,7 +282,7 @@ allvars = sorted(allvars) for x in missingvars: x += ".missing" if x not in qacats: - logging.warn('* missingvars values need to be added to qahelp ("%s")' % x) + logging.warning('* missingvars values need to be added to qahelp ("%s")' % x) qacats.append(x) qawarnings.add(x) diff --git a/pym/tbc/repoman/qa_tracker.py b/pym/tbc/repoman/qa_tracker.py index 2513c7e..9bfe0e2 100644 --- a/pym/tbc/repoman/qa_tracker.py +++ b/pym/tbc/repoman/qa_tracker.py @@ -2,7 +2,7 @@ import logging import sys -from tbc.repoman.qa_data import qacats, qawarnings +from repoman.qa_data import qacats, qawarnings class QATracker(object): diff --git a/pym/tbc/repoman/utilities.py b/pym/tbc/repoman/utilities.py index b6ed825..2a1f4d9 100644 --- a/pym/tbc/repoman/utilities.py +++ b/pym/tbc/repoman/utilities.py @@ -32,7 +32,7 @@ import difflib from tempfile import mkstemp # import our initialized portage instance -from tbc.repoman._portage import portage +from repoman._portage import portage from portage import os from portage import shutil @@ -44,7 +44,7 @@ from portage.localization import _ from portage.process import find_binary from portage.output import green -from tbc.repoman.copyrights import update_copyright, update_copyright_year +from repoman.copyrights import update_copyright, update_copyright_year normalize_path = util.normalize_path @@ -172,7 +172,7 @@ def editor_is_executable(editor): return os.access(filename, os.X_OK) and os.path.isfile(filename) -def get_commit_message_with_editor(editor, message=None): +def get_commit_message_with_editor(editor, message=None, prefix=""): """ Execute editor with a temporary file as it's argument and return the file content afterwards. @@ -181,6 +181,8 @@ def get_commit_message_with_editor(editor, message=None): @type: string @param message: An iterable of lines to show in the editor. @type: iterable + @param prefix: Suggested prefix for the commit message summary line. + @type: string @rtype: string or None @return: A string on success or None if an error occurs. """ @@ -188,7 +190,8 @@ def get_commit_message_with_editor(editor, message=None): try: os.write( fd, _unicode_encode(_( - "\n# Please enter the commit message " + prefix + + "\n\n# Please enter the commit message " "for your changes.\n# (Comment lines starting " "with '#' will not be included)\n"), encoding=_encodings['content'], errors='backslashreplace')) @@ -240,7 +243,7 @@ def get_commit_message_with_stdin(): return commitmessage -def FindPortdir(settings, pkgdir): +def FindPortdir(settings): """ Try to figure out what repo we are in and whether we are in a regular tree or an overlay. @@ -276,8 +279,6 @@ def FindPortdir(settings, pkgdir): # the current working directory (from the shell). location = pwd - if not pkgdir is None: - location = pkgdir location = normalize_path(location) path_ids = {}