Changeset ferringb@gmail.com-20080624174510-lhr5h445saohpom9 in pkgcore-checks
- Timestamp:
- 06/24/08 19:45:10 (5 months ago)
- Author:
- Brian Harring <ferringb@…>
- changesets:
* [changeset:ferringb@gmail.com-20080318235545-ige2dsuh3lvmfp9m]
* [changeset:ferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv]
- parent trees:
* source:@ferringb@gmail.com-20080318235545-ige2dsuh3lvmfp9m
* source:@ferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv
- branch-nick:
- pkgcore-checks
- Message:
-
whitespace cleanup
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
rferringb@gmail.com-20080318235545-ige2dsuh3lvmfp9m
|
rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv
|
|
| 64 | 64 | 0.3.3: |
| 65 | 65 | |
| 66 | | * drop digest specific checks; portage now prunes digests on sync regardless |
| | 66 | * drop digest specific checks; portage now prunes digests on sync regardless |
| 67 | 67 | of whether or not the repo is m2 pure; thus, no way to detect if a missing |
| 68 | 68 | digest is actually a screwup in the repo, or if it's portage being 'special'. |
| … |
… |
|
| 102 | 102 | * new PickleStream reporter; used to serialize check results, and flush the |
| 103 | 103 | stream out stdout. If you need to get at the data generated, this is the |
| 104 | | sanest way to do it (alternatives require trying to deserialize what a |
| | 104 | sanest way to do it (alternatives require trying to deserialize what a |
| 105 | 105 | reporter does, thus losing data). |
| 106 | 106 | * added new tool replay-pcheck-stream; used to replay a pickle stream through |
-
|
rmarienz@gentoo.org-20061121201623-5bcc0f402b293d88
|
rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv
|
|
| 5 | 5 | - rework filter-env so it dumps a struct representing the parsing instead of |
| 6 | 6 | doing it inline; add python bindings, use that for source flow analysis |
| 7 | | - look into trying to identify unused functions in an ebuild; eclasses, and |
| | 7 | - look into trying to identify unused functions in an ebuild; eclasses, and |
| 8 | 8 | bash support for f() { echo "monkeys"; };x=f;${!x}; makes this potentially |
| 9 | 9 | likely to be a major false positive source. |
| … |
… |
|
| 14 | 14 | - parallelize the bugger (potentially hard). can probably thread it splitting |
| 15 | 15 | it such that check x handles checks using globals x (cache mainly), other |
| 16 | | checks being bits that don't; gain may not be much since the major time |
| | 16 | checks being bits that don't; gain may not be much since the major time |
| 17 | 17 | consumers are visibility and unported_mod_x |
-
|
rjokey@gentoo.org-20071214152212-v6zsu5lmfb46rgng
|
rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv
|
|
| 13 | 13 | from pkgcore_checks import base, util |
| 14 | 14 | |
| 15 | | from snakeoil import (demandload, currying, containers, mappings, iterables, |
| | 15 | from snakeoil import (demandload, currying, containers, mappings, iterables, |
| 16 | 16 | lists) |
| 17 | 17 | demandload.demandload(globals(), |
| … |
… |
|
| 176 | 176 | |
| 177 | 177 | disabled = set(norm_name(x) for x in options.profiles_disabled) |
| 178 | | enabled = set(x for x in |
| | 178 | enabled = set(x for x in |
| 179 | 179 | (norm_name(y) for y in options.profiles_enabled) |
| 180 | 180 | if x not in disabled) |
| … |
… |
|
| 185 | 185 | util.get_profiles_desc(options.profile_base_dir, |
| 186 | 186 | ignore_dev=options.profile_ignore_dev) |
| 187 | | |
| | 187 | |
| 188 | 188 | for k, v in d.iteritems(): |
| 189 | 189 | l = [x for x in map(norm_name, v) |
| 190 | 190 | if not x in disabled] |
| 191 | | |
| 192 | | # wipe any enableds that are here already so we don't |
| | 191 | |
| | 192 | # wipe any enableds that are here already so we don't |
| 193 | 193 | # get a profile twice |
| 194 | 194 | enabled.difference_update(l) |
| … |
… |
|
| 203 | 203 | "profile %s lacks arch settings, unable to use it" % x) |
| 204 | 204 | arch_profiles.setdefault(p.arch, []).append((x, p)) |
| 205 | | |
| | 205 | |
| 206 | 206 | for x in options.profiles_enabled: |
| 207 | 207 | options.profile_func(x) |
| … |
… |
|
| 219 | 219 | self.keywords_filter = {} |
| 220 | 220 | ignore_deprecated = self.options.profile_ignore_deprecated |
| 221 | | |
| | 221 | |
| 222 | 222 | # we hold onto the profiles as we're going, due to the fact |
| 223 | 223 | # profilenodes are weakly cached; hold onto all for this loop, |
| … |
… |
|
| 231 | 231 | stable_key = k.lstrip("~") |
| 232 | 232 | unstable_key = "~"+ stable_key |
| 233 | | stable_r = packages.PackageRestriction("keywords", |
| | 233 | stable_r = packages.PackageRestriction("keywords", |
| 234 | 234 | values.ContainmentMatch(stable_key)) |
| 235 | | unstable_r = packages.PackageRestriction("keywords", |
| | 235 | unstable_r = packages.PackageRestriction("keywords", |
| 236 | 236 | values.ContainmentMatch(stable_key, unstable_key)) |
| 237 | | |
| | 237 | |
| 238 | 238 | default_masked_use = [(packages.AlwaysTrue, (x,)) for x in |
| 239 | 239 | self.official_arches if x != stable_key] |
| 240 | | |
| | 240 | |
| 241 | 241 | profile_filters.update({stable_key:[], unstable_key:[]}) |
| 242 | 242 | for profile_name in arch_profiles.get(k, []): |
| … |
… |
|
| 258 | 258 | [(packages.AlwaysTrue, (stable_key,))], |
| 259 | 259 | profile.forced_use.iteritems()) |
| 260 | | |
| 261 | | # used to interlink stable/unstable lookups so that if |
| | 260 | |
| | 261 | # used to interlink stable/unstable lookups so that if |
| 262 | 262 | # unstable says it's not visible, stable doesn't try |
| 263 | 263 | # if stable says something is visible, unstable doesn't try. |
| … |
… |
|
| 290 | 290 | self.keywords_filter[stable_key] = stable_r |
| 291 | 291 | self.keywords_filter[unstable_key] = packages.PackageRestriction( |
| 292 | | "keywords", |
| | 292 | "keywords", |
| 293 | 293 | values.ContainmentMatch(unstable_key)) |
| 294 | 294 | |
| … |
… |
|
| 407 | 407 | |
| 408 | 408 | threshold = base.versioned_feed |
| 409 | | |
| | 409 | |
| 410 | 410 | def __init__(self, pkg, attr, flags): |
| 411 | 411 | base.Result.__init__(self) |
| 412 | 412 | self._store_cpv(pkg) |
| 413 | 413 | self.attr, self.flags = attr, tuple(flags) |
| 414 | | |
| | 414 | |
| 415 | 415 | @property |
| 416 | 416 | def short_desc(self): |
| … |
… |
|
| 452 | 452 | except IOError, ie: |
| 453 | 453 | if ie.errno != errno.ENOENT: |
| 454 | | raise |
| | 454 | raise |
| 455 | 455 | |
| 456 | 456 | use_expand_base = osutils.join(profile_base, "profiles", "desc") |
| … |
… |
|
| 459 | 459 | try: |
| 460 | 460 | estr = entry.rsplit(".", 1)[0].lower()+ "_" |
| 461 | | unstated_iuse.update(estr + usef.strip() for usef in |
| | 461 | unstated_iuse.update(estr + usef.strip() for usef in |
| 462 | 462 | read_dict(osutils.join(use_expand_base, entry), |
| 463 | 463 | None).iterkeys()) |
| … |
… |
|
| 472 | 472 | self.specific_iuse = tuple((x[0], tuple(x[1])) for x in specific_iuse) |
| 473 | 473 | self.collapsed_iuse = misc.non_incremental_collapsed_restrict_to_data( |
| 474 | | ((packages.AlwaysTrue, known_iuse),), |
| | 474 | ((packages.AlwaysTrue, known_iuse),), |
| 475 | 475 | ((packages.AlwaysTrue, unstated_iuse),), |
| 476 | 476 | self.specific_iuse) |
| … |
… |
|
| 493 | 493 | return currying.partial(self.use_validate, attr=attr_name) |
| 494 | 494 | return self.use_validate |
| 495 | | |
| | 495 | |
| 496 | 496 | @staticmethod |
| 497 | 497 | def fake_use_validate(klasses, pkg, seq, reporter, attr=None): |
| … |
… |
|
| 508 | 508 | skip_filter = (packages.Conditional,) + klasses |
| 509 | 509 | unstated = set() |
| 510 | | |
| | 510 | |
| 511 | 511 | stated = self.iuse_strip(pkg.iuse) |
| 512 | 512 | i = iterables.expandable_chain(lists.iflatten_instance(seq, |
-
|
rferringb@gmail.com-20070408202649-jgels0n569r8my90
|
rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv
|
|
| 175 | 175 | except NotImplementedError: |
| 176 | 176 | return "result from %s" % self.__class__.__name__ |
| 177 | | |
| | 177 | |
| 178 | 178 | @property |
| 179 | 179 | def short_desc(self): |
| … |
… |
|
| 183 | 183 | def long_desc(self): |
| 184 | 184 | return self.short_desc |
| 185 | | |
| | 185 | |
| 186 | 186 | def _store_cp(self, pkg): |
| 187 | 187 | self.category = pkg.category |
| 188 | 188 | self.package = pkg.package |
| 189 | | |
| | 189 | |
| 190 | 190 | def _store_cpv(self, pkg): |
| 191 | 191 | self._store_cp(pkg) |
| … |
… |
|
| 201 | 201 | raise AttributeError(self.__class__, str(a)) |
| 202 | 202 | return object.__getstate__(self) |
| 203 | | |
| | 203 | |
| 204 | 204 | def __setstate__(self, data): |
| 205 | 205 | attrs = set(getattr(self, '__attrs__', getattr(self, '__slots__', []))) |
| … |
… |
|
| 221 | 221 | def start_check(self, source, target): |
| 222 | 222 | pass |
| 223 | | |
| | 223 | |
| 224 | 224 | def end_check(self): |
| 225 | 225 | pass |
-
|
rferringb@gmail.com-20070408202649-jgels0n569r8my90
|
rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv
|
|
| 29 | 29 | class RedundantVersionReport(Template): |
| 30 | 30 | """ |
| 31 | | scan for versions that are likely shadowed by later versions from a |
| | 31 | scan for versions that are likely shadowed by later versions from a |
| 32 | 32 | keywords standpoint (ignoring -9999 versioned packages) |
| 33 | | |
| 34 | | Example: pkga-1 is keyworded amd64, pkga-2 is amd64. |
| | 33 | |
| | 34 | Example: pkga-1 is keyworded amd64, pkga-2 is amd64. |
| 35 | 35 | pkga-1 can potentially be removed. |
| 36 | 36 | """ |
| … |
… |
|
| 42 | 42 | if len(pkgset) == 1: |
| 43 | 43 | return |
| 44 | | |
| | 44 | |
| 45 | 45 | # algo is roughly thus; spot stable versions, hunt for subset |
| 46 | 46 | # keyworded pkgs that are less then the max version; |
-
-
-
|
rferringb@gmail.com-20070405184154-1nqu8pvp0wnm7zi3
|
rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv
|
|
| 6 | 6 | from pkgcore_checks import base |
| 7 | 7 | from snakeoil.demandload import demandload |
| 8 | | demandload(globals(), |
| | 8 | demandload(globals(), |
| 9 | 9 | 'pkgcore.pkgsets.glsa:GlsaDirSet', |
| 10 | 10 | 'pkgcore.restrictions:packages,values', |
| … |
… |
|
| 30 | 30 | arches.update(x.lstrip("~") for x in v.restriction.vals) |
| 31 | 31 | else: |
| 32 | | raise Exception("unexpected restriction sequence- %s in %s" % |
| | 32 | raise Exception("unexpected restriction sequence- %s in %s" % |
| 33 | 33 | (v.restriction, glsa)) |
| 34 | 34 | keys = set(x.lstrip("~") for x in pkg.keywords if not x.startswith("-")) |
| … |
… |
|
| 39 | 39 | self.arch = tuple(sorted(keys)) |
| 40 | 40 | self.glsa = str(glsa) |
| 41 | | |
| | 41 | |
| 42 | 42 | @property |
| 43 | 43 | def short_desc(self): |
| … |
… |
|
| 48 | 48 | """ |
| 49 | 49 | Scan for vulnerabile ebuilds in the tree |
| 50 | | |
| | 50 | |
| 51 | 51 | requires a GLSA directory for vuln. info |
| 52 | 52 | """ |
| … |
… |
|
| 113 | 113 | for r in GlsaDirSet(self.glsa_dir): |
| 114 | 114 | if len(r) > 2: |
| 115 | | self.vulns.setdefault(r[0].key, |
| | 115 | self.vulns.setdefault(r[0].key, |
| 116 | 116 | []).append(packages.AndRestriction(*r[1:])) |
| 117 | 117 | else: |
-
|
rferringb@gmail.com-20070207174621-yb3eqrqc6jtmdgse
|
rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv
|
|
| 9 | 9 | |
| 10 | 10 | """Arch that is behind another from a stabling standpoint""" |
| 11 | | |
| | 11 | |
| 12 | 12 | __slots__ = ("category", "package", "version", "keywords", |
| 13 | 13 | "stable") |
| 14 | 14 | threshold = base.versioned_feed |
| 15 | | |
| | 15 | |
| 16 | 16 | def __init__(self, pkg, keywords): |
| 17 | 17 | base.Result.__init__(self) |
| … |
… |
|
| 20 | 20 | self.stable = tuple(str(x) for x in pkg.keywords |
| 21 | 21 | if not x[0] in ("~", "-")) |
| 22 | | |
| | 22 | |
| 23 | 23 | @property |
| 24 | 24 | def short_desc(self): |
| … |
… |
|
| 30 | 30 | |
| 31 | 31 | """ |
| 32 | | scan for ebuilds that can be stabled based upon stabling status for |
| | 32 | scan for ebuilds that can be stabled based upon stabling status for |
| 33 | 33 | other arches |
| 34 | 34 | """ |
| … |
… |
|
| 51 | 51 | base.Template.__init__(self, options) |
| 52 | 52 | arches = frozenset(x.strip().lstrip("~") for x in options.arches) |
| 53 | | self.target_arches = frozenset("~%s" % x.strip().lstrip("~") |
| | 53 | self.target_arches = frozenset("~%s" % x.strip().lstrip("~") |
| 54 | 54 | for x in arches) |
| 55 | | self.source_arches = frozenset(x.lstrip("~") |
| | 55 | self.source_arches = frozenset(x.lstrip("~") |
| 56 | 56 | for x in options.reference_arches) |
| 57 | 57 | self.source_filter = packages.PackageRestriction("keywords", |
-
|
rjokey@gentoo.org-20071230125611-5bk03uu70wtw86bk
|
rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv
|
|
| 22 | 22 | __slots__ = ("category", "package", "version", "attr", "msg") |
| 23 | 23 | threshold = base.versioned_feed |
| 24 | | |
| | 24 | |
| 25 | 25 | def __init__(self, pkg, attr, msg): |
| 26 | 26 | base.Result.__init__(self) |
| 27 | 27 | self._store_cpv(pkg) |
| 28 | 28 | self.attr, self.msg = attr, str(msg) |
| 29 | | |
| | 29 | |
| 30 | 30 | @property |
| 31 | 31 | def short_desc(self): |
| … |
… |
|
| 38 | 38 | __slots__ = ("category", "package", "version", "licenses") |
| 39 | 39 | threshold = base.versioned_feed |
| 40 | | |
| | 40 | |
| 41 | 41 | def __init__(self, pkg, licenses): |
| 42 | 42 | self._store_cpv(pkg) |
| 43 | 43 | self.licenses = tuple(sorted(licenses)) |
| 44 | | |
| | 44 | |
| 45 | 45 | @property |
| 46 | 46 | def short_desc(self): |
| … |
… |
|
| 57 | 57 | |
| 58 | 58 | required_addons = (addons.UseAddon, addons.ProfileAddon, |
| 59 | | addons.LicenseAddon) |
| | 59 | addons.LicenseAddon) |
| 60 | 60 | |
| 61 | 61 | def __init__(self, options, iuse_handler, profiles, licenses): |
| … |
… |
|
| 76 | 76 | raise |
| 77 | 77 | except (MetadataException, MalformedAtom, ValueError), e: |
| 78 | | reporter.add_report(MetadataError(pkg, 'license', |
| | 78 | reporter.add_report(MetadataError(pkg, 'license', |
| 79 | 79 | "error- %s" % e)) |
| 80 | 80 | del e |
| … |
… |
|
| 82 | 82 | logging.exception("unknown exception caught for pkg(%s) attr(%s): " |
| 83 | 83 | "type(%s), %s" % (pkg, 'license', type(e), e)) |
| 84 | | reporter.add_report(MetadataError(pkg, 'license', |
| | 84 | reporter.add_report(MetadataError(pkg, 'license', |
| 85 | 85 | "exception- %s" % e)) |
| 86 | 86 | del e |
| … |
… |
|
| 120 | 120 | self.iuse_handler.allowed_iuse(pkg)) |
| 121 | 121 | if iuse: |
| 122 | | reporter.add_report(MetadataError(pkg, "iuse", |
| | 122 | reporter.add_report(MetadataError(pkg, "iuse", |
| 123 | 123 | "iuse unknown flags- [ %s ]" % ", ".join(iuse))) |
| 124 | 124 | |
| … |
… |
|
| 156 | 156 | raise |
| 157 | 157 | except (MetadataException, MalformedAtom, ValueError), e: |
| 158 | | reporter.add_report(MetadataError(pkg, attr_name, |
| | 158 | reporter.add_report(MetadataError(pkg, attr_name, |
| 159 | 159 | "error- %s" % e)) |
| 160 | 160 | del e |
| … |
… |
|
| 163 | 163 | "unknown exception caught for pkg(%s) attr(%s): " |
| 164 | 164 | "type(%s), %s" % (pkg, attr_name, type(e), e)) |
| 165 | | reporter.add_report(MetadataError(pkg, attr_name, |
| | 165 | reporter.add_report(MetadataError(pkg, attr_name, |
| 166 | 166 | "exception- %s" % e)) |
| 167 | 167 | del e |
| … |
… |
|
| 177 | 177 | base.Result.__init__(self) |
| 178 | 178 | self._store_cpv(pkg) |
| 179 | | |
| | 179 | |
| 180 | 180 | short_desc = ("keywords contain -*; use package.mask or empty keywords " |
| 181 | 181 | "instead") |
| 182 | | |
| | 182 | |
| 183 | 183 | |
| 184 | 184 | class KeywordsReport(base.Template): |
| 185 | | |
| | 185 | |
| 186 | 186 | """ |
| 187 | 187 | check pkgs keywords for sanity; empty keywords, and -* are flagged |
| 188 | 188 | """ |
| 189 | | |
| | 189 | |
| 190 | 190 | feed_type = base.versioned_feed |
| 191 | 191 | known_results = (StupidKeywords, MetadataError) |
| 192 | | |
| | 192 | |
| 193 | 193 | def feed(self, pkg, reporter): |
| 194 | 194 | if "-*" in pkg.keywords and len(pkg.keywords) == 1: |
| … |
… |
|
| 205 | 205 | self._store_cpv(pkg) |
| 206 | 206 | self.filename = filename |
| 207 | | |
| | 207 | |
| 208 | 208 | @property |
| 209 | 209 | def short_desc(self): |
| 210 | 210 | return "file %s is unfetchable- no URI available, and RESTRICT=fetch " \ |
| 211 | 211 | "isn't set" % self.filename |
| 212 | | |
| | 212 | |
| 213 | 213 | |
| 214 | 214 | class BadProto(base.Result): |
| … |
… |
|
| 222 | 222 | self.filename = filename |
| 223 | 223 | self.bad_uri = tuple(sorted(bad_uri)) |
| 224 | | |
| | 224 | |
| 225 | 225 | @property |
| 226 | 226 | def short_desc(self): |
| 227 | 227 | return "file %s: bad protocol/uri: %r " % (self.filename, self.bad_uri) |
| 228 | | |
| | 228 | |
| 229 | 229 | |
| 230 | 230 | class SrcUriReport(base.Template): |
| … |
… |
|
| 285 | 285 | |
| 286 | 286 | class CrappyDescription(base.Result): |
| 287 | | |
| | 287 | |
| 288 | 288 | """pkg's description sucks in some fashion""" |
| 289 | 289 | |
|