install: Call flush/fsync for critical pisi files
BUG:FIXED:13005
This commit is contained in:
@@ -502,17 +502,17 @@ class Install(AtomicOperation):
|
|||||||
util.clean_dir(self.old_path)
|
util.clean_dir(self.old_path)
|
||||||
|
|
||||||
ctx.ui.info(_('Storing %s') % ctx.const.files_xml, verbose=True)
|
ctx.ui.info(_('Storing %s') % ctx.const.files_xml, verbose=True)
|
||||||
self.package.extract_file(ctx.const.files_xml, self.package.pkg_dir())
|
self.package.extract_file_synced(ctx.const.files_xml, self.package.pkg_dir())
|
||||||
|
|
||||||
ctx.ui.info(_('Storing %s') % ctx.const.metadata_xml, verbose=True)
|
ctx.ui.info(_('Storing %s') % ctx.const.metadata_xml, verbose=True)
|
||||||
self.package.extract_file(ctx.const.metadata_xml, self.package.pkg_dir())
|
self.package.extract_file_synced(ctx.const.metadata_xml, self.package.pkg_dir())
|
||||||
|
|
||||||
for pcomar in self.metadata.package.providesComar:
|
for pcomar in self.metadata.package.providesComar:
|
||||||
fpath = os.path.join(ctx.const.comar_dir, pcomar.script)
|
fpath = os.path.join(ctx.const.comar_dir, pcomar.script)
|
||||||
# comar prefix is added to the pkg_dir while extracting comar
|
# comar prefix is added to the pkg_dir while extracting comar
|
||||||
# script file. so we'll use pkg_dir as destination.
|
# script file. so we'll use pkg_dir as destination.
|
||||||
ctx.ui.info(_('Storing %s') % fpath, verbose=True)
|
ctx.ui.info(_('Storing %s') % fpath, verbose=True)
|
||||||
self.package.extract_file(fpath, self.package.pkg_dir())
|
self.package.extract_file_synced(fpath, self.package.pkg_dir())
|
||||||
|
|
||||||
def update_databases(self):
|
def update_databases(self):
|
||||||
"update databases"
|
"update databases"
|
||||||
|
|||||||
@@ -79,6 +79,17 @@ class Package:
|
|||||||
"""Extract file with path to outdir"""
|
"""Extract file with path to outdir"""
|
||||||
self.extract_files([path], outdir)
|
self.extract_files([path], outdir)
|
||||||
|
|
||||||
|
def extract_file_synced(self, path, outdir):
|
||||||
|
"""Extract file with path to outdir"""
|
||||||
|
data = self.impl.read_file(path)
|
||||||
|
fpath = util.join_path(outdir, path)
|
||||||
|
util.check_dir(os.path.dirname(fpath))
|
||||||
|
|
||||||
|
with open(fpath, "wb") as f:
|
||||||
|
f.write(data)
|
||||||
|
f.flush()
|
||||||
|
os.fsync(f.fileno())
|
||||||
|
|
||||||
def extract_dir(self, dir, outdir):
|
def extract_dir(self, dir, outdir):
|
||||||
"""Extract directory recursively, this function
|
"""Extract directory recursively, this function
|
||||||
copies the directory archiveroot/dir to outdir"""
|
copies the directory archiveroot/dir to outdir"""
|
||||||
|
|||||||
Reference in New Issue
Block a user