[entropy.tools] apply_tarball_ownership: raise IOError, catch it

This commit is contained in:
Fabio Erculiani
2012-05-02 20:18:29 +02:00
parent 0d1905f7fa
commit be5df20352
2 changed files with 21 additions and 6 deletions
+13 -1
View File
@@ -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
+8 -5
View File
@@ -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: