def search_for_files(self, files):
        # Make a set of all the requested files
        requested = dict((f.path, f) for f in self.filter_files(files))

        # Process /var/lib/dpkg/info/*.list
        for listfile in Path('/var/lib/dpkg/info').listdir():
            package = None
            if not listfile.unicodename.endswith('.list'):
                continue
            with listfile.open('rb') as fp:
                # Read paths from the file
                l = fp.readline()
                while l:
                    if l[-1:] == b'\n':
                        l = l[:-1]
                    path = Path(l)
                    # If it's one of the requested paths, update the package
                    if path in requested:
                        if package is None:
                            pkgname = listfile.unicodename[:-5]
                            # Removes :arch
                            pkgname = pkgname.split(':', 1)[0]
                            if pkgname in self.packages:
                                package = self.packages[pkgname]
                            else:
                                package = self._create_package(pkgname)
                                self.packages[pkgname] = package
                        package.add_file(requested.pop(path))
                    l = fp.readline()

        # Remaining files are not from packages
        self.unknown_files.update(f for f in files if f.path in requested)
dataset/ETHPy150Open ViDA-NYU/reprozip/reprozip/reprozip/tracer/linux_pkgs.py/DpkgManager.search_for_files/original