diff options
author | 2017-12-15 16:00:27 -0800 | |
---|---|---|
committer | 2017-12-15 16:00:27 -0800 | |
commit | 7c3acdbd4539d2a210d7c21c27631bb77747709d (patch) | |
tree | 7aa74d3e1cd6b232b0dd69cd5a6a5cae8ebfb8ab /infra | |
parent | c2388b53fcd5266d837b2d6c8c65bf5bdd066fd1 (diff) |
msan_builder: automatically include corresponding -dev packages.
Rather than having to specify them manually.
Diffstat (limited to 'infra')
-rw-r--r-- | infra/base-images/msan-builder/Dockerfile | 7 | ||||
-rwxr-xr-x | infra/base-images/msan-builder/msan_build.py | 32 |
2 files changed, 24 insertions, 15 deletions
diff --git a/infra/base-images/msan-builder/Dockerfile b/infra/base-images/msan-builder/Dockerfile index fecb7d78..4cb9ef87 100644 --- a/infra/base-images/msan-builder/Dockerfile +++ b/infra/base-images/msan-builder/Dockerfile @@ -30,17 +30,10 @@ WORKDIR /msan ENV PYTHONUNBUFFERED 1 RUN msan_build.py --work-dir=$WORK --create-subdirs \ libarchive13 \ - libarchive-dev \ libfreetype6 \ - libfreetype6-dev \ libpcre2-posix0 \ - libpcre2-dev \ libpcre3 \ - libpcre3-dev \ libpng12-0 \ - libpng12-dev \ libssl1.0.0 \ - libssl-dev \ zlib1g \ - zlib1g-dev \ /msan diff --git a/infra/base-images/msan-builder/msan_build.py b/infra/base-images/msan-builder/msan_build.py index 41bcfce5..69a8ab49 100755 --- a/infra/base-images/msan-builder/msan_build.py +++ b/infra/base-images/msan-builder/msan_build.py @@ -26,6 +26,7 @@ import subprocess import tempfile import apt +from apt import debfile from packages import package import wrapper_utils @@ -120,14 +121,32 @@ def SetUpEnvironment(work_dir): def FindPackageDebs(package_name, work_directory): """Find package debs.""" deb_paths = [] + cache = apt.Cache() for filename in os.listdir(work_directory): file_path = os.path.join(work_directory, filename) if not file_path.endswith('.deb'): continue - if filename.startswith(package_name + '_'): + # Matching package name. + deb = debfile.DebPackage(file_path) + if deb.pkgname == package_name: deb_paths.append(file_path) + continue + + # Also include -dev packages that depend on the runtime package. + pkg = cache[deb.pkgname] + if pkg.section != 'libdevel': + continue + + # But ignore -dbg packages. + if deb.pkgname.endswith('-dbg'): + continue + + for dependency in deb.depends: + if any(dep[0] == package_name for dep in dependency): + deb_paths.append(file_path) + break return deb_paths @@ -180,7 +199,7 @@ def ExtractLibraries(deb_paths, work_directory, output_directory): def GetPackage(package_name): apt_cache = apt.Cache() - version = apt_cache[package_name].versions[0] + version = apt_cache[package_name].candidate source_name = version.source_name custom_package_path = os.path.join(PACKAGES_DIR, source_name) + '.py' @@ -249,7 +268,7 @@ def _CollectDependencies(apt_cache, pkg, cache, dependencies): return True is_c_or_cxx = False - for dependency in pkg.versions[0].dependencies: + for dependency in pkg.candidate.dependencies: dependency = dependency[0] if dependency.name in cache: @@ -269,11 +288,6 @@ def GetBuildList(package_name): apt_cache = apt.Cache() pkg = apt_cache[package_name] - if pkg.section == 'libdevel': - # Ignore dependencies from -dev packages to keep things simple. These must - # be specified alongside the corresponding runtime package. - return [package_name] - dependencies = [] _CollectDependencies(apt_cache, pkg, {}, dependencies) return dependencies @@ -333,6 +347,8 @@ class MSanBuilder(object): if not deb_paths: raise MSanBuildException('Failed to find .deb packages.') + print('Extracting', ' '.join(deb_paths)) + if create_subdirs: extract_directory = os.path.join(output_directory, package_name) else: |