'This is an os.path.walk routine that finds distributions in the directory
to be scanned and then creates them.'

def distro_adder(self, distros_added, dirname, fnames):

    re_krn = re.compile(self.signature['kernel_file'])
    re_img = re.compile(self.signature['initrd_file'])
    initrd = None
    kernel = None
    pae_initrd = None
    pae_kernel = None
    for x in fnames:
        adtls = []
        if ((dirname.find('isolinux') != (-1)) and (not self.signature['isolinux_ok'])):
            continue
        fullname = os.path.join(dirname, x)
        if (os.path.islink(fullname) and os.path.isdir(fullname)):
            if fullname.startswith(self.path):
                continue
            self.logger.info(('following    symlink:    %s' % fullname))
            os.path.walk(fullname, self.distro_adder, distros_added)
        if re_img.match(x):
            if (x.find('PAE') == (-1)):
                initrd = os.path.join(dirname, x)
            else:
                pae_initrd = os.path.join(dirname, x)
        if re_krn.match(x):
            if (x.find('PAE') == (-1)):
                kernel = os.path.join(dirname, x)
            else:
                pae_kernel = os.path.join(dirname, x)
        if ((initrd is not None) and (kernel is not None)):
            adtls.append(self.add_entry(dirname, kernel, initrd))
            kernel = None
            initrd = None
        elif ((pae_initrd is not None) and (pae_kernel is not None)):
            adtls.append(self.add_entry(dirname, pae_kernel, pae_initrd))
            pae_kernel = None
            pae_initrd = None
        for adtl in adtls:
            distros_added.extend(adtl)
    if ('nexenta' == self.breed):
        initrd = os.path.join(self.path, self.signature['initrd_file'])
        kernel = os.path.join(self.path, self.signature['kernel_file'])
        adtls.append(self.add_entry(self.path, kernel, initrd))
        for adtl in adtls:
            distros_added.extend(adtl)
