Changeset 1799

Show
Ignore:
Timestamp:
07/12/10 18:13:41 (2 months ago)
Author:
scop
Message:

Choose built in config based on prefix used when invoked (Tom Callaway).

 https://bugzilla.redhat.com/show_bug.cgi?id=537430#c8

Location:
trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/rpmlint.1

    r1725 r1799  
    7979.SH FILES 
    8080.TP 
    81 \fB/usr/share/rpmlint/config\fR 
    82 Built-in configuration. 
     81\fB/usr/share/rpmlint/config\fR, \fB/usr/share/rpmlint/config.*\fR 
     82Built-in configuration.  When invoked as \fIsomeprefix\fR-rpmlint, 
     83/usr/share/rpmlint/config.\fIsomeprefix\fR is used if it exists, 
     84otherwise /usr/share/rpmlint/config. 
    8385.TP 
    8486\fB/etc/rpmlint/*config\fR 
  • trunk/rpmlint.py

    r1760 r1799  
    1515import locale 
    1616import os 
     17import re 
    1718import stat 
    1819import sys 
     
    263264configs = glob.glob('/etc/rpmlint/*config') 
    264265configs.sort() 
    265 configs.insert(0, '/usr/share/rpmlint/config') 
     266 
     267# Was rpmlint invoked as a prefixed variant? 
     268m = re.match(r"(?P<prefix>[\w-]+)-rpmlint(\.py)?", sys.argv[0]) 
     269if m: 
     270    # Okay, we're a prefixed variant. Look for the variant config. 
     271    # If we find it, use it. If not, fallback to the default. 
     272    prefix = m.group('prefix') 
     273    if os.path.isfile('/usr/share/rpmlint/config.%s' % prefix): 
     274        configs.insert(0, '/usr/share/rpmlint/config.%s' % prefix) 
     275    else: 
     276        configs.insert(0, '/usr/share/rpmlint/config') 
     277else: 
     278    configs.insert(0, '/usr/share/rpmlint/config') 
     279 
    266280for f in configs: 
    267281    try: