[yocto] [opkg-utils][PATCH 01/22] opkg-make-index: don't error out when some package disappears
Martin Jansa
martin.jansa at gmail.com
Thu Mar 29 15:22:35 PDT 2012
From: Richard Purdie <richard.purdie at linuxfoundation.org>
* If we're building an image and some package rebuilds while this is
happening some package can be removed/added to the ipk deploy
directory. The image will not depend on this package so we can
safely ignore these cases rather than error out.
Signed-off-by: Martin Jansa <Martin.Jansa at gmail.com>
---
opkg-make-index | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/opkg-make-index b/opkg-make-index
index ae829e6..2f1ae17 100755
--- a/opkg-make-index
+++ b/opkg-make-index
@@ -96,6 +96,7 @@ if (verbose):
files=glob(pkg_dir + '/*.opk') + glob(pkg_dir + '/*.deb') + glob(pkg_dir + '/*.ipk')
files.sort()
for filename in files:
+ try:
basename = os.path.basename(filename)
pkg = None
fnameStat = os.stat(filename)
@@ -130,6 +131,12 @@ for filename in files:
to_morgue(basename)
if opt_s:
print filename
+ except OSError:
+ sys.stderr.write("Package %s disappeared on us!\n" % (filename))
+ continue
+ except IOError:
+ sys.stderr.write("Package %s disappeared on us!\n" % (filename))
+ continue
pkgsStampsFile = open(stamplist_filename, "w")
for f in pkgsStamps.keys():
@@ -148,6 +155,7 @@ if packages_filename:
names = packages.packages.keys()
names.sort()
for name in names:
+ try:
pkg = packages.packages[name]
if locales_dir and pkg.depends:
depends = string.split(pkg.depends, ',')
@@ -165,6 +173,13 @@ for name in names:
if (verbose):
sys.stderr.write("Writing info for package %s\n" % (pkg.package,))
print pkg
+ except OSError:
+ sys.stderr.write("Package %s disappeared on us!\n" % (name))
+ continue
+ except IOError:
+ sys.stderr.write("Package %s disappeared on us!\n" % (name))
+ continue
+
if packages_filename:
sys.stdout.close()
sys.stdout = old_stdout
@@ -182,7 +197,15 @@ files = {}
names = packages.packages.keys()
names.sort()
for name in names:
- for fn in packages[name].get_file_list():
+ try:
+ fnlist = packages[name].get_file_list()
+ except OSError, e:
+ sys.stderr.write("Package %s disappeared on us!\n" % (name))
+ continue
+ except IOError, e:
+ sys.stderr.write("Package %s disappeared on us!\n" % (name))
+ continue
+ for fn in fnlist:
(h,t) = os.path.split(fn)
if not t: continue
if not files.has_key(t): files[t] = name+':'+fn
--
1.7.8.5
More information about the yocto
mailing list