index: Heal multithreading related output problems
index rewinds the line without writing \n which garbles the output when an exception is caught.
This commit is contained in:
+8
-3
@@ -114,6 +114,8 @@ class Index(xmlfile.XmlFile):
|
|||||||
if fn == 'groups.xml':
|
if fn == 'groups.xml':
|
||||||
self.groups.extend(add_groups(os.path.join(root, fn)))
|
self.groups.extend(add_groups(os.path.join(root, fn)))
|
||||||
|
|
||||||
|
print
|
||||||
|
|
||||||
# Create a process pool, as many processes as the number of CPUs we
|
# Create a process pool, as many processes as the number of CPUs we
|
||||||
# have
|
# have
|
||||||
pool = multiprocessing.Pool()
|
pool = multiprocessing.Pool()
|
||||||
@@ -128,9 +130,9 @@ class Index(xmlfile.XmlFile):
|
|||||||
# immediately terminate worker processes and propagate
|
# immediately terminate worker processes and propagate
|
||||||
# exception. (CLI honors KeyboardInterrupt exception, if you're
|
# exception. (CLI honors KeyboardInterrupt exception, if you're
|
||||||
# not using CLI, you must handle KeyboardException yourself)
|
# not using CLI, you must handle KeyboardException yourself)
|
||||||
|
|
||||||
pool.terminate()
|
pool.terminate()
|
||||||
pool.join()
|
pool.join()
|
||||||
|
print
|
||||||
raise
|
raise
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -160,6 +162,7 @@ class Index(xmlfile.XmlFile):
|
|||||||
except:
|
except:
|
||||||
pool.terminate()
|
pool.terminate()
|
||||||
pool.join()
|
pool.join()
|
||||||
|
print
|
||||||
raise
|
raise
|
||||||
|
|
||||||
pool.close()
|
pool.close()
|
||||||
@@ -187,6 +190,7 @@ def add_package(params):
|
|||||||
# check package semantics
|
# check package semantics
|
||||||
errs = md.errors()
|
errs = md.errors()
|
||||||
if md.errors():
|
if md.errors():
|
||||||
|
print
|
||||||
ctx.ui.error(_('Package %s: metadata corrupt, skipping...') % md.package.name)
|
ctx.ui.error(_('Package %s: metadata corrupt, skipping...') % md.package.name)
|
||||||
ctx.ui.error(unicode(Error(*errs)))
|
ctx.ui.error(unicode(Error(*errs)))
|
||||||
else:
|
else:
|
||||||
@@ -260,8 +264,6 @@ def add_distro(path):
|
|||||||
def add_spec(params):
|
def add_spec(params):
|
||||||
try:
|
try:
|
||||||
path, repo_uri = params
|
path, repo_uri = params
|
||||||
ctx.ui.info("\r%-80.80s" % (_('Adding %s to source index') %
|
|
||||||
path), noln = True)
|
|
||||||
#TODO: may use try/except to handle this
|
#TODO: may use try/except to handle this
|
||||||
builder = pisi.operations.build.Builder(path)
|
builder = pisi.operations.build.Builder(path)
|
||||||
builder.fetch_component()
|
builder.fetch_component()
|
||||||
@@ -270,6 +272,9 @@ def add_spec(params):
|
|||||||
sf.source.sourceURI = os.path.realpath(path)
|
sf.source.sourceURI = os.path.realpath(path)
|
||||||
else:
|
else:
|
||||||
sf.source.sourceURI = util.removepathprefix(repo_uri, path)
|
sf.source.sourceURI = util.removepathprefix(repo_uri, path)
|
||||||
|
|
||||||
|
ctx.ui.info("\r%-80.80s" % (_('Adding %s to source index') %
|
||||||
|
path), noln = True)
|
||||||
return sf
|
return sf
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
|||||||
Reference in New Issue
Block a user