blob: 68ddae88e8c74e317c15753540c96f21ae2967c2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
From: Martin Jansa <Martin.Jansa@gmail.com>
Date: Thu, 29 Mar 2012 14:34:46 +0200
Subject: [PATCH] opkg.py: catch TypeError when reading control file, to show
which one is failing
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
---
opkg.py | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/opkg.py b/opkg.py
index 856e057..299e84e 100644
--- a/opkg.py
+++ b/opkg.py
@@ -161,7 +161,10 @@ class Package:
control = tarf.extractfile("control")
except KeyError:
control = tarf.extractfile("./control")
- self.read_control(control)
+ try:
+ self.read_control(control)
+ except TypeError as e:
+ sys.stderr.write("Cannot read control file '%s' - %s\n" % (fn, e))
control.close()
self.scratch_dir = None
@@ -457,9 +460,13 @@ class Packages:
def read_packages_file(self, fn):
f = open(fn, "r")
- while 1:
+ while True:
pkg = Package()
- pkg.read_control(f)
+ try:
+ pkg.read_control(f)
+ except TypeError as e:
+ sys.stderr.write("Cannot read control file '%s' - %s\n" % (fn, e))
+ continue
if pkg.get_package():
self.add_package(pkg)
else:
|