diff options
author | Zac Medico <zmedico@gentoo.org> | 2009-03-12 05:56:54 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2009-03-12 05:56:54 +0000 |
commit | 923bb28674e38db1730d620ea6c2f9505e43f45a (patch) | |
tree | df4eb9758f421b650872a77c56262e50f09e8e37 /pym | |
parent | e94d768ad75ff6e99cfaa104298a891a1b0d1c91 (diff) | |
download | portage-923bb28674e38db1730d620ea6c2f9505e43f45a.tar.gz portage-923bb28674e38db1730d620ea6c2f9505e43f45a.tar.bz2 portage-923bb28674e38db1730d620ea6c2f9505e43f45a.zip |
When translating portage uid/gid to root uid/gid after src_install on
FreeBSD, temporarily remove all file flags inside $D in order to avoid
EPERM errors. Thanks to Timothy Redaelli <drizzt@g.o> for reporting.
(trunk r13068)
svn path=/main/branches/2.1.6/; revision=13082
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage/__init__.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 80ab03a95..d57d1d76c 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -4874,6 +4874,17 @@ def _post_src_install_uid_fix(mysettings): """ inst_uid = int(mysettings["PORTAGE_INST_UID"]) inst_gid = int(mysettings["PORTAGE_INST_GID"]) + + if bsd_chflags: + # Temporarily remove all of the flags in order to avoid EPERM errors. + os.system("mtree -c -p %s -k flags > %s" % \ + (_shell_quote(mysettings["D"]), + _shell_quote(os.path.join(mysettings["T"], "bsdflags.mtree")))) + os.system("chflags -R noschg,nouchg,nosappnd,nouappnd %s" % \ + (_shell_quote(mysettings["D"]),)) + os.system("chflags -R nosunlnk,nouunlnk %s 2>/dev/null" % \ + (_shell_quote(mysettings["D"]),)) + for parent, dirs, files in os.walk(mysettings["D"]): for fname in chain(dirs, files): fpath = os.path.join(parent, fname) @@ -4891,6 +4902,12 @@ def _post_src_install_uid_fix(mysettings): mode=mystat.st_mode, stat_cached=mystat, follow_links=False) + if bsd_chflags: + # Restore all of the flags saved above. + os.system("mtree -e -p %s -U -k flags < %s > /dev/null" % \ + (_shell_quote(mysettings["D"]), + _shell_quote(os.path.join(mysettings["T"], "bsdflags.mtree")))) + def _post_pkg_preinst_cmd(mysettings): """ Post phase logic and tasks that have been factored out of |