예제 #1
0
    def resolve_deps(self):
        '''Uses the dockerize.DepSolver class to find all the shared
        library dependencies of files installed into the Docker image.'''

        deps = DepSolver()

        # Iterate over all files in the image.
        for root, dirs, files in os.walk(self.targetdir):
            for name in files:
                path = os.path.join(root, name)
                deps.add(path)

        for src in deps.deps:
            self.copy_file(src, symlinks=symlink_options.COPY_ALL)

        # Install some basic nss libraries to permit programs to resolve
        # users, groups, and hosts.
        for libdir in deps.prefixes():
            for nsslib in [
                    'libnss_dns.so.2', 'libnss_files.so.2',
                    'libnss_compat.so.2'
            ]:
                src = os.path.join(libdir, nsslib)
                LOG.info('looking for %s', src)
                if os.path.exists(src):
                    self.copy_file(src, symlinks=symlink_options.COPY_ALL)
예제 #2
0
    def resolve_deps(self):
        '''Uses the dockerize.DepSolver class to find all the shared
        library dependencies of files installed into the Docker image.'''

        deps = DepSolver()

        # Iterate over all files in the image.
        for root, dirs, files in os.walk(self.targetdir):
            for name in files:
                path = os.path.join(root, name)
                deps.add(path)

        for src in deps.deps:
            self.copy_file(src, symlinks=symlink_options.COPY_ALL)

        # Install some basic nss libraries to permit programs to resolve
        # users, groups, and hosts.
        for libdir in deps.prefixes():
            for nsslib in ['libnss_dns.so.2',
                           'libnss_files.so.2',
                           'libnss_compat.so.2']:
                src = os.path.join(libdir, nsslib)
                LOG.info('looking for %s', src)
                if os.path.exists(src):
                    self.copy_file(src, symlinks=symlink_options.COPY_ALL)
예제 #3
0
파일: tracer.py 프로젝트: redsift/tracer
def expand_file(path, sym_set, files_set, found_set, no_cpy_all):
    if len([n for n in IGNORE if fnmatch.fnmatch(path, n)]) != 0:
        return

    if no_cpy_all != True:
        dirs = [
            n for n in COPYALL if fnmatch.fnmatch(path, os.path.join(n, '*'))
        ]
        if len(dirs) != 0:
            for roots in dirs:
                expand_dir(roots, sym_set, files_set, found_set, True)
            return

    if os.path.islink(path):
        sym_set.add(path)
        lnk = os.readlink(path)
        if os.path.isabs(lnk) == False:
            lnk = os.path.join(os.path.dirname(path), lnk)

        expand_file(lnk, sym_set, files_set, found_set, no_cpy_all)

    if os.path.isdir(path):
        expand_dir(path, sym_set, files_set, found_set, no_cpy_all)
        return

    if os.path.isfile(path):
        if path in files_set:
            return

        files_set.add(path)
        found_set.add(os.path.basename(path))

        deps = DepSolver()
        deps.add(path)
        for src in deps.deps:
            expand_file(src, sym_set, files_set, found_set, no_cpy_all)