[elbe-devel] [PATCH 2/3] fetch_initvm_pkgs: switch to our own fixed version of fetch_binary

Torben Hohn torben.hohn at linutronix.de
Wed Dec 4 17:37:28 CET 2019


Version.fetch_binary() from python-apt sometimes fails, because the
md5_hash does not seem to exist.

--------------------------------------------------------------------------------
Oct 20 07:39:21 in-target: Traceback (most recent call last):
Oct 20 07:39:21 in-target:   File "/bin/elbe", line 55, in <module>
Oct 20 07:39:21 in-target:     cmdmod.run_command(sys.argv[2:])
Oct 20 07:39:21 in-target:   File "/usr/lib/python2.7/dist-packages/elbepack/commands/fetch_initvm_pkgs.py", line 108, in run_command
Oct 20 07:39:21 in-target:     ElbeAcquireProgress(cb=None))
Oct 20 07:39:21 in-target:   File "/usr/lib/python2.7/dist-packages/apt/package.py", line 867, in fetch_binary
Oct 20 07:39:21 in-target:     if _file_is_same(destfile, self.size, self._records.md5_hash):
Oct 20 07:39:21 in-target: SystemError: error return without exception set
--------------------------------------------------------------------------------

Use our own implementation from the previous commit, which only validates
sha256.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/commands/fetch_initvm_pkgs.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/elbepack/commands/fetch_initvm_pkgs.py b/elbepack/commands/fetch_initvm_pkgs.py
index 46c3299df..992f1af92 100644
--- a/elbepack/commands/fetch_initvm_pkgs.py
+++ b/elbepack/commands/fetch_initvm_pkgs.py
@@ -20,6 +20,7 @@ from elbepack.aptprogress import ElbeAcquireProgress
 from elbepack.filesystem import hostfs
 from elbepack.log import elbe_logging
 from elbepack.shellhelper import do
+from elbepack.aptpkgutils import fetch_binary
 
 
 def run_command(argv):
@@ -104,8 +105,9 @@ def run_command(argv):
                 try:
                     p = cache[pkg.name]
                     pkgver = p.installed
-                    deb = pkgver.fetch_binary(opt.archive,
-                                              ElbeAcquireProgress(cb=None))
+                    deb = fetch_binary(pkgver,
+                                       opt.archive,
+                                       ElbeAcquireProgress(cb=None))
                     repo.includedeb(deb, 'main')
                 except ValueError:
                     logging.exception('No package "%s"', pkg_id)
-- 
2.20.1




More information about the elbe-devel mailing list