public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r13068 - main/trunk/pym/portage
@ 2009-03-12  3:48 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2009-03-12  3:48 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2009-03-12 03:48:10 +0000 (Thu, 12 Mar 2009)
New Revision: 13068

Modified:
   main/trunk/pym/portage/__init__.py
Log:
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.


Modified: main/trunk/pym/portage/__init__.py
===================================================================
--- main/trunk/pym/portage/__init__.py	2009-03-12 02:40:28 UTC (rev 13067)
+++ main/trunk/pym/portage/__init__.py	2009-03-12 03:48:10 UTC (rev 13068)
@@ -4884,6 +4884,17 @@
 	"""
 	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)
@@ -4901,6 +4912,12 @@
 				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




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-12  3:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-12  3:48 [gentoo-commits] portage r13068 - main/trunk/pym/portage Zac Medico (zmedico)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox