Package: debdelta
Version: 0.50+2
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch saucy

Hi,

I'm working on a system that involves unpacking .debs to locations other
than /, and it would be nice to be able to use debpatch on these.  It's
great that it generally supports applying patches to the unpacked
package directly; it's just that it only does so if they're unpacked to
/.  I would suggest that the test could reasonably be "is a directory"
rather than "is /".

  * Allow patching without a .deb even if the unpack directory is something
    other than .deb.

diff -ru debdelta-0.50+2.orig/debdelta debdelta-0.50+2/debdelta
--- debdelta-0.50+2.orig/debdelta       2012-11-07 10:09:14.000000000 +0000
+++ debdelta-0.50+2/debdelta    2013-05-30 14:45:36.548094320 +0100
@@ -71,7 +71,7 @@
   Applies delta to fromfile and produces a reconstructed  version of tofile.
 
 (When using 'debpatch' and the old .deb is not available,
-  use '/' for the fromfile.)
+  use the unpack directory, usually '/', for the fromfile.)
 
 Usage: debpatch --info delta
   Write info on delta.
@@ -970,7 +970,7 @@
   free=freespace(TMPDIR)
   if free == None : return True
   free = free / 1024
-  if olddeb == '/':
+  if os.path.isdir(olddeb):
     instsize=int(params['NEW/Installed-Size'])
     #the last action of the script is to gzip the data.tar, so
     if 'NEW/Size' in params :
@@ -1396,7 +1396,7 @@
   if newdeb:
     newdebshortname=newdeb
     newdeb=abspath(newdeb)
-  if olddeb != '/':
+  if not os.path.isdir(olddeb):
     olddeb=abspath(olddeb)
   elif diversions == None:
     diversions=scan_diversions()
@@ -1406,7 +1406,7 @@
   
   check_is_delta(delta)
 
-  if olddeb != '/':
+  if not os.path.isdir(olddeb):
       check_deb(olddeb)
   
   temp_name, temp_err_name, ret=system(('ar','xvo',delta), TD+'/PATCH', 
return_output=True, ignore_output=True)
@@ -1462,14 +1462,14 @@
   if s != True:
     raise DebDeltaError('Sorry, '+s, True )
 
-  if olddeb != '/':
+  if not os.path.isdir(olddeb):
       os.symlink(olddeb,TD+'/OLD.file')
       #unpack the old control structure, if available
       os.mkdir(TD+'/OLD/CONTROL')
       #unpack control.tar.gz
       
system(('ar','p',TD+'OLD.file','control.tar.gz','|','tar','-xzp','-f','-','-C',TD+'OLD/CONTROL'),TD)
   #then we check for the conformance
-  if olddeb != '/' and 'OLD/Size' in params:
+  if not os.path.isdir(olddeb) and 'OLD/Size' in params:
     olddebsize = os.stat(olddeb)[ST_SIZE]
     if olddebsize != int(params['OLD/Size']):
       raise DebDeltaError('Old deb size is '+str(olddebsize)+' instead of 
'+params['OLD/Size'])
@@ -1480,13 +1480,13 @@
       #this is currently disabled, since  'dpkg -s' is vey slow (~ 1.6 sec)
       dpkg_params={}
       b=params['OLD/Package']
-      if olddeb == '/' :
+      if os.path.isdir(olddeb):
         p=my_popen_read('env -i dpkg -s '+b)
       else:        
         p=open(TD+'OLD/CONTROL/control')
       scan_control(p,params=dpkg_params,prefix='OLD')
       p.close()
-      if  olddeb == '/' :
+      if os.path.isdir(olddeb):
         if 'OLD/Status' not in dpkg_params:
           die('Error: package %s is not known to dpkg.' % b)
         if  dpkg_params['OLD/Status'] != 'install ok installed' :
@@ -1678,11 +1678,11 @@
   
   for a in params:
     if 'needs-old' == a:
-      if olddeb == '/':
+      if os.path.isdir(olddeb):
         die('This patch needs the old version Debian package')
     elif 'old-data-tree' == a :
       os.mkdir(TD+'/OLD/DATA')
-      if olddeb == '/':
+      if os.path.isdir(olddeb):
         file_triples, localepurged, prelink_u_failed, diverted, prelink_time, 
prelink_datasize=\
           
_symlink_data_tree(params['OLD/Package'],params['OLD/Architecture'],TD,diversions,runtime)
       else:
@@ -1702,7 +1702,7 @@
         else: assert(0)
         _fix_data_tree_(TD)
     elif 'old-control-tree' == a:
-        if olddeb == '/':
+        if os.path.isdir(olddeb):
           if not os.path.isdir(TD+'OLD/CONTROL'):
             os.mkdir(TD+'OLD/CONTROL')
           p=params['OLD/Package']
@@ -1906,7 +1906,7 @@
   if not FORENSIC:
     def fore():
       return None
-  elif olddeb != '/':
+  elif not os.path.isdir(olddeb):
     def fore():
       f=[delta,olddeb]
       tempos(f)

Thanks,

-- 
Colin Watson                                       [cjwat...@ubuntu.com]


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to