mirror of
				https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
				synced 2025-11-04 02:24:24 +00:00 
			
		
		
		
	Don't allow unversioned migrationitems to be hashed
Unversioned migration items match different versioned items for the same source, so hashing them will not produce a correct result. Closes: #945471
This commit is contained in:
		
							parent
							
								
									18f71a01f5
								
							
						
					
					
						commit
						62c309da07
					
				@ -83,7 +83,8 @@ class Hint(object):
 | 
			
		||||
        if self.type != other.type:
 | 
			
		||||
            return False
 | 
			
		||||
        else:
 | 
			
		||||
            return frozenset(self.packages) == frozenset(other.packages)
 | 
			
		||||
            # we can't use sets, because unversioned items cannot be hashed
 | 
			
		||||
            return sorted(self.packages) == sorted(other.packages)
 | 
			
		||||
 | 
			
		||||
    @property
 | 
			
		||||
    def type(self):
 | 
			
		||||
 | 
			
		||||
@ -76,6 +76,10 @@ class MigrationItem(object):
 | 
			
		||||
        return isequal
 | 
			
		||||
 | 
			
		||||
    def __hash__(self):
 | 
			
		||||
        if not self.version:
 | 
			
		||||
            raise AssertionError("trying to hash unversioned MigrationItem: %s" %
 | 
			
		||||
                                 (self.name))
 | 
			
		||||
 | 
			
		||||
        return hash((self.uvname, self.version))
 | 
			
		||||
 | 
			
		||||
    def __lt__(self, other):
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user