Jeroen van Meeuwen wrote:
> Sorry for the trailing whitespace foo in this patch, a sane patch would 
> look like this:
>   

Jeroen,

Can you supply more in-depth information about what this patch does, 
specifically?

Examples would be good.

Thanks,

--Michael


> [EMAIL PROTECTED] wrote:
>   
>> From: Jeroen van Meeuwen (Fedora Unity) <[EMAIL PROTECTED]>
>>
>> ---
>>  cobbler/action_import.py |  212 
>> +++++++++++++++++++++++++++-------------------
>>  1 files changed, 126 insertions(+), 86 deletions(-)
>>
>> diff --git a/cobbler/action_import.py b/cobbler/action_import.py
>> index a0a515e..bf4818c 100644
>> --- a/cobbler/action_import.py
>> +++ b/cobbler/action_import.py
>> @@ -475,48 +475,82 @@ class Importer:
>>          except:
>>              print _("- error launching createrepo, ignoring...")
>>              traceback.print_exc()
>> -        
>> +
>>  
>>      # 
>> ========================================================================
>>  
>>      def distro_adder(self,foo,dirname,fnames):
>> -        
>> +
>>          """
>>          This is an os.path.walk routine that finds distributions in the 
>> directory
>>          to be scanned and then creates them.
>>          """
>>  
>> -        # FIXME: If there are more than one kernel or initrd image on the 
>> same directory, 
>> +        # FIXME: If there are more than one kernel or initrd image on the 
>> same directory,
>>          # results are unpredictable
>>  
>> -        initrd = None
>> -        kernel = None
>> -        
>> +        initrd = {}
>> +        kernel = {}
>> +
>> +        counter = 0
>> +
>>          for x in fnames:
>>  
>>              fullname = os.path.join(dirname,x)
>> +
>>              if os.path.islink(fullname) and os.path.isdir(fullname):
>> -              if os.path.realpath(fullname) == os.path.realpath(dirname):
>> -                # Prevent infinite loops importing debian media
>> -                continue
>> -              print "- following symlink: %s" % fullname
>> -              os.path.walk(fullname, self.distro_adder, foo)
>> -
>> -            if x.startswith("initrd"):
>> -                initrd = os.path.join(dirname,x)
>> -            if ( x.startswith("vmlinuz") or x.startswith("kernel.img") ) 
>> and x.find("initrd") == -1:
>> -                kernel = os.path.join(dirname,x)
>> -            if initrd is not None and kernel is not None and 
>> dirname.find("isolinux") == -1:
>> -                adtl = self.add_entry(dirname,kernel,initrd)
>> -                if adtl != None:
>> -                    foo.extend(adtl)
>> -                    # Not resetting these values causes problems importing 
>> debian media because there are remaining items in fnames
>> -                    initrd = None
>> -                    kernel = None
>> -    
>> +                if os.path.realpath(fullname) == os.path.realpath(dirname):
>> +                    # Prevent infinite loops importing debian media
>> +                    continue
>> +                print "- following symlink: %s" % fullname
>> +                os.path.walk(fullname, self.distro_adder, foo)
>> +
>> +            if x.startswith("initrd") and not initrd.has_key(x):
>> +                initrd[counter] = os.path.join(dirname,x)
>> +                print "Found initrd for %s" % x
>> +                if kernel.has_key(counter): counter += 1
>> +
>> +            if ( x.startswith("vmlinuz") or x.startswith("kernel.img") ) 
>> and x.find("initrd") == -1 and not kernel.has_key(x):
>> +                kernel[counter] = os.path.join(dirname,x)
>> +                print "Found kernel for %s" % x
>> +                if initrd.has_key(counter): counter += 1
>> +
>> +            if initrd.keys() > 0 and kernel.keys() > 0 and 
>> dirname.find("isolinux") == -1:
>> +                for key in initrd.keys():
>> +                    kernel_type = None
>> +                    if kernel.has_key(key):
>> +                        kernel_type = self.find_me_kernel_type(initrd[key], 
>> kernel[key])
>> +                    else:
>> +                        print "kernel[%s] does not exist" % key
>> +                        continue
>> +
>> +                    adtl = 
>> self.add_entry(dirname,kernel[key],initrd[key],kernel_type=kernel_type)
>> +                    if adtl != None:
>> +                        foo.extend(adtl)
>> +                        # Not resetting these values causes problems 
>> importing debian media because there are remaining items in fnames
>> +                        initrd = {}
>> +                        kernel = {}
>> +
>> +    # 
>> ========================================================================
>> +
>> +    def find_me_kernel_type(self,initrd, kernel):
>> +
>> +        """
>> +        From the initrd and kernel passed, find out a name for this kernel
>> +        """
>> +
>> +        print "Got initrd %s and kernel %s" % (initrd,kernel)
>> +
>> +        if initrd.find("PAE") >= 0:
>> +            print "Found kernel type PAE"
>> +            return "PAE"
>> +
>> +        print "No particular kernel type found"
>> +        return None
>> +
>>      # 
>> ========================================================================
>>  
>> -    def add_entry(self,dirname,kernel,initrd):
>> +    def add_entry(self,dirname,kernel,initrd,kernel_type=None):
>>  
>>          """
>>          When we find a directory with a valid kernel/initrd in it, create 
>> the distribution objects
>> @@ -553,7 +587,13 @@ class Importer:
>>  
>>          for pxe_arch in archs:
>>  
>> -            name = proposed_name + "-" + pxe_arch
>> +            if kernel_type:
>> +                proposed_name_append = "-%s" % kernel_type
>> +            else:
>> +                proposed_name_append = ""
>> +
>> +            name = proposed_name + "-" + pxe_arch + proposed_name_append
>> +
>>              existing_distro = self.distros.find(name=name)
>>  
>>              if existing_distro is not None:
>>     
>
> _______________________________________________
> cobbler mailing list
> [email protected]
> https://fedorahosted.org/mailman/listinfo/cobbler
>   

_______________________________________________
cobbler mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/cobbler

Reply via email to