mirror of
				https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
				synced 2025-11-04 10:34:05 +00:00 
			
		
		
		
	Add sanity-checking of hints
So far we only check that hints which should have version information do (and those which should not do not). Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
This commit is contained in:
		
							parent
							
								
									253590ba27
								
							
						
					
					
						commit
						16984f345c
					
				
							
								
								
									
										11
									
								
								hints.py
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								hints.py
									
									
									
									
									
								
							@ -36,6 +36,8 @@ class HintCollection(object):
 | 
			
		||||
        self._hints.append(Hint(hint, user))
 | 
			
		||||
 | 
			
		||||
class Hint(object):
 | 
			
		||||
    NO_VERSION = [ 'block', 'block-all', 'block-udeb' ]
 | 
			
		||||
 | 
			
		||||
    def __init__(self, hint, user):
 | 
			
		||||
        self._hint = hint
 | 
			
		||||
        self._user = user
 | 
			
		||||
@ -58,6 +60,15 @@ class Hint(object):
 | 
			
		||||
            self._packages = self._packages.split(' ')
 | 
			
		||||
 | 
			
		||||
        self._packages = [MigrationItem(x) for x in self._packages]
 | 
			
		||||
        
 | 
			
		||||
        self.check()
 | 
			
		||||
        
 | 
			
		||||
    def check(self):
 | 
			
		||||
        for package in self.packages:
 | 
			
		||||
            if self.type in self.__class__.NO_VERSION:
 | 
			
		||||
                assert package.version is None, package
 | 
			
		||||
            else:
 | 
			
		||||
                assert package.version is not None, package
 | 
			
		||||
 | 
			
		||||
    def set_active(self, active):
 | 
			
		||||
        self._active = active
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user