Skip to content

Instantly share code, notes, and snippets.

@scop
Created July 10, 2015 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scop/d1bd84d50041fb99eb07 to your computer and use it in GitHub Desktop.
Save scop/d1bd84d50041fb99eb07 to your computer and use it in GitHub Desktop.
# vim:sw=4:et
#---------------------------------------------------------------
# Module : rpmlint
# File : CheckPkgConfig
# Author : Stephan Kulow, Dirk Mueller
# Purpose : Check for errors in Pkgconfig files
#---------------------------------------------------------------
from Filter import *
import AbstractCheck
import rpm
import re
import commands
import Config
import os
class PkgConfigCheck(AbstractCheck.AbstractFilesCheck):
def __init__(self):
AbstractCheck.AbstractFilesCheck.__init__(self, "PkgConfigCheck", ".*/pkgconfig/.*\.pc$")
self.suspicious_dir=re.compile('(?:/usr/src/\w+/BUILD|/var/tmp|/tmp|/home|\@\w{1,50}\@)')
def check_file(self, pkg, filename):
if pkg.isSource():
return
if pkg.grep(self.suspicious_dir, filename):
printError(pkg, "invalid-pkgconfig-file", filename)
check=PkgConfigCheck()
if Config.info:
addDetails(
'invalid-pkgconfig-file',
"Your .pc file contains traces of $RPM_BUILD_ROOT or $RPM_BUILD_DIR."
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment