forked from pool/rpmlint
7383a6345e
Copy from Base:System/rpmlint based on submit request 17759 from user thomasbiege OBS-URL: https://build.opensuse.org/request/show/17759 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/rpmlint?expand=0&rev=43
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
# vim:sw=4:et
|
|
#############################################################################
|
|
# File : CheckBuildRoot.py
|
|
# Package : rpmlint
|
|
# Author : Dirk Mueller, Stephan Kulow
|
|
# Purpose : Check for files containing $RPM_BUILD_ROOT
|
|
#############################################################################
|
|
|
|
from Filter import *
|
|
import AbstractCheck
|
|
import rpm
|
|
import re
|
|
import os
|
|
import commands
|
|
import Config
|
|
import stat
|
|
|
|
class BuildRootCheck(AbstractCheck.AbstractFilesCheck):
|
|
def __init__(self):
|
|
AbstractCheck.AbstractFilesCheck.__init__(self, "CheckBuildRoot", ".*")
|
|
self.build_root_re = re.compile('/var/tmp/[\w\!-\.]{1,60}-build/')
|
|
|
|
def check_file(self, pkg, filename):
|
|
if filename.startswith('/usr/lib/debug') or pkg.isSource():
|
|
return
|
|
if not stat.S_ISREG(pkg.files()[filename].mode):
|
|
return
|
|
|
|
if len(pkg.grep(self.build_root_re, filename)):
|
|
printError(pkg, "file-contains-buildroot", filename)
|
|
|
|
check=BuildRootCheck()
|
|
|
|
if Config.info:
|
|
addDetails(
|
|
'file-contains-buildroot',
|
|
"Your file contains traces of $RPM_BUILD_ROOT."
|
|
)
|