Package: debdelta
Version: 0.53
Severity: normal
Tags: patch

Dear Andrea,

I sometimes make use of debpatch-url so that I can download debdeltas
using a non-Debian system.  I have found that in a similar vein to Bug
#692194, debpatch-url will attach a :i386 to the package name on an
amd64 system, so that the incorrect URL is output.  I have included a
patch to fix this.

In addition to this, however, I have had some second thoughts on what
the correct output should be in regards to quoting the URLs.  I know
this can easily be fixed in scripts, but why shouldn't the output URLs
be able to open, when displayed on a terminal that supports links, in
the same way that apt-get --print-uris does?

The fact is, however, apt-get doesn't have this problem with URL quoting
the way debdelta does, because epochs don't seem to be used in deb file
names on Debian mirrors.  They only get used in file names when the deb
file is stored in the local cache.  I wonder if the use of epochs in
debdelta file names is redundant.

Best regards,

Carlos

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages debdelta depends on:
ii  binutils    2.24-3
ii  bzip2       1.0.6-5
ii  libbz2-1.0  1.0.6-5
ii  libc6       2.18-3
ii  python      2.7.5-5
ii  zlib1g      1:1.2.8.dfsg-1

Versions of packages debdelta recommends:
ii  bsdiff           4.3-15
ii  gnupg-agent      2.0.22-3
ii  gnupg2           2.0.22-3
ii  lzma             9.22-2
ii  python-apt       0.9.3.1
ii  xdelta           1.1.3-9
ii  xdelta3          3.0.8-dfsg-1
ii  xz-utils [lzma]  5.1.1alpha+20120614-2

Versions of packages debdelta suggests:
ii  debdelta-doc  0.50+2

-- no debconf information
diff --git a/debdelta/debdelta b/debdelta/debdelta
index 9708eb5..065cf8d 100755
--- a/debdelta/debdelta
+++ b/debdelta/debdelta
@@ -572,7 +572,14 @@ def version_demangle(v):
     return join(v.split('%3a'),':')
   else:
     return v
-  
+
+def delta_base_name(pkg, old_ver, new_ver, arch, ext='.debdelta'):
+  assert(':' not in pkg)
+  return pkg + \
+         '_' + version_mangle(old_ver) + \
+         '_' + version_mangle(new_ver) + \
+         '_' + arch + ext
+
 def tempo():
   TD = abspath(tempfile.mkdtemp(prefix='debdelta',dir=TMPDIR))
   for i in 'OLD','NEW','PATCH' :
@@ -3743,8 +3750,7 @@ def do_deltas(debs):
           continue
         
         assert( old['Package'] == pa and pa == new['Package'] )
-        deltabasename = pa +'_'+  version_mangle(old['Version']) +\
-                        '_'+ version_mangle(new['Version']) +'_'+ar+'.debdelta'
+        deltabasename = delta_base_name(pa, old['Version'], new['Version'], ar)
 
         if 'Filename' in new:
           deltadirname=delta_dirname(os.path.dirname(new['Filename']),DIR)
@@ -4545,13 +4551,13 @@ def delta_upgrade_(args):
       deb_path=string.join(deb_path[(thepoolindex):],'/')
       
       #try all possible variants of the filename
-      newdebs=[p.name+'_'+candidate_version+'_'+arch+'.deb',
+      newdebs=[p.shortname+'_'+candidate_version+'_'+arch+'.deb',
                os.path.basename(deb_uri)]
       if ':' in candidate_version:
         a=candidate_version.split(':')
-        newdebs.append(p.name+'_'+a[1]+'_'+arch+'.deb')
-        newdebs.append(p.name+'_'+a[0]+'%3A'+a[1]+'_'+arch+'.deb')
-        newdebs.append(p.name+'_'+a[0]+'%3a'+a[1]+'_'+arch+'.deb')
+        newdebs.append(p.shortname+'_'+a[1]+'_'+arch+'.deb')
+        newdebs.append(p.shortname+'_'+a[0]+'%3A'+a[1]+'_'+arch+'.deb')
+        newdebs.append(p.shortname+'_'+a[0]+'%3a'+a[1]+'_'+arch+'.deb')
       
       for newdeb in newdebs:
         if os.path.exists(DEB_DIR+'/'+newdeb) or \
@@ -4579,9 +4585,8 @@ def delta_upgrade_(args):
       assert(a[0] == 'http')
 
       #delta name
-      delta_name=p.name.split(':')[0]+'_'+version_mangle(installed_version)+\
-                  '_'+ version_mangle(candidate_version)+'_'+\
-                  arch+'.debdelta'
+      delta_name = delta_base_name(p.shortname, installed_version,
+                                   candidate_version, arch)
 
       uri=delta_uri_base+'/'+os.path.dirname(deb_path)+'/'+delta_name
       
@@ -4966,9 +4971,8 @@ elif action == 'patch-url':
       continue
 
     #delta name
-    delta_name=p.name+'_'+version_mangle(installed_version)+\
-                '_'+ version_mangle(candidate_version)+'_'+\
-                arch+'.debdelta'
+    delta_name = delta_base_name(p.shortname, installed_version,
+                                 candidate_version, arch)
   
     uri=delta_uri_base+'/'+os.path.dirname(deb_path)+'/'+delta_name
 

Reply via email to