[entropy.tools] apply_tarball_ownership: raise IOError, catch it
This commit is contained in:
@@ -3306,7 +3306,19 @@ class Package:
|
||||
# the setup phase could have created additional users and groups
|
||||
package_path = self.pkgmeta['pkgpath']
|
||||
prefix_dir = self.pkgmeta['imagedir']
|
||||
entropy.tools.apply_tarball_ownership(package_path, prefix_dir)
|
||||
try:
|
||||
entropy.tools.apply_tarball_ownership(package_path, prefix_dir)
|
||||
except IOError as err:
|
||||
msg = "%s: %s" % (
|
||||
brown(_("Error during package files permissions setup")),
|
||||
err,)
|
||||
self._entropy.output(
|
||||
msg,
|
||||
importance = 1,
|
||||
level = "error",
|
||||
header = darkred(" !!! ")
|
||||
)
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
@@ -2095,11 +2095,14 @@ def apply_tarball_ownership(filepath, prefix_path):
|
||||
for tarinfo in tar:
|
||||
epath = os.path.join(encoded_path, tarinfo.name)
|
||||
|
||||
tar.chown(tarinfo, epath)
|
||||
_fix_uid_gid(tarinfo, epath)
|
||||
if not os.path.islink(epath):
|
||||
# make sure we keep the same permissions
|
||||
tar.chmod(tarinfo, epath)
|
||||
try:
|
||||
tar.chown(tarinfo, epath)
|
||||
_fix_uid_gid(tarinfo, epath)
|
||||
if not os.path.islink(epath):
|
||||
# make sure we keep the same permissions
|
||||
tar.chmod(tarinfo, epath)
|
||||
except tarfile.ExtractError as err:
|
||||
raise IOError(err)
|
||||
|
||||
deleter_counter -= 1
|
||||
if deleter_counter == 0:
|
||||
|
||||
Reference in New Issue
Block a user