mirror of
				https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
				synced 2025-11-04 10:34:05 +00:00 
			
		
		
		
	Make MigrationItems versionned by default
As HintItem is now redundant, also replace it with a new class - UnversionnedMigrationItem - and migrate users of the classes to use the new versions. Signed-off-by: Adam D. Barratt <adam@adam-barratt.org.uk>
This commit is contained in:
		
							parent
							
								
									89bc7c8d61
								
							
						
					
					
						commit
						e75c4a4815
					
				
							
								
								
									
										10
									
								
								britney.py
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								britney.py
									
									
									
									
									
								
							@ -209,7 +209,7 @@ if __name__ == '__main__':
 | 
			
		||||
        sys.path.insert(0, idir)
 | 
			
		||||
 | 
			
		||||
from excuse import Excuse
 | 
			
		||||
from migrationitem import MigrationItem, HintItem
 | 
			
		||||
from migrationitem import MigrationItem
 | 
			
		||||
from hints import HintCollection
 | 
			
		||||
from britney import buildSystem
 | 
			
		||||
from britney_util import (old_libraries_format, same_source, undo_changes,
 | 
			
		||||
@ -2267,7 +2267,7 @@ class Britney(object):
 | 
			
		||||
                     for arch in binaries
 | 
			
		||||
                     for binary in binaries[arch][0]
 | 
			
		||||
                  )
 | 
			
		||||
        removals = [ HintItem("-%s/%s" % (source, sources[source][VERSION]))
 | 
			
		||||
        removals = [ MigrationItem("-%s/%s" % (source, sources[source][VERSION]))
 | 
			
		||||
                     for source in sources if source not in used
 | 
			
		||||
                   ]
 | 
			
		||||
        if len(removals) > 0:
 | 
			
		||||
@ -2377,7 +2377,7 @@ class Britney(object):
 | 
			
		||||
        """
 | 
			
		||||
 | 
			
		||||
        if isinstance(pkgvers[0], tuple) or isinstance(pkgvers[0], list):
 | 
			
		||||
            _pkgvers = [ HintItem('%s/%s' % (p, v)) for (p,v) in pkgvers ]
 | 
			
		||||
            _pkgvers = [ MigrationItem('%s/%s' % (p, v)) for (p,v) in pkgvers ]
 | 
			
		||||
        else:
 | 
			
		||||
            _pkgvers = pkgvers
 | 
			
		||||
 | 
			
		||||
@ -2530,7 +2530,7 @@ class Britney(object):
 | 
			
		||||
                        to_skip.append(i)
 | 
			
		||||
            for i in range(len(l)):
 | 
			
		||||
                if i not in to_skip:
 | 
			
		||||
                    self.do_hint("easy", "autohinter", [ HintItem("%s/%s" % (x[0], x[1])) for x in l[i] ])
 | 
			
		||||
                    self.do_hint("easy", "autohinter", [ MigrationItem("%s/%s" % (x[0], x[1])) for x in l[i] ])
 | 
			
		||||
 | 
			
		||||
    def old_libraries(self, same_source=same_source):
 | 
			
		||||
        """Detect old libraries left in testing for smooth transitions
 | 
			
		||||
@ -2551,7 +2551,7 @@ class Britney(object):
 | 
			
		||||
                pkg = testing[arch][0][pkg_name]
 | 
			
		||||
                if pkg_name not in unstable[arch][0] and \
 | 
			
		||||
                   not same_source(sources[pkg[SOURCE]][VERSION], pkg[SOURCEVER]):
 | 
			
		||||
                    removals.append(HintItem("-" + pkg_name + "/" + arch + "/" + pkg[SOURCEVER]))
 | 
			
		||||
                    removals.append(MigrationItem("-" + pkg_name + "/" + arch + "/" + pkg[SOURCEVER]))
 | 
			
		||||
        return removals
 | 
			
		||||
 | 
			
		||||
    def nuninst_arch_report(self, nuninst, arch):
 | 
			
		||||
 | 
			
		||||
@ -362,11 +362,11 @@ def write_heidi(filename, sources_t, packages_t,
 | 
			
		||||
            f.write('%s %s source %s\n' % (src_name, srcv, srcsec))
 | 
			
		||||
 | 
			
		||||
def make_hintitem(package, sources, VERSION=VERSION):
 | 
			
		||||
    """Convert a textual package specification to a HintItem
 | 
			
		||||
    """Convert a textual package specification to a MigrationItem
 | 
			
		||||
    
 | 
			
		||||
    sources is a list of source packages in each suite, used to determine
 | 
			
		||||
    the version which should be used for the HintItem.
 | 
			
		||||
    the version which should be used for the MigrationItem.
 | 
			
		||||
    """
 | 
			
		||||
    
 | 
			
		||||
    item = MigrationItem(package)
 | 
			
		||||
    return HintItem("%s/%s" % (item.uvname, sources[item.suite][item.package][VERSION]))
 | 
			
		||||
    item = UnversionnedMigrationItem(package)
 | 
			
		||||
    return MigrationItem("%s/%s" % (item.uvname, sources[item.suite][item.package][VERSION]))
 | 
			
		||||
 | 
			
		||||
@ -23,7 +23,7 @@ class MigrationItem(object):
 | 
			
		||||
    def get_architectures(cls):
 | 
			
		||||
        return cls._architectures
 | 
			
		||||
 | 
			
		||||
    def __init__(self, name = None, versionned = False):
 | 
			
		||||
    def __init__(self, name = None, versionned = True):
 | 
			
		||||
        self._name = None
 | 
			
		||||
        self._uvname = None
 | 
			
		||||
        self._package = None
 | 
			
		||||
@ -141,6 +141,6 @@ class MigrationItem(object):
 | 
			
		||||
    def uvname(self):
 | 
			
		||||
        return self._uvname
 | 
			
		||||
 | 
			
		||||
class HintItem(MigrationItem):
 | 
			
		||||
class UnversionnedMigrationItem(MigrationItem):
 | 
			
		||||
    def __init__(self, name = None):
 | 
			
		||||
        MigrationItem.__init__(self, name = name, versionned = True)
 | 
			
		||||
        MigrationItem.__init__(self, name = name, versionned = False)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user