Comment 15 for bug 1503979

Revision history for this message
Steve Beattie (sbeattie) wrote :

Julian, sorry, but python-apt in get_release_filename_for_pkg() hardcodes the string '_Release' to the path returned by the function regardless of whether apt has downloaded a _Release or _InRelease file. Here's a prototype patch I worked up to address that:

diff -Nru python-apt-1.0.1build1/apt/utils.py python-apt-1.0.1ubuntu0.1~test2/apt/utils.py
--- python-apt-1.0.1build1/apt/utils.py 2015-10-01 13:12:19.000000000 -0700
+++ python-apt-1.0.1ubuntu0.1~test2/apt/utils.py 2015-10-23 16:06:36.000000000 -0700
@@ -82,7 +82,9 @@
                     indexfile.describe == m.describe and
                     indexfile.is_trusted):
                 dirname = apt_pkg.config.find_dir("Dir::State::lists")
- name = (apt_pkg.uri_to_filename(metaindex.uri) +
- "dists_%s_Release" % metaindex.dist)
- return dirname + name
+ for relfile in ['Release', 'InRelease']:
+ name = (apt_pkg.uri_to_filename(metaindex.uri) +
+ "dists_%s_%s" % (metaindex.dist, relfile))
+ if os.path.exists(dirname + name):
+ return dirname + name
     return None