@ -630,13 +630,11 @@ class AutopkgtestPolicy(BasePolicy):
pass
pass
trigger = source_name + ' / ' + source_version
trigger = source_name + ' / ' + source_version
triggers . discard ( trigger )
triggers . discard ( trigger )
trigger_str = trigger
triggers_list = sorted ( list ( triggers ) )
if triggers :
triggers_list . insert ( 0 , trigger )
# Make the order (minus the "real" trigger) deterministic
trigger_str + = ' ' + ' ' . join ( sorted ( list ( triggers ) ) )
for ( testsrc , testver ) in tests :
for ( testsrc , testver ) in tests :
self . pkg_test_request ( testsrc , arch , trigger _str , huge = is_huge )
self . pkg_test_request ( testsrc , arch , trigger s _li st, huge = is_huge )
( result , real_ver , run_id , url ) = self . pkg_test_result ( testsrc , testver , arch , trigger )
( result , real_ver , run_id , url ) = self . pkg_test_result ( testsrc , testver , arch , trigger )
pkg_arch_result [ ( testsrc , real_ver ) ] [ arch ] = ( result , run_id , url )
pkg_arch_result [ ( testsrc , real_ver ) ] [ arch ] = ( result , run_id , url )
@ -978,8 +976,8 @@ class AutopkgtestPolicy(BasePolicy):
result [ 2 ] = run_id
result [ 2 ] = run_id
result [ 3 ] = seen
result [ 3 ] = seen
def send_test_request ( self , src , arch , trigger , huge = False ) :
def send_test_request ( self , src , arch , trigger s , huge = False ) :
''' Send out AMQP request for testing src/arch for trigger
''' Send out AMQP request for testing src/arch for trigger s
If huge is true , then the request will be put into the - huge instead of
If huge is true , then the request will be put into the - huge instead of
normal queue .
normal queue .
@ -987,7 +985,7 @@ class AutopkgtestPolicy(BasePolicy):
if self . options . dry_run :
if self . options . dry_run :
return
return
params = { ' triggers ' : [ trigger ] }
params = { ' triggers ' : triggers }
if self . options . adt_ppas :
if self . options . adt_ppas :
params [ ' ppas ' ] = self . options . adt_ppas
params [ ' ppas ' ] = self . options . adt_ppas
qname = ' debci-ppa- %s - %s ' % ( self . options . series , arch )
qname = ' debci-ppa- %s - %s ' % ( self . options . series , arch )
@ -996,18 +994,21 @@ class AutopkgtestPolicy(BasePolicy):
else :
else :
qname = ' debci- %s - %s ' % ( self . options . series , arch )
qname = ' debci- %s - %s ' % ( self . options . series , arch )
params [ ' submit-time ' ] = datetime . strftime ( datetime . utcnow ( ) , ' % Y- % m- %d % H: % M: % S % z ' )
params [ ' submit-time ' ] = datetime . strftime ( datetime . utcnow ( ) , ' % Y- % m- %d % H: % M: % S % z ' )
params = json . dumps ( params )
if self . amqp_channel :
if self . amqp_channel :
params = json . dumps ( params )
self . amqp_channel . basic_publish ( amqp . Message ( src + ' \n ' + params ,
self . amqp_channel . basic_publish ( amqp . Message ( src + ' \n ' + params ,
delivery_mode = 2 ) , # persistent
delivery_mode = 2 ) , # persistent
routing_key = qname )
routing_key = qname )
else :
else :
# for file-based submission, triggers are space separated
params [ ' triggers ' ] = [ ' ' . join ( params [ ' triggers ' ] ) ]
params = json . dumps ( params )
assert self . amqp_file
assert self . amqp_file
with open ( self . amqp_file , ' a ' ) as f :
with open ( self . amqp_file , ' a ' ) as f :
f . write ( ' %s : %s %s \n ' % ( qname , src , params ) )
f . write ( ' %s : %s %s \n ' % ( qname , src , params ) )
def pkg_test_request ( self , src , arch , full_trigger , huge = False ) :
def pkg_test_request ( self , src , arch , full_trigger s , huge = False ) :
''' Request one package test for one particular trigger
''' Request one package test for one particular trigger
trigger is " pkgname/version " of the package that triggers the testing
trigger is " pkgname/version " of the package that triggers the testing
@ -1020,7 +1021,7 @@ class AutopkgtestPolicy(BasePolicy):
ensures to download current results for this package before
ensures to download current results for this package before
requesting any test .
requesting any test .
'''
'''
trigger = full_trigger . split( ) [ 0 ]
trigger = full_trigger s[ 0 ]
uses_swift = not self . options . adt_swift_url . startswith ( ' file:// ' )
uses_swift = not self . options . adt_swift_url . startswith ( ' file:// ' )
try :
try :
result = self . test_results [ trigger ] [ src ] [ arch ]
result = self . test_results [ trigger ] [ src ] [ arch ]
@ -1058,11 +1059,11 @@ class AutopkgtestPolicy(BasePolicy):
except KeyError :
except KeyError :
pass
pass
self . request_test_if_not_queued ( src , arch , trigger , full_trigger , huge = huge )
self . request_test_if_not_queued ( src , arch , trigger , full_trigger s , huge = huge )
def request_test_if_not_queued ( self , src , arch , trigger , full_trigger = None , huge = False ) :
def request_test_if_not_queued ( self , src , arch , trigger , full_trigger s= [ ] , huge = False ) :
if full_trigger i s None :
if not full_trigger s:
full_trigger = trigger
full_trigger s = [ trigger ]
# Don't re-request if it's already pending
# Don't re-request if it's already pending
arch_list = self . pending_tests . setdefault ( trigger , { } ) . setdefault ( src , [ ] )
arch_list = self . pending_tests . setdefault ( trigger , { } ) . setdefault ( src , [ ] )
@ -1072,7 +1073,7 @@ class AutopkgtestPolicy(BasePolicy):
self . logger . info ( ' Requesting %s autopkgtest on %s to verify %s ' , src , arch , trigger )
self . logger . info ( ' Requesting %s autopkgtest on %s to verify %s ' , src , arch , trigger )
arch_list . append ( arch )
arch_list . append ( arch )
arch_list . sort ( )
arch_list . sort ( )
self . send_test_request ( src , arch , full_trigger , huge = huge )
self . send_test_request ( src , arch , full_trigger s , huge = huge )
# save pending.json right away, so that we don't re-request if britney crashes
# save pending.json right away, so that we don't re-request if britney crashes
self . save_pending_json ( )
self . save_pending_json ( )