Changeset ferringb@gmail.com-20080624174510-lhr5h445saohpom9 in pkgcore-checks

Show
Ignore:
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:
30 modified

Legend:

Unmodified
Added
Removed
  • NEWS

    rferringb@gmail.com-20080318235545-ige2dsuh3lvmfp9m rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv  
    64640.3.3: 
    6565 
    66 * drop digest specific checks; portage now prunes digests on sync regardless  
     66* drop digest specific checks; portage now prunes digests on sync regardless 
    6767  of whether or not the repo is m2 pure; thus, no way to detect if a missing 
    6868  digest is actually a screwup in the repo, or if it's portage being 'special'. 
     
    102102* new PickleStream reporter; used to serialize check results, and flush the 
    103103  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 
    105105  reporter does, thus losing data). 
    106106* added new tool replay-pcheck-stream; used to replay a pickle stream through 
  • TODO

    rmarienz@gentoo.org-20061121201623-5bcc0f402b293d88 rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv  
    55- rework filter-env so it dumps a struct representing the parsing instead of 
    66  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 
    88  bash support for f() { echo "monkeys"; };x=f;${!x}; makes this potentially 
    99  likely to be a major false positive source. 
     
    1414- parallelize the bugger (potentially hard).  can probably thread it splitting 
    1515  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 
    1717  consumers are visibility and unported_mod_x 
  • pkgcore_checks/addons.py

    rjokey@gentoo.org-20071214152212-v6zsu5lmfb46rgng rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv  
    1313from pkgcore_checks import base, util 
    1414 
    15 from snakeoil import (demandload, currying, containers, mappings, iterables,  
     15from snakeoil import (demandload, currying, containers, mappings, iterables, 
    1616    lists) 
    1717demandload.demandload(globals(), 
     
    176176 
    177177        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 
    179179            (norm_name(y) for y in options.profiles_enabled) 
    180180            if x not in disabled) 
     
    185185                util.get_profiles_desc(options.profile_base_dir, 
    186186                    ignore_dev=options.profile_ignore_dev) 
    187              
     187 
    188188            for k, v in d.iteritems(): 
    189189                l = [x for x in map(norm_name, v) 
    190190                    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 
    193193                # get a profile twice 
    194194                enabled.difference_update(l) 
     
    203203                    "profile %s lacks arch settings, unable to use it" % x) 
    204204            arch_profiles.setdefault(p.arch, []).append((x, p)) 
    205              
     205 
    206206        for x in options.profiles_enabled: 
    207207            options.profile_func(x) 
     
    219219        self.keywords_filter = {} 
    220220        ignore_deprecated = self.options.profile_ignore_deprecated 
    221          
     221 
    222222        # we hold onto the profiles as we're going, due to the fact 
    223223        # profilenodes are weakly cached; hold onto all for this loop, 
     
    231231            stable_key = k.lstrip("~") 
    232232            unstable_key = "~"+ stable_key 
    233             stable_r = packages.PackageRestriction("keywords",  
     233            stable_r = packages.PackageRestriction("keywords", 
    234234                values.ContainmentMatch(stable_key)) 
    235             unstable_r = packages.PackageRestriction("keywords",  
     235            unstable_r = packages.PackageRestriction("keywords", 
    236236                values.ContainmentMatch(stable_key, unstable_key)) 
    237              
     237 
    238238            default_masked_use = [(packages.AlwaysTrue, (x,)) for x in 
    239239                self.official_arches if x != stable_key] 
    240              
     240 
    241241            profile_filters.update({stable_key:[], unstable_key:[]}) 
    242242            for profile_name in arch_profiles.get(k, []): 
     
    258258                    [(packages.AlwaysTrue, (stable_key,))], 
    259259                    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 
    262262                # unstable says it's not visible, stable doesn't try 
    263263                # if stable says something is visible, unstable doesn't try. 
     
    290290            self.keywords_filter[stable_key] = stable_r 
    291291            self.keywords_filter[unstable_key] = packages.PackageRestriction( 
    292                 "keywords",  
     292                "keywords", 
    293293                values.ContainmentMatch(unstable_key)) 
    294294 
     
    407407 
    408408    threshold = base.versioned_feed 
    409      
     409 
    410410    def __init__(self, pkg, attr, flags): 
    411411        base.Result.__init__(self) 
    412412        self._store_cpv(pkg) 
    413413        self.attr, self.flags = attr, tuple(flags) 
    414      
     414 
    415415    @property 
    416416    def short_desc(self): 
     
    452452            except IOError, ie: 
    453453                if ie.errno != errno.ENOENT: 
    454                     raise                
     454                    raise 
    455455 
    456456            use_expand_base = osutils.join(profile_base, "profiles", "desc") 
     
    459459                    try: 
    460460                        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 
    462462                            read_dict(osutils.join(use_expand_base, entry), 
    463463                                None).iterkeys()) 
     
    472472        self.specific_iuse = tuple((x[0], tuple(x[1])) for x in specific_iuse) 
    473473        self.collapsed_iuse = misc.non_incremental_collapsed_restrict_to_data( 
    474             ((packages.AlwaysTrue, known_iuse),),  
     474            ((packages.AlwaysTrue, known_iuse),), 
    475475            ((packages.AlwaysTrue, unstated_iuse),), 
    476476            self.specific_iuse) 
     
    493493            return currying.partial(self.use_validate, attr=attr_name) 
    494494        return self.use_validate 
    495          
     495 
    496496    @staticmethod 
    497497    def fake_use_validate(klasses, pkg, seq, reporter, attr=None): 
     
    508508        skip_filter = (packages.Conditional,) + klasses 
    509509        unstated = set() 
    510      
     510 
    511511        stated = self.iuse_strip(pkg.iuse) 
    512512        i = iterables.expandable_chain(lists.iflatten_instance(seq, 
  • pkgcore_checks/base.py

    rferringb@gmail.com-20070408202649-jgels0n569r8my90 rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv  
    175175        except NotImplementedError: 
    176176            return "result from %s" % self.__class__.__name__ 
    177      
     177 
    178178    @property 
    179179    def short_desc(self): 
     
    183183    def long_desc(self): 
    184184        return self.short_desc 
    185      
     185 
    186186    def _store_cp(self, pkg): 
    187187        self.category = pkg.category 
    188188        self.package = pkg.package 
    189      
     189 
    190190    def _store_cpv(self, pkg): 
    191191        self._store_cp(pkg) 
     
    201201                raise AttributeError(self.__class__, str(a)) 
    202202        return object.__getstate__(self) 
    203      
     203 
    204204    def __setstate__(self, data): 
    205205        attrs = set(getattr(self, '__attrs__', getattr(self, '__slots__', []))) 
     
    221221    def start_check(self, source, target): 
    222222        pass 
    223      
     223 
    224224    def end_check(self): 
    225225        pass 
  • pkgcore_checks/cleanup.py

    rferringb@gmail.com-20070408202649-jgels0n569r8my90 rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv  
    2929class RedundantVersionReport(Template): 
    3030    """ 
    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 
    3232    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. 
    3535    pkga-1 can potentially be removed. 
    3636    """ 
     
    4242        if len(pkgset) == 1: 
    4343            return 
    44          
     44 
    4545        # algo is roughly thus; spot stable versions, hunt for subset 
    4646        # keyworded pkgs that are less then the max version; 
  • pkgcore_checks/deprecated.py

    rferringb@gmail.com-20070213122704-diaydvzzeptt2vel rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv  
    77class DeprecatedEclass(Result): 
    88    """pkg uses an eclass that is deprecated/abandoned""" 
    9      
     9 
    1010    __slots__ = ("category", "package", "version", "eclasses") 
    1111    threshold = versioned_feed 
    12      
     12 
    1313    def __init__(self, pkg, eclasses): 
    1414        Result.__init__(self) 
  • pkgcore_checks/dropped_keywords.py

    rjokey@gentoo.org-20071214152518-f29y8pyqvxilpohs rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv  
    5757            state = oldstate 
    5858            lastpkg = pkg 
    59   
     59 
    6060        for key, pkg in dropped: 
    6161            reporter.add_report(DroppedKeywordWarning(key, pkg)) 
  • pkgcore_checks/glsa_scan.py

    rferringb@gmail.com-20070405184154-1nqu8pvp0wnm7zi3 rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv  
    66from pkgcore_checks import base 
    77from snakeoil.demandload import demandload 
    8 demandload(globals(),  
     8demandload(globals(), 
    99    'pkgcore.pkgsets.glsa:GlsaDirSet', 
    1010    'pkgcore.restrictions:packages,values', 
     
    3030                arches.update(x.lstrip("~") for x in v.restriction.vals) 
    3131            else: 
    32                 raise Exception("unexpected restriction sequence- %s in %s" %  
     32                raise Exception("unexpected restriction sequence- %s in %s" % 
    3333                    (v.restriction, glsa)) 
    3434        keys = set(x.lstrip("~") for x in pkg.keywords if not x.startswith("-")) 
     
    3939            self.arch = tuple(sorted(keys)) 
    4040        self.glsa = str(glsa) 
    41      
     41 
    4242    @property 
    4343    def short_desc(self): 
     
    4848    """ 
    4949    Scan for vulnerabile ebuilds in the tree 
    50      
     50 
    5151    requires a GLSA directory for vuln. info 
    5252    """ 
     
    113113        for r in GlsaDirSet(self.glsa_dir): 
    114114            if len(r) > 2: 
    115                 self.vulns.setdefault(r[0].key,  
     115                self.vulns.setdefault(r[0].key, 
    116116                    []).append(packages.AndRestriction(*r[1:])) 
    117117            else: 
  • pkgcore_checks/imlate.py

    rferringb@gmail.com-20070207174621-yb3eqrqc6jtmdgse rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv  
    99 
    1010    """Arch that is behind another from a stabling standpoint""" 
    11      
     11 
    1212    __slots__ = ("category", "package", "version", "keywords", 
    1313        "stable") 
    1414    threshold = base.versioned_feed 
    15      
     15 
    1616    def __init__(self, pkg, keywords): 
    1717        base.Result.__init__(self) 
     
    2020        self.stable = tuple(str(x) for x in pkg.keywords 
    2121            if not x[0] in ("~", "-")) 
    22      
     22 
    2323    @property 
    2424    def short_desc(self): 
     
    3030 
    3131    """ 
    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 
    3333    other arches 
    3434    """ 
     
    5151        base.Template.__init__(self, options) 
    5252        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("~") 
    5454            for x in arches) 
    55         self.source_arches = frozenset(x.lstrip("~")  
     55        self.source_arches = frozenset(x.lstrip("~") 
    5656            for x in options.reference_arches) 
    5757        self.source_filter = packages.PackageRestriction("keywords", 
  • pkgcore_checks/metadata_checks.py

    rjokey@gentoo.org-20071230125611-5bk03uu70wtw86bk rferringb@gmail.com-20080624174036-q45fk4fxguj9kjlv  
    2222    __slots__ = ("category", "package", "version", "attr", "msg") 
    2323    threshold = base.versioned_feed 
    24      
     24 
    2525    def __init__(self, pkg, attr, msg): 
    2626        base.Result.__init__(self) 
    2727        self._store_cpv(pkg) 
    2828        self.attr, self.msg = attr, str(msg) 
    29      
     29 
    3030    @property 
    3131    def short_desc(self): 
     
    3838    __slots__ = ("category", "package", "version", "licenses") 
    3939    threshold = base.versioned_feed 
    40      
     40 
    4141    def __init__(self, pkg, licenses): 
    4242        self._store_cpv(pkg) 
    4343        self.licenses = tuple(sorted(licenses)) 
    44      
     44 
    4545    @property 
    4646    def short_desc(self): 
     
    5757 
    5858    required_addons = (addons.UseAddon, addons.ProfileAddon, 
    59         addons.LicenseAddon)  
     59        addons.LicenseAddon) 
    6060 
    6161    def __init__(self, options, iuse_handler, profiles, licenses): 
     
    7676            raise 
    7777        except (MetadataException, MalformedAtom, ValueError), e: 
    78             reporter.add_report(MetadataError(pkg, 'license',  
     78            reporter.add_report(MetadataError(pkg, 'license', 
    7979                "error- %s" % e)) 
    8080            del e 
     
    8282            logging.exception("unknown exception caught for pkg(%s) attr(%s): " 
    8383                "type(%s), %s" % (pkg, 'license', type(e), e)) 
    84             reporter.add_report(MetadataError(pkg, 'license',  
     84            reporter.add_report(MetadataError(pkg, 'license', 
    8585                "exception- %s" % e)) 
    8686            del e 
     
    120120                self.iuse_handler.allowed_iuse(pkg)) 
    121121            if iuse: 
    122                 reporter.add_report(MetadataError(pkg, "iuse",  
     122                reporter.add_report(MetadataError(pkg, "iuse", 
    123123                    "iuse unknown flags- [ %s ]" % ", ".join(iuse))) 
    124124 
     
    156156                raise 
    157157            except (MetadataException, MalformedAtom, ValueError), e: 
    158                 reporter.add_report(MetadataError(pkg, attr_name,  
     158                reporter.add_report(MetadataError(pkg, attr_name, 
    159159                    "error- %s" % e)) 
    160160                del e 
     
    163163                    "unknown exception caught for pkg(%s) attr(%s): " 
    164164                    "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, 
    166166                    "exception- %s" % e)) 
    167167                del e 
     
    177177        base.Result.__init__(self) 
    178178        self._store_cpv(pkg) 
    179      
     179 
    180180    short_desc = ("keywords contain -*; use package.mask or empty keywords " 
    181181        "instead") 
    182          
     182 
    183183 
    184184class KeywordsReport(base.Template): 
    185      
     185 
    186186    """ 
    187187    check pkgs keywords for sanity; empty keywords, and -* are flagged 
    188188    """ 
    189      
     189 
    190190    feed_type = base.versioned_feed 
    191191    known_results = (StupidKeywords, MetadataError) 
    192      
     192 
    193193    def feed(self, pkg, reporter): 
    194194        if "-*" in pkg.keywords and len(pkg.keywords) == 1: 
     
    205205        self._store_cpv(pkg) 
    206206        self.filename = filename 
    207      
     207 
    208208    @property 
    209209    def short_desc(self): 
    210210        return "file %s is unfetchable- no URI available, and RESTRICT=fetch " \ 
    211211            "isn't set" % self.filename 
    212      
     212 
    213213 
    214214class BadProto(base.Result): 
     
    222222        self.filename = filename 
    223223        self.bad_uri = tuple(sorted(bad_uri)) 
    224      
     224 
    225225    @property 
    226226    def short_desc(self): 
    227227        return "file %s: bad protocol/uri: %r " % (self.filename, self.bad_uri) 
    228      
     228 
    229229 
    230230class SrcUriReport(base.Template): 
     
    285285 
    286286class CrappyDescription(base.Result): 
    287      
     287 
    288288    """pkg's description sucks in some fashion""" 
    289289