[rhel7-branch 5/29] Use low level file i/o for rpm callback logging (#1035745)
bcl
installerbot-noreply at redhat.com
Tue Jun 2 00:31:06 UTC 2015
From: "Brian C. Lane" <bcl at redhat.com>
Mixing the python file object with the low level fd as used by rpm
resulted in mixed output. This switches to using a fd for logging from
the callback so that its output and the script output will be
synchronized.
(cherry picked from commit 11768eec48f75efe9e18e61ffcc2069f34499759)
Related: rhbz#1196721
---
scripts/anaconda-yum | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/scripts/anaconda-yum b/scripts/anaconda-yum
index 77067c7..dab9e60 100755
--- a/scripts/anaconda-yum
+++ b/scripts/anaconda-yum
@@ -27,7 +27,7 @@ import rpm
import rpmUtils
import yum
from urlgrabber.grabber import URLGrabError
-from pyanaconda.iutil import xprogressive_delay
+from pyanaconda.iutil import xprogressive_delay, eintr_retry_call
YUM_PLUGINS = ["fastestmirror", "langpacks"]
@@ -156,8 +156,8 @@ def run_yum_transaction(release, arch, yum_conf, install_root, ts_file, script_l
yb.ts.clean()
# Write scriptlet output to a file to be logged later
- logfile = open(script_log, "w")
- yb.ts.ts.scriptFd = logfile.fileno()
+ logfile = eintr_retry_call(os.open, script_log, os.O_WRONLY|os.O_CREAT)
+ yb.ts.ts.scriptFd = logfile
rpm.setLogFile(logfile)
# create the install callback
@@ -183,7 +183,7 @@ def run_yum_transaction(release, arch, yum_conf, install_root, ts_file, script_l
print("INFO: transaction complete")
finally:
yb.ts.close()
- logfile.close()
+ eintr_retry_call(os.close, logfile)
except YumBaseError as e:
print("ERROR: transaction error: %s" % e)
finally:
@@ -214,14 +214,14 @@ class RPMCallback(object):
def __init__(self, yb, arch, log, debug=False):
""" :param yb: YumBase object
:type yb: YumBase
- :param log: script logfile
- :type log: string
+ :param log: file-descriptor of script logfile
+ :type log: int
:param statusQ: status communication back to other process
:type statusQ: Queue
"""
self.yb = yb # yum.YumBase
self.base_arch = arch
- self.install_log = log # logfile for yum script logs
+ self.install_log = log # fd of logfile for yum script logs
self.debug = debug
self.package_file = None # file instance (package file management)
@@ -277,7 +277,7 @@ class RPMCallback(object):
log_msg = msg_format % (txmbr.po,
self.completed_actions,
self.total_actions)
- self.install_log.write(log_msg+"\n")
+ eintr_retry_call(os.write, self.install_log, log_msg+"\n")
print("PROGRESS_INSTALL: %s" % progress_msg)
try:
--
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/53fa9022e922f27f0d579d8191bdf41487c58fed
More information about the anaconda-patches
mailing list