diff options
-rw-r--r-- | README.rst | 41 | ||||
-rw-r--r-- | completion/zsh/_pkgcheck | 1 | ||||
-rw-r--r-- | src/pkgcheck/base.py | 13 | ||||
-rw-r--r-- | src/pkgcheck/plugins/pkgcheck_configurables.py | 1 | ||||
-rw-r--r-- | src/pkgcheck/scripts/pkgcheck.py | 67 |
5 files changed, 1 insertions, 122 deletions
@@ -61,47 +61,6 @@ Configuration No configuration is required, but some configuration makes ``pkgcheck`` easier to use. -Suites ------- - -With no configuration it will try to guess the repository to use based -on your working directory and the list of repositories pkgcore knows -about. This will usually not quite work because the same location -often has multiple "repositories" with a slightly different -configuration and ``pkgcheck`` cannot guess which one to use. - -Defining "suites" in the configuration solves this ambiguity. A -"suite" contains a target repository, optionally a source repository -to use as a base and optionally a set of checks to run. If there is a -single suite with a target repository containing the current directory -it is used. So with the following suite definition in -``~/.config/pkgcore/pkgcore.conf``:: - - [pkgcheck-gentoo-suite] - class=pkgcheck.base.Suite - target_repo=gentoo - -you can run ``pkgcheck scan`` with no further arguments inside your portage -directory and it will do the right thing. - -Make sure the target repo properly specifies its masters in -metadata/layout.conf if it's meant to be an overlay, otherwise many errors are -likely to be produced relating to missing licenses, categories, dependencies, -etc. - -Finally, you can define a different checkset per suite:: - - [pkgcheck-gentoo-suite] - class=pkgcheck.base.Suite - target_repo=gentoo - checkset=no-arch-checks - -This disables checks that are not interesting unless you can set -stable keywords for this suite. See Checksets_ for more information. - -Instead of relying on the working directory to pick the right suite -you can specify one explicitly with ``pkgcheck scan -s/--suite``. - Checksets --------- diff --git a/completion/zsh/_pkgcheck b/completion/zsh/_pkgcheck index 7f8bd1f4..7cbaf596 100644 --- a/completion/zsh/_pkgcheck +++ b/completion/zsh/_pkgcheck @@ -53,7 +53,6 @@ case $state in scan_opts=( {'(--repo)-r','(-r)--repo'}'[repo to pull packages from]:repo:_repos' {'(--reporter)-R','(-R)--reporter'}"[use a non-default reporter (defined in pkgcore's config)]" - {'(--suite)-s','(-s)--suite'}'[specify the configuration suite to use]' ) check_opts=( diff --git a/src/pkgcheck/base.py b/src/pkgcheck/base.py index 71db0ad9..567ace11 100644 --- a/src/pkgcheck/base.py +++ b/src/pkgcheck/base.py @@ -483,19 +483,6 @@ class Scope(object): return list(c for c in checks if c.scope in self.scopes) -class Suite(object): - - pkgcore_config_type = ConfigHint({ - 'target_repo': 'ref:repo', - 'checkset': 'ref:pkgcheck_checkset'}, - typename='pkgcheck_suite' - ) - - def __init__(self, target_repo, checkset=None): - self.target_repo = target_repo - self.checkset = checkset - - class StreamHeader(object): def __init__(self, checks, criteria): diff --git a/src/pkgcheck/plugins/pkgcheck_configurables.py b/src/pkgcheck/plugins/pkgcheck_configurables.py index 880c9b7c..e924cae4 100644 --- a/src/pkgcheck/plugins/pkgcheck_configurables.py +++ b/src/pkgcheck/plugins/pkgcheck_configurables.py @@ -11,6 +11,5 @@ pkgcore_plugins = { reporters.multiplex_reporter, base.Whitelist, base.Blacklist, - base.Suite, ], } diff --git a/src/pkgcheck/scripts/pkgcheck.py b/src/pkgcheck/scripts/pkgcheck.py index a4565301..7daab9d8 100644 --- a/src/pkgcheck/scripts/pkgcheck.py +++ b/src/pkgcheck/scripts/pkgcheck.py @@ -50,8 +50,6 @@ subparsers = argparser.add_subparsers(description="check applets", default='scan # These are all set based on other options, so have no default setting. scan = subparsers.add_parser('scan', description='scan targets for QA issues') scan.set_defaults(repo_bases=[]) -scan.set_defaults(guessed_suite=False) -scan.set_defaults(default_suite=False) scan.add_argument( 'targets', metavar='TARGET', nargs='*', help='optional target atom(s)') @@ -68,10 +66,6 @@ main_options.add_argument( ACCEPT_LICENSE, and package.mask. """) main_options.add_argument( - '-s', '--suite', action=commandline.StoreConfigObject, - config_type='pkgcheck_suite', - help='specify the configuration suite to use') -main_options.add_argument( '-R', '--reporter', action='store', default=None, help='use a non-default reporter', docs=""" @@ -155,60 +149,8 @@ def _validate_args(parser, namespace): namespace.enabled_keywords = list(_known_keywords) cwd = abspath(os.getcwd()) - if namespace.suite is None: - # No suite explicitly specified. Use the repo to guess the suite. - if namespace.target_repo is None: - # Not specified either. Try to find a repo our cwd is in. - # The use of a dict here is a hack to deal with one - # repo having multiple names in the configuration. - candidates = {} - for name, suite in namespace.config.pkgcheck_suite.items(): - repo = suite.target_repo - if repo is None: - continue - repo_base = getattr(repo, 'location', None) - if repo_base is not None and cwd.startswith(repo_base): - candidates[repo] = name - if len(candidates) == 1: - namespace.guessed_suite = True - namespace.target_repo = tuple(candidates)[0] - if namespace.target_repo is not None: - # We have a repo, now find a suite matching it. - candidates = list( - suite for suite in namespace.config.pkgcheck_suite.values() - if suite.target_repo is namespace.target_repo) - if len(candidates) == 1: - namespace.guessed_suite = True - namespace.suite = candidates[0] - if namespace.suite is None: - # If we have multiple candidates or no candidates we - # fall back to the default suite. - namespace.suite = namespace.config.get_default('pkgcheck_suite') - namespace.default_suite = namespace.suite is not None - if namespace.suite is not None: - # We have a suite. Lift defaults from it for values that - # were not set explicitly: - if namespace.checkset is None: - namespace.checkset = namespace.suite.checkset - # If we were called with no atoms we want to force - # cwd-based detection. - if namespace.target_repo is None: - if namespace.targets: - namespace.target_repo = namespace.suite.target_repo - elif namespace.suite.target_repo is not None: - # No atoms were passed in, so we want to guess - # what to scan based on cwd below. That only makes - # sense if we are inside the target repo. We still - # want to pick the suite's target repo if we are - # inside it, in case there is more than one repo - # definition with a base that contains our dir. - repo_base = getattr(namespace.suite.target_repo, 'location', None) - if repo_base is not None and cwd.startswith(repo_base): - namespace.target_repo = namespace.suite.target_repo - if namespace.target_repo is None: - # We have no target repo (not explicitly passed, not from a suite, not - # from an earlier guess at the target_repo) so try to guess one. + # we have no target repo so try to guess one target_repo = None target_dir = cwd @@ -427,13 +369,6 @@ def _scan(options, out, err): 'Warning: could not determine repo base for profiles, some checks will not work.') err.write() - if options.guessed_suite: - if options.default_suite: - err.write('Tried to guess a suite to use but got multiple matches') - err.write('and fell back to the default.') - else: - err.write('using suite guessed from working directory') - try: reporter = options.reporter( out, keywords=options.filtered_keywords, verbosity=options.verbosity) |