summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-11-07 21:52:48 +0000
committerZac Medico <zmedico@gentoo.org>2008-11-07 21:52:48 +0000
commitea1de47bea337f578754db7ce21c1bbd69701f7a (patch)
tree217390b49f1e54202b348eb973df37cd745d209d
parent06fa273bc44126e72ca8e9170614cb0a40b59c72 (diff)
downloadportage-ea1de47bea337f578754db7ce21c1bbd69701f7a.tar.gz
portage-ea1de47bea337f578754db7ce21c1bbd69701f7a.tar.bz2
portage-ea1de47bea337f578754db7ce21c1bbd69701f7a.zip
Handle a potential OSError that occurs if the scanelf binary is missing
when LinkageMap.rebuild() is called. svn path=/main/trunk/; revision=11825
-rw-r--r--pym/portage/dbapi/vartree.py34
1 files changed, 20 insertions, 14 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index cce5b69f0..5d6e8f578 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -278,20 +278,26 @@ class LinkageMap(object):
for items in self._dbapi.plib_registry.getPreservedLibs().values():
args.extend(os.path.join(root, x.lstrip("." + os.sep)) \
for x in items)
- proc = subprocess.Popen(args, stdout=subprocess.PIPE)
- for l in proc.stdout:
- l = l[3:].rstrip("\n")
- if not l:
- continue
- fields = l.split(";")
- if len(fields) < 5:
- writemsg_level("\nWrong number of fields " + \
- "returned from scanelf: %s\n\n" % (l,),
- level=logging.ERROR, noiselevel=-1)
- continue
- fields[1] = fields[1][root_len:]
- lines.append(";".join(fields))
- proc.wait()
+ try:
+ proc = subprocess.Popen(args, stdout=subprocess.PIPE)
+ except EnvironmentError, e:
+ writemsg_level("\nUnable to execute %s: %s\n\n" % (args[0], e),
+ level=logging.ERROR, noiselevel=-1)
+ del e
+ else:
+ for l in proc.stdout:
+ l = l[3:].rstrip("\n")
+ if not l:
+ continue
+ fields = l.split(";")
+ if len(fields) < 5:
+ writemsg_level("\nWrong number of fields " + \
+ "returned from scanelf: %s\n\n" % (l,),
+ level=logging.ERROR, noiselevel=-1)
+ continue
+ fields[1] = fields[1][root_len:]
+ lines.append(";".join(fields))
+ proc.wait()
for l in lines:
l = l.rstrip("\n")