*** debdelta	2006/12/21 13:02:11	1.105
--- debdelta	2006/12/21 13:53:58
***************
*** 452,467 ****
    #if s : sys.stderr.write(s+'\n')
    raise DebDeltaError,s
    
! def system(a,TD):
!   if type(a) != StringType :
!     a=string.join(a,' ')
    if VERBOSE and TD[: (len(TMPDIR)+9) ] != TMPDIR+'/debdelta' :
!     print 'Warning "system()" in ',TD,' for ',a
!   ret = os.system("cd '" +TD +"' ; "+a)  
!   if ret == 2:
!     raise KeyboardInterrupt
!   if  ret != 0 and ( ret != 256 or a[:6] != 'xdelta') :
!     die('Error , non zero return status '+str(ret)+' for command "'+a+'"')
  
  def check_deb(f):
    if not  os.path.isfile(f) :
--- 452,492 ----
    #if s : sys.stderr.write(s+'\n')
    raise DebDeltaError,s
    
! def system(a,TD,timeout=None):
    if VERBOSE and TD[: (len(TMPDIR)+9) ] != TMPDIR+'/debdelta' :
!     print 'Warning "spawn()" in ',TD,' for ',repr(a)
!   if type(a)==StringType:
!     print 'Warning "string spawn()"  for ',repr(a)
!     a=string.split(a,' ')
!   p=os.fork()
!   if p==0:
!     ret=os.spawnvpe(os.P_WAIT, a[0], a, os.environ)
!   else:
!      while p and timeout > 0:
!         os.sleep(1)
!         timeout = timeout - 1
!         if timeout <= 0:
!           os.kill(p)
!           
!   def __s__(A):
!     A[0]=os.spawnvpe(os.P_WAIT, a[0], a, os.environ)
! 
!   ret=None
!   T=start_new_thread(__s__,  [[ret,],]
!   
!   if p==0:
!     os.chdir(TD)
!     return 
!   else:
!     if timeout == None:
!       ret=os.waitpid(p)
!     else:
!      
!         
!     if ret == 2:
!       raise KeyboardInterrupt
!     if  ret != 0 and ( ret != 256 or a[:6] != 'xdelta') :
!       die('Error , non zero return status '+str(ret)+' for command "'+a+'"')
  
  def check_deb(f):
    if not  os.path.isfile(f) :
***************
*** 1065,1071 ****
      ## but , in my experiments, this number is more like 12.
      ##But bsdiff is sooooo slow!
      elif algo == 'bsdiff' : # not ALLOW_XDELTA or ( osize < (MAXMEMORY / 12)):    
!       system('bsdiff  '+o+' '+n+' '+p,TD)
        script.write('bspatch '+o+' '+n+' '+p+'; rm '+p+'\n')
      #seems that 'xdelta' is buggy on 64bit and different-endian machines
      #xdelta does not deal with different endianness!
--- 1090,1097 ----
      ## but , in my experiments, this number is more like 12.
      ##But bsdiff is sooooo slow!
      elif algo == 'bsdiff' : # not ALLOW_XDELTA or ( osize < (MAXMEMORY / 12)):    
!       p=os.spae????nl(os.P_NOWAIT,'bsdiff  '+o+' '+n+' '+p,TD)
!       while 
        script.write('bspatch '+o+' '+n+' '+p+'; rm '+p+'\n')
      #seems that 'xdelta' is buggy on 64bit and different-endian machines
      #xdelta does not deal with different endianness!
