koijkamid: remove clamav scanner

The ClamAV virus scanner in Cygwin is buggy and unmaintained. It takes
significant time to run the scanner during each build, and Windows has
better malware scanners now.

Remove the ClamAV virus scanning from kojikamid.
This commit is contained in:
Ken Dreyer 2022-11-11 14:48:34 -05:00 committed by Tomas Kopecek
parent dac56b8ef3
commit 35512061fa

View file

@ -155,15 +155,9 @@ class WindowsBuild(object):
raise BuildError('error validating build environment: %s' % # noqa: F821 raise BuildError('error validating build environment: %s' % # noqa: F821
', '.join(errors)) ', '.join(errors))
def updateClam(self):
"""update ClamAV virus definitions"""
ret, output = run(['/bin/freshclam', '--quiet'])
if ret:
raise BuildError('could not update ClamAV database: %s' % output) # noqa: F821
def checkEnv(self): def checkEnv(self):
"""make the environment is fit for building in""" """make the environment is fit for building in"""
for tool in ['/bin/freshclam', '/bin/clamscan', '/bin/patch']: for tool in ['/bin/patch']:
if not os.path.isfile(tool): if not os.path.isfile(tool):
raise BuildError('%s is missing from the build environment' % tool) # noqa: F821 raise BuildError('%s is missing from the build environment' % tool) # noqa: F821
@ -199,7 +193,6 @@ class WindowsBuild(object):
ensuredir(os.path.join(self.workdir, 'patches'))) # noqa: F821 ensuredir(os.path.join(self.workdir, 'patches'))) # noqa: F821
self.zipDir(self.patches_dir, os.path.join(self.workdir, 'patches.zip')) self.zipDir(self.patches_dir, os.path.join(self.workdir, 'patches.zip'))
self.applyPatches(self.source_dir, self.patches_dir) self.applyPatches(self.source_dir, self.patches_dir)
self.virusCheck(self.workdir)
def applyPatches(self, sourcedir, patchdir): def applyPatches(self, sourcedir, patchdir):
"""Apply patches in patchdir to files in sourcedir)""" """Apply patches in patchdir to files in sourcedir)"""
@ -398,7 +391,6 @@ class WindowsBuild(object):
else: else:
files.append(fileinfo) files.append(fileinfo)
self.server.updateBuildrootFiles(self.buildroot_id, files, rpms) self.server.updateBuildrootFiles(self.buildroot_id, files, rpms)
self.virusCheck(self.buildreq_dir)
def build(self): def build(self):
if self.shell in ('cmd', 'cmd.exe'): if self.shell in ('cmd', 'cmd.exe'):
@ -520,17 +512,10 @@ class WindowsBuild(object):
break break
else: else:
errors.append('file %s does not exist' % entry) errors.append('file %s does not exist' % entry)
self.virusCheck(self.workdir)
if errors: if errors:
raise BuildError('error validating build output: %s' % # noqa: F821 raise BuildError('error validating build output: %s' % # noqa: F821
', '.join(errors)) ', '.join(errors))
def virusCheck(self, path):
"""ensure a path is virus free with ClamAV. path should be absolute"""
if not path.startswith('/'):
raise BuildError('Invalid path to scan for viruses: ' + path) # noqa: F821
run(['/bin/clamscan', '--quiet', '--recursive', path], fatal=True)
def gatherResults(self): def gatherResults(self):
"""Gather information about the output from the build, return it""" """Gather information about the output from the build, return it"""
return {'name': self.name, 'version': self.version, 'release': self.release, return {'name': self.name, 'version': self.version, 'release': self.release,
@ -543,7 +528,6 @@ class WindowsBuild(object):
def run(self): def run(self):
"""Run the entire build process""" """Run the entire build process"""
self.checkEnv() self.checkEnv()
self.updateClam()
self.checkout() self.checkout()
self.loadConfig() self.loadConfig()
self.initBuildroot() self.initBuildroot()