zip: add external detection (#28434)

This commit is contained in:
Adam J. Stewart 2022-01-17 02:39:17 -06:00 committed by GitHub
parent dbb36ef8b1
commit 5e595586a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,8 @@
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
import re
class Zip(MakefilePackage): class Zip(MakefilePackage):
"""Zip is a compression and file packaging/archive utility.""" """Zip is a compression and file packaging/archive utility."""
@ -27,6 +29,14 @@ class Zip(MakefilePackage):
patch('09-hardening-build-fix-2.patch') patch('09-hardening-build-fix-2.patch')
patch('10-remove-build-date.patch') patch('10-remove-build-date.patch')
executables = ['^zip$']
@classmethod
def determine_version(cls, exe):
output = Executable(exe)('--version', output=str, error=str)
match = re.search(r'This is Zip (\S+)', output)
return match.group(1) if match else None
def url_for_version(self, version): def url_for_version(self, version):
return 'http://downloads.sourceforge.net/infozip/zip{0}.tar.gz'.format(version.joined) return 'http://downloads.sourceforge.net/infozip/zip{0}.tar.gz'.format(version.joined)