@ -193,7 +193,8 @@ import urllib
import apt_pkg
import apt_pkg
from excuse import Excuse
from excuse import Excuse
from migrationitem import MigrationItem
from migrationitem import MigrationItem , HintItem
from hints import Hint , HintCollection
from britney import buildSystem
from britney import buildSystem
__author__ = ' Fabio Tranchitella and the Debian Release Team '
__author__ = ' Fabio Tranchitella and the Debian Release Team '
@ -773,7 +774,7 @@ class Britney:
The method returns a dictionary where the key is the command , and
The method returns a dictionary where the key is the command , and
the value is the list of affected packages .
the value is the list of affected packages .
"""
"""
hints = dict ( [ ( k , [ ] ) for k in self . HINTS_ALL ] )
hints = HintCollection ( )
for who in self . HINTS . keys ( ) :
for who in self . HINTS . keys ( ) :
if who == ' command-line ' :
if who == ' command-line ' :
@ -793,35 +794,37 @@ class Britney:
break
break
elif l [ 0 ] not in self . HINTS [ who ] :
elif l [ 0 ] not in self . HINTS [ who ] :
continue
continue
elif l [ 0 ] in [ " easy " , " hint " , " force-hint " ] :
elif l [ 0 ] in [ " approve " , " block " , " block-all " , " block-udeb " , " unblock " , " unblock-udeb " , " force " , " urgent " , " remove " ] :
hints [ l [ 0 ] ] . append ( ( who , [ k . rsplit ( " / " , 1 ) for k in l if " / " in k ] ) )
for package in l [ 1 : ] :
elif l [ 0 ] in [ " block-all " ] :
hints . add_hint ( ' %s %s " ' % ( l [ 0 ] , package ) , who )
hints [ l [ 0 ] ] . extend ( [ ( y , who ) for y in l [ 1 : ] ] )
elif l [ 0 ] in [ " age-days " ] :
elif l [ 0 ] in [ " block " , " block-udeb " ] :
for package in l [ 2 : ] :
hints [ l [ 0 ] ] . extend ( [ ( y , who ) for y in l [ 1 : ] ] )
hints . add_hint ( ' %s %s %s ' % ( l [ 0 ] , l [ 1 ] , package ) , who )
elif l [ 0 ] in [ " age-days " ] and len ( l ) > = 3 and l [ 1 ] . isdigit ( ) :
else :
days = l [ 1 ]
hints . add_hint ( l , who )
tmp = [ tuple ( [ who ] + k . rsplit ( " / " , 1 ) ) for k in l [ 2 : ] if " / " in k ]
hints [ l [ 0 ] ] . extend ( [ ( p , ( v , h , days ) ) for h , p , v in tmp ] )
elif l [ 0 ] in [ " remove " , " approve " , " unblock " , " unblock-udeb " , " force " , " urgent " ] :
hints [ l [ 0 ] ] . extend ( [ ( k . rsplit ( " / " , 1 ) [ 0 ] , ( k . rsplit ( " / " , 1 ) [ 1 ] , who ) ) for k in l if " / " in k ] )
for x in [ " approve " , " block " , " block-all " , " block-udeb " , " unblock " , " unblock-udeb " , " force " , " urgent " , " remove " , " age-days " ] :
for x in [ " approve " , " block " , " block-all " , " block-udeb " , " unblock " , " unblock-udeb " , " force " , " urgent " , " remove " , " age-days " ] :
z = { }
z = { }
for a , b in hints [ x ] :
for hint in hints [ x ] :
if z . has_key ( a ) and z [ a ] != b :
item = hint . packages [ 0 ]
package = item . package
if z . has_key ( package ) and z [ package ] != item . version :
if x in [ ' unblock ' , ' unblock-udeb ' ] :
if x in [ ' unblock ' , ' unblock-udeb ' ] :
if apt_pkg . VersionCompare ( z [ a ] [ 0 ] , b [ 0 ] ) < 0 :
if apt_pkg . VersionCompare ( z [ package] , item . version ) < 0 :
# This hint is for a newer version, so discard the old one
# This hint is for a newer version, so discard the old one
self . __log ( " Overriding %s [ %s ] = %s with %s " % ( x , a , z [ a ] , b ) , type = " W " )
self . __log ( " Overriding %s [ %s ] = %s with %s " % ( x , package , z [ package ] , item . version ) , type = " W " )
for other in [ y for y in hints [ x ] if y . package == package and y . version == z [ package ] ] :
other . set_active ( False )
else :
else :
# This hint is for an older version, so ignore it in favour of the new one
# This hint is for an older version, so ignore it in favour of the new one
self . __log ( " Ignoring %s [ %s ] = %s , %s is higher or equal " % ( x , a, b , z [ a ] ) , type = " W " )
self . __log ( " Ignoring %s [ %s ] = %s , %s is higher or equal " % ( x , package, item . version , z [ package ] ) , type = " W " )
continue
hint . set_active ( False )
else :
else :
self . __log ( " Overriding %s [ %s ] = %s with %s " % ( x , a , z [ a ] , b ) , type = " W " )
self . __log ( " Overriding %s [ %s ] = %s with %s " % ( x , package , z [ package ] , item . version ) , type = " W " )
z [ a ] = b
for other in [ y for y in hints [ x ] if y . package == package and y . version == z [ package ] ] :
hints [ x ] = z
other . set_active ( False )
z [ package ] = item . version
# Sanity check the hints hash
# Sanity check the hints hash
if len ( hints [ " block " ] ) == 0 and len ( hints [ " block-udeb " ] ) == 0 :
if len ( hints [ " block " ] ) == 0 and len ( hints [ " block-udeb " ] ) == 0 :
@ -1082,9 +1085,9 @@ class Britney:
src [ SECTION ] and excuse . set_section ( src [ SECTION ] . strip ( ) )
src [ SECTION ] and excuse . set_section ( src [ SECTION ] . strip ( ) )
# if the package is blocked, skip it
# if the package is blocked, skip it
if self . hints [ ' block ' ] . has_key ( ' - ' + pkg ) :
for hint in self . hints . hints ( ' block ' , package = pkg , removal = True ) :
excuse . addhtml ( " Not touching package, as requested by %s (contact debian-release "
excuse . addhtml ( " Not touching package, as requested by %s (contact debian-release "
" if update is needed) " % self . hints [ ' block ' ] [ ' - ' + pkg ] )
" if update is needed) " % hint . user )
excuse . addhtml ( " Not considered " )
excuse . addhtml ( " Not considered " )
self . excuses . append ( excuse )
self . excuses . append ( excuse )
return False
return False
@ -1119,9 +1122,8 @@ class Britney:
# if there is a `remove' hint and the requested version is the same as the
# if there is a `remove' hint and the requested version is the same as the
# version in testing, then stop here and return False
# version in testing, then stop here and return False
if src in self . hints [ " remove " ] and \
for hint in [ x for x in self . hints . hints ( ' remove ' , package = src ) if self . same_source ( source_t [ VERSION ] , x . packages [ 0 ] . version ) ] :
self . same_source ( source_t [ VERSION ] , self . hints [ " remove " ] [ src ] [ 0 ] ) :
excuse . addhtml ( " Removal request by %s " % ( hint . user ) )
excuse . addhtml ( " Removal request by %s " % ( self . hints [ " remove " ] [ src ] [ 1 ] ) )
excuse . addhtml ( " Trying to remove package, not update it " )
excuse . addhtml ( " Trying to remove package, not update it " )
excuse . addhtml ( " Not considered " )
excuse . addhtml ( " Not considered " )
self . excuses . append ( excuse )
self . excuses . append ( excuse )
@ -1258,38 +1260,38 @@ class Britney:
# if there is a `remove' hint and the requested version is the same as the
# if there is a `remove' hint and the requested version is the same as the
# version in testing, then stop here and return False
# version in testing, then stop here and return False
if src in self . hints [ " remove " ] :
for item in self . hints . hints ( ' remove ' , package = src ) :
if source_t and self . same_source ( source_t [ VERSION ] , self . hints [ ' remove ' ] [ src ] [ 0 ] ) or \
package = item . packages [ 0 ]
self . same_source ( source_u [ VERSION ] , self . hints [ ' remove ' ] [ src ] [ 0 ] ) :
if source_t and self . same_source ( source_t [ VERSION ] , package . version ) or \
excuse . addhtml ( " Removal request by %s " % ( self . hints [ " remove " ] [ src ] [ 1 ] ) )
self . same_source ( source_u [ VERSION ] , package . version ) :
excuse . addhtml ( " Removal request by %s " % ( item . user ) )
excuse . addhtml ( " Trying to remove package, not update it " )
excuse . addhtml ( " Trying to remove package, not update it " )
update_candidate = False
update_candidate = False
# check if there is a `block' or `block-udeb' hint for this package, or a `block-all source' hint
# check if there is a `block' or `block-udeb' hint for this package, or a `block-all source' hint
blocked = { }
blocked = { }
if src in self . hints [ " block " ] :
for hint in self . hints . hints ( package = src ) :
blocked [ " block " ] = self . hints [ " block " ] [ src ]
if hint . type == ' block ' or ( hint . type == ' block-all ' and hint . packages [ 0 ] == ' source ' and hint not in blocked [ ' block ' ] ) :
elif ' source ' in self . hints [ " block-all " ] :
blocked [ ' block ' ] = hint
blocked [ " block " ] = self . hints [ " block-all " ] [ " source " ]
if hint . type == ' block-udeb ' :
blocked [ ' block-udeb ' ] = hint
if src in self . hints [ " block-udeb " ] :
blocked [ " block-udeb " ] = self . hints [ " block-udeb " ] [ src ]
# if the source is blocked, then look for an `unblock' hint; the unblock request
# if the source is blocked, then look for an `unblock' hint; the unblock request
# is processed only if the specified version is correct. If a package is blocked
# is processed only if the specified version is correct. If a package is blocked
# by `block-udeb', then `unblock-udeb' must be present to cancel it.
# by `block-udeb', then `unblock-udeb' must be present to cancel it.
for block_cmd in blocked :
for block_cmd in blocked :
unblock_cmd = " un " + block_cmd
unblock_cmd = " un " + block_cmd
unblock = self . hints [ unblock_cmd ] . get ( src , ( None , None ) )
unblocks = self . hints . hints ( unblock_cmd , package = src )
if unblock [ 0 ] != None and self . same_source ( unblock [ 0 ] , source_u [ VERSION ] ) :
if unblocks and self . same_source ( unblocks [ 0 ] . version , source_u [ VERSION ] ) :
excuse . addhtml ( " Ignoring %s request by %s , due to %s request by %s " %
excuse . addhtml ( " Ignoring %s request by %s , due to %s request by %s " %
( block_cmd , blocked [ block_cmd ] , unblock_cmd , self . hints [ unblock_cmd ] [ src ] [ 1 ] ) )
( block_cmd , blocked [ block_cmd ] . user , unblock_cmd , unblocks [ 0 ] . user ) )
else :
else :
if unblock [ 0 ] != None :
if unblock s :
excuse . addhtml ( " %s request by %s ignored due to version mismatch: %s " %
excuse . addhtml ( " %s request by %s ignored due to version mismatch: %s " %
( unblock_cmd . capitalize ( ) , self . hints [ unblock_cmd ] [ src ] [ 1 ] , self . hints [ unblock_cmd ] [ src ] [ 0 ] ) )
( unblock_cmd . capitalize ( ) , blocked [ block_cmd ] . user , unblocks [ 0 ] . version ) )
excuse . addhtml ( " Not touching package due to %s request by %s (contact debian-release if update is needed) " %
excuse . addhtml ( " Not touching package due to %s request by %s (contact debian-release if update is needed) " %
( block_cmd , blocked [ block_cmd ] ) )
( block_cmd , blocked [ block_cmd ] . user ) )
update_candidate = False
update_candidate = False
# if the suite is unstable, then we have to check the urgency and the minimum days of
# if the suite is unstable, then we have to check the urgency and the minimum days of
@ -1305,17 +1307,18 @@ class Britney:
days_old = self . date_now - self . dates [ src ] [ 1 ]
days_old = self . date_now - self . dates [ src ] [ 1 ]
min_days = self . MINDAYS [ urgency ]
min_days = self . MINDAYS [ urgency ]
age_days_hint = self . hints [ " age-days " ] . get ( src )
for age_days_hint in [ x for x in self . hints . hints ( ' age-days ' , package = src ) if \
if age_days_hint is not None and ( age_days_hint [ 0 ] == " - " or \
self . same_source ( source_u [ VERSION ] , x . packages [ 0 ] . version ) ] :
self . same_source ( source_u [ VERSION ] , age_days_hint [ 0 ] ) ) :
excuse . addhtml ( " Overriding age needed from %d days to %d by %s " % ( min_days ,
excuse . addhtml ( " Overriding age needed from %d days to %d by %s " % ( min_days ,
int ( self . hints [ " age-days " ] [ src ] [ 2 ] ) , self . hints [ " age-days " ] [ src ] [ 1 ] ) )
int ( age_days_hint . days ) , age_days_hint . user ) )
min_days = int ( self . hints [ " age-days " ] [ src ] [ 2 ] )
min_days = int ( age_days_hint . days )
excuse . setdaysold ( days_old , min_days )
excuse . setdaysold ( days_old , min_days )
if days_old < min_days :
if days_old < min_days :
if src in self . hints [ " urgent " ] and self . same_source ( source_u [ VERSION ] , self . hints [ " urgent " ] [ src ] [ 0 ] ) :
urgent_hints = [ x for x in self . hints . hints ( ' urgent ' , package = src ) if \
excuse . addhtml ( " Too young, but urgency pushed by %s " % ( self . hints [ " urgent " ] [ src ] [ 1 ] ) )
self . same_source ( source_u [ VERSION ] , x . packages [ 0 ] . version ) ]
if urgent_hints :
excuse . addhtml ( " Too young, but urgency pushed by %s " % ( urgent_hints [ 0 ] . user ) )
else :
else :
update_candidate = False
update_candidate = False
@ -1436,19 +1439,19 @@ class Britney:
" though it fixes more than it introduces, whine at debian-release) " % pkg )
" though it fixes more than it introduces, whine at debian-release) " % pkg )
# check if there is a `force' hint for this package, which allows it to go in even if it is not updateable
# check if there is a `force' hint for this package, which allows it to go in even if it is not updateable
if src in self . hints [ " force " ] and self . same_source ( source_u [ VERSION ] , self . hints [ " force " ] [ src ] [ 0 ] ) :
forces = [ x for x in self . hints . hints ( ' force ' , package = src ) if self . same_source ( source_u [ VERSION ] , x . packages [ 0 ] . version ) ]
if forces :
excuse . dontinvalidate = 1
excuse . dontinvalidate = 1
if not update_candidate and src in self . hints [ " force " ] and \
if not update_candidate and forces :
self . same_source ( source_u [ VERSION ] , self . hints [ " force " ] [ src ] [ 0 ] ) :
excuse . addhtml ( " Should ignore, but forced by %s " % ( forces [ 0 ] . user ) )
excuse . addhtml ( " Should ignore, but forced by %s " % ( self . hints [ " force " ] [ src ] [ 1 ] ) )
update_candidate = True
update_candidate = True
# if the suite is *-proposed-updates, the package needs an explicit approval in order to go in
# if the suite is *-proposed-updates, the package needs an explicit approval in order to go in
if suite in [ ' tpu ' , ' pu ' ] :
if suite in [ ' tpu ' , ' pu ' ] :
key = " %s _ %s " % ( src , source_u [ VERSION ] )
key = " %s _ %s " % ( src , source_u [ VERSION ] )
if src in self . hints [ " approve " ] and \
approves = [ x for x in self . hints . hints ( ' approve ' , package = src ) if self . same_source ( source_u [ VERSION ] , x . packages [ 0 ] . version ) ]
self . same_source ( source_u [ VERSION ] , self . hints [ " approve " ] [ src ] [ 0 ] ) :
if approves :
excuse . addhtml ( " Approved by %s " % self . hints [ " approve " ] [ src ] [ 1 ] )
excuse . addhtml ( " Approved by %s " % approves [ 0 ] . user )
else :
else :
excuse . addhtml ( " NEEDS APPROVAL BY RM " )
excuse . addhtml ( " NEEDS APPROVAL BY RM " )
update_candidate = False
update_candidate = False
@ -1573,20 +1576,21 @@ class Britney:
upgrade_me . append ( " %s _ %s " % ( pkg , suite ) )
upgrade_me . append ( " %s _ %s " % ( pkg , suite ) )
# process the `remove' hints, if the given package is not yet in upgrade_me
# process the `remove' hints, if the given package is not yet in upgrade_me
for src in self . hints [ " remove " ] . keys ( ) :
for item in self . hints [ ' remove ' ] :
src = item . packages [ 0 ] . package
if src in upgrade_me : continue
if src in upgrade_me : continue
if ( " - " + src ) in upgrade_me : continue
if ( " - " + src ) in upgrade_me : continue
if src not in sources [ ' testing ' ] : continue
if src not in sources [ ' testing ' ] : continue
# check if the version specified in the hint is the same as the considered package
# check if the version specified in the hint is the same as the considered package
tsrcv = sources [ ' testing ' ] [ src ] [ VERSION ]
tsrcv = sources [ ' testing ' ] [ src ] [ VERSION ]
if not self . same_source ( tsrcv , self . hints [ " remove " ] [ src ] [ 0 ] ) : continue
if not self . same_source ( tsrcv , item . packages [ 0 ] . version ) : continue
# add the removal of the package to upgrade_me and build a new excuse
# add the removal of the package to upgrade_me and build a new excuse
upgrade_me . append ( " - %s " % ( src ) )
upgrade_me . append ( " - %s " % ( src ) )
excuse = Excuse ( " - %s " % ( src ) )
excuse = Excuse ( " - %s " % ( src ) )
excuse . set_vers ( tsrcv , None )
excuse . set_vers ( tsrcv , None )
excuse . addhtml ( " Removal request by %s " % ( self . hints [ " remove " ] [ src ] [ 1 ] ) )
excuse . addhtml ( " Removal request by %s " % ( item . packages [ 0 ] . user ) )
excuse . addhtml ( " Package is broken, will try to remove " )
excuse . addhtml ( " Package is broken, will try to remove " )
self . excuses . append ( excuse )
self . excuses . append ( excuse )
@ -1631,7 +1635,7 @@ class Britney:
self . invalidate_excuses ( upgrade_me , unconsidered )
self . invalidate_excuses ( upgrade_me , unconsidered )
# sort the list of candidates
# sort the list of candidates
self . upgrade_me = sorted ( upgrade_me )
self . upgrade_me = sorted ( [ MigrationItem ( x ) for x in upgrade_me ] )
# write excuses to the output file
# write excuses to the output file
if not self . options . dry_run :
if not self . options . dry_run :
@ -2252,7 +2256,7 @@ class Britney:
pre_process = { }
pre_process = { }
if selected and hint :
if selected and hint :
for package in selected :
for package in selected :
pkg , affected , undo = self . doop_source ( MigrationItem( package) )
pkg , affected , undo = self . doop_source ( package)
pre_process [ package ] = ( pkg , affected , undo )
pre_process [ package ] = ( pkg , affected , undo )
lundo = [ ]
lundo = [ ]
@ -2291,7 +2295,7 @@ class Britney:
if pkg in pre_process :
if pkg in pre_process :
item , affected , undo = pre_process [ pkg ]
item , affected , undo = pre_process [ pkg ]
else :
else :
item , affected , undo = self . doop_source ( MigrationItem( pkg) , lundo )
item , affected , undo = self . doop_source ( pkg, lundo )
if hint :
if hint :
lundo . append ( ( undo , item ) )
lundo . append ( ( undo , item ) )
@ -2371,7 +2375,7 @@ class Britney:
break
break
# if we are processing hints or the package is already accepted, go ahead
# if we are processing hints or the package is already accepted, go ahead
if hint or item . name in selected : continue
if hint or item in selected : continue
# check if the action improved the uninstallability counters
# check if the action improved the uninstallability counters
if better :
if better :
@ -2384,14 +2388,14 @@ class Britney:
self . output_write ( " pre: %s \n " % ( self . eval_nuninst ( nuninst_comp ) ) )
self . output_write ( " pre: %s \n " % ( self . eval_nuninst ( nuninst_comp ) ) )
self . output_write ( " now: %s \n " % ( self . eval_nuninst ( nuninst , nuninst_comp ) ) )
self . output_write ( " now: %s \n " % ( self . eval_nuninst ( nuninst , nuninst_comp ) ) )
if len ( selected ) < = 20 :
if len ( selected ) < = 20 :
self . output_write ( " all: %s \n " % ( " " . join ( selected ) ) )
self . output_write ( " all: %s \n " % ( " " . join ( [ str ( x ) for x in selected ] ) ) )
else :
else :
self . output_write ( " most: ( %d ) .. %s \n " % ( len ( selected ) , " " . join ( selected [ - 20 : ] ) ) )
self . output_write ( " most: ( %d ) .. %s \n " % ( len ( selected ) , " " . join ( [ str ( x ) for x in selected ] [ - 20 : ] ) ) )
for k in nuninst :
for k in nuninst :
nuninst_comp [ k ] = nuninst [ k ]
nuninst_comp [ k ] = nuninst [ k ]
else :
else :
self . output_write ( " skipped: %s ( %d <- %d ) \n " % ( pkg , len ( extra ) , len ( packages ) ) )
self . output_write ( " skipped: %s ( %d <- %d ) \n " % ( pkg , len ( extra ) , len ( packages ) ) )
self . output_write ( " got: %s \n " % ( self . eval_nuninst ( nuninst , " / " in pkg and nuninst_comp or None ) ) )
self . output_write ( " got: %s \n " % ( self . eval_nuninst ( nuninst , pkg . architecture != ' source ' and nuninst_comp or None ) ) )
self . output_write ( " * %s : %s \n " % ( arch , " , " . join ( sorted ( [ b for b in nuninst [ arch ] if b not in nuninst_comp [ arch ] ] ) ) ) )
self . output_write ( " * %s : %s \n " % ( arch , " , " . join ( sorted ( [ b for b in nuninst [ arch ] if b not in nuninst_comp [ arch ] ] ) ) ) )
extra . append ( pkg )
extra . append ( pkg )
@ -2438,7 +2442,7 @@ class Britney:
if hint :
if hint :
return ( nuninst_comp , [ ] , lundo )
return ( nuninst_comp , [ ] , lundo )
self . output_write ( " finish: [ %s ] \n " % " , " . join ( selected ) )
self . output_write ( " finish: [ %s ] \n " % " , " . join ( [ str ( x ) for x in selected ] ) )
self . output_write ( " endloop: %s \n " % ( self . eval_nuninst ( self . nuninst_orig ) ) )
self . output_write ( " endloop: %s \n " % ( self . eval_nuninst ( self . nuninst_orig ) ) )
self . output_write ( " now: %s \n " % ( self . eval_nuninst ( nuninst_comp ) ) )
self . output_write ( " now: %s \n " % ( self . eval_nuninst ( nuninst_comp ) ) )
self . output_write ( self . eval_uninst ( self . newlyuninst ( self . nuninst_orig , nuninst_comp ) ) )
self . output_write ( self . eval_uninst ( self . newlyuninst ( self . nuninst_orig , nuninst_comp ) ) )
@ -2471,10 +2475,10 @@ class Britney:
# if we have a list of initial packages, check them
# if we have a list of initial packages, check them
if init :
if init :
self . output_write ( " leading: %s \n " % ( " , " . join ( init ) ) )
self . output_write ( " leading: %s \n " % ( " , " . join ( [ str ( x ) for x in init ] ) ) )
for x in init :
for x in init :
if x not in upgrade_me :
if x not in upgrade_me :
self . output_write ( " failed: %s \n " % ( x ) )
self . output_write ( " failed: %s \n " % ( x . uvname ) )
return None
return None
selected . append ( x )
selected . append ( x )
upgrade_me . remove ( x )
upgrade_me . remove ( x )
@ -2509,7 +2513,7 @@ class Britney:
if nuninst_end :
if nuninst_end :
if not force and not earlyabort :
if not force and not earlyabort :
self . output_write ( " Apparently successful \n " )
self . output_write ( " Apparently successful \n " )
self . output_write ( " final: %s \n " % " , " . join ( sorted ( selected ) ) )
self . output_write ( " final: %s \n " % " , " . join ( sorted ( [ str ( x ) for x in selected ] ) ) )
self . output_write ( " start: %s \n " % self . eval_nuninst ( nuninst_start ) )
self . output_write ( " start: %s \n " % self . eval_nuninst ( nuninst_start ) )
if not force :
if not force :
self . output_write ( " orig: %s \n " % self . eval_nuninst ( self . nuninst_orig ) )
self . output_write ( " orig: %s \n " % self . eval_nuninst ( self . nuninst_orig ) )
@ -2594,11 +2598,11 @@ class Britney:
if not self . options . actions :
if not self . options . actions :
# process `easy' hints
# process `easy' hints
for x in self . hints [ ' easy ' ] :
for x in self . hints [ ' easy ' ] :
self . do_hint ( " easy " , x [ 0 ] , x [ 1 ] )
self . do_hint ( " easy " , x . user , x . packages )
# process `force-hint' hints
# process `force-hint' hints
for x in self . hints [ " force-hint " ] :
for x in self . hints [ " force-hint " ] :
self . do_hint ( " force-hint " , x [ 0 ] , x [ 1 ] )
self . do_hint ( " force-hint " , x . user , x . packages )
# run the first round of the upgrade
# run the first round of the upgrade
self . __log ( " > First loop on the packages with depth = 0 " , type = " I " )
self . __log ( " > First loop on the packages with depth = 0 " , type = " I " )
@ -2634,7 +2638,7 @@ class Britney:
if hintcnt > 50 :
if hintcnt > 50 :
self . output_write ( " Skipping remaining hints... " )
self . output_write ( " Skipping remaining hints... " )
break
break
if self . do_hint ( " hint " , x [ 0 ] , x [ 1 ] ) :
if self . do_hint ( " hint " , x . user , x . packages ) :
hintcnt + = 1
hintcnt + = 1
# run the auto hinter
# run the auto hinter
@ -2729,38 +2733,38 @@ class Britney:
" hint " : 0 ,
" hint " : 0 ,
" force-hint " : - 1 , }
" force-hint " : - 1 , }
if isinstance ( pkgvers [ 0 ] , tuple ) :
_pkgvers = [ HintItem ( ' %s / %s ' % ( p , v ) ) for ( p , v ) in pkgvers ]
else :
_pkgvers = pkgvers
self . __log ( " > Processing ' %s ' hint from %s " % ( type , who ) , type = " I " )
self . __log ( " > Processing ' %s ' hint from %s " % ( type , who ) , type = " I " )
self . output_write ( " Trying %s from %s : %s \n " % ( type , who , " " . join ( [ " %s / %s " % ( p , v ) for ( p , v ) in pkgvers ] ) ) )
self . output_write ( " Trying %s from %s : %s \n " % ( type , who , " " . join ( [ " %s / %s " % ( x. uvname , x . version ) for x in _ pkgvers] ) ) )
ok = True
ok = True
# loop on the requested packages and versions
# loop on the requested packages and versions
for pkg , v in pkgvers :
for pkg in _pkgvers :
# remove architecture
if " / " in pkg :
pkg = pkg [ : pkg . find ( " / " ) ]
# skip removal requests
# skip removal requests
if pkg [ 0 ] == " - " :
if pkg . is_removal :
continue
continue
# handle *-proposed-updates
# handle *-proposed-updates
elif pkg . endswith ( " _tpu " ) or pkg . endswith ( " _pu " ) :
elif pkg . suite in [ ' pu ' , ' tpu ' ] :
pkg , suite = pkg . rsplit ( " _ " )
if pkg . package not in self . sources [ pkg . suite ] : continue
if pkg not in self . sources [ suite ] : continue
if apt_pkg . VersionCompare ( self . sources [ pkg . suite ] [ pkg . package ] [ VERSION ] , pkg . version ) != 0 :
if apt_pkg . VersionCompare ( self . sources [ suite ] [ pkg ] [ VERSION ] , v ) != 0 :
self . output_write ( " Version mismatch, %s %s != %s \n " % ( pkg . package , pkg . version , self . sources [ suite ] [ pkg . package ] [ VERSION ] ) )
self . output_write ( " Version mismatch, %s %s != %s \n " % ( pkg , v , self . sources [ suite ] [ pkg ] [ VERSION ] ) )
ok = False
ok = False
# does the package exist in unstable?
# does the package exist in unstable?
elif pkg not in self . sources [ ' unstable ' ] :
elif pkg . package not in self . sources [ ' unstable ' ] :
self . output_write ( " Source %s has no version in unstable \n " % pkg )
self . output_write ( " Source %s has no version in unstable \n " % pkg . package )
ok = False
ok = False
elif apt_pkg . VersionCompare ( self . sources [ ' unstable ' ] [ pkg ] [ VERSION ] , v) != 0 :
elif apt_pkg . VersionCompare ( self . sources [ ' unstable ' ] [ pkg . package ] [ VERSION ] , pkg. version ) != 0 :
self . output_write ( " Version mismatch, %s %s != %s \n " % ( pkg , v, self . sources [ ' unstable ' ] [ pkg ] [ VERSION ] ) )
self . output_write ( " Version mismatch, %s %s != %s \n " % ( pkg . package , pkg. version , self . sources [ ' unstable ' ] [ pkg . package ] [ VERSION ] ) )
ok = False
ok = False
if not ok :
if not ok :
self . output_write ( " Not using hint \n " )
self . output_write ( " Not using hint \n " )
return False
return False
self . do_all ( hintinfo [ type ] , map ( operator . itemgetter ( 0 ) , pkgvers ) )
self . do_all ( hintinfo [ type ] , _pkgvers )
return True
return True
def sort_actions ( self ) :
def sort_actions ( self ) :
@ -2814,7 +2818,7 @@ class Britney:
self . __log ( " > Processing hints from the auto hinter " , type = " I " )
self . __log ( " > Processing hints from the auto hinter " , type = " I " )
# consider only excuses which are valid candidates
# consider only excuses which are valid candidates
excuses = dict ( [ ( x . name , x ) for x in self . excuses if x . name in self . upgrade_me ] )
excuses = dict ( [ ( x . name , x ) for x in self . excuses if x . name in [ y . uvname for y in self . upgrade_me ] ] )
def find_related ( e , hint , circular_first = False ) :
def find_related ( e , hint , circular_first = False ) :
if e not in excuses :
if e not in excuses :
@ -2866,7 +2870,7 @@ class Britney:
to_skip . append ( i )
to_skip . append ( i )
for i in range ( len ( candidates ) ) :
for i in range ( len ( candidates ) ) :
if i not in to_skip :
if i not in to_skip :
self . do_hint ( " easy " , " autohinter " , candidates [ i ] )
self . do_hint ( " easy " , " autohinter " , [ HintItem ( " %s / %s " % ( x [ 0 ] , x [ 1 ] ) ) for x in candidates [ i ] ] )
def old_libraries ( self ) :
def old_libraries ( self ) :
""" Detect old libraries left in testing for smooth transitions
""" Detect old libraries left in testing for smooth transitions