public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] portage r10846 - main/trunk/pym/portage
@ 2008-06-29  8:23 Zac Medico (zmedico)
  0 siblings, 0 replies; only message in thread
From: Zac Medico (zmedico) @ 2008-06-29  8:23 UTC (permalink / raw
  To: gentoo-commits

Author: zmedico
Date: 2008-06-29 08:23:17 +0000 (Sun, 29 Jun 2008)
New Revision: 10846

Modified:
   main/trunk/pym/portage/__init__.py
Log:
Split out a _post_src_install_uid_fix() function from spawnebuild().


Modified: main/trunk/pym/portage/__init__.py
===================================================================
--- main/trunk/pym/portage/__init__.py	2008-06-29 08:09:58 UTC (rev 10845)
+++ main/trunk/pym/portage/__init__.py	2008-06-29 08:23:17 UTC (rev 10846)
@@ -4267,28 +4267,7 @@
 					_eqawarn(msg)
 
 		if mydo == "install":
-			# User and group bits that match the "portage" user or group are
-			# automatically mapped to PORTAGE_INST_UID and PORTAGE_INST_GID if
-			# necessary.  The chown system call may clear S_ISUID and S_ISGID
-			# bits, so those bits are restored if necessary.
-			inst_uid = int(mysettings["PORTAGE_INST_UID"])
-			inst_gid = int(mysettings["PORTAGE_INST_GID"])
-			for parent, dirs, files in os.walk(mysettings["D"]):
-				for fname in chain(dirs, files):
-					fpath = os.path.join(parent, fname)
-					mystat = os.lstat(fpath)
-					if mystat.st_uid != portage_uid and \
-						mystat.st_gid != portage_gid:
-						continue
-					myuid = -1
-					mygid = -1
-					if mystat.st_uid == portage_uid:
-						myuid = inst_uid
-					if mystat.st_gid == portage_gid:
-						mygid = inst_gid
-					apply_secpass_permissions(fpath, uid=myuid, gid=mygid,
-						mode=mystat.st_mode, stat_cached=mystat,
-						follow_links=False)
+			_post_src_install_uid_fix(mysettings)
 			qa_retval = _spawn_misc_sh(mysettings, ["install_qa_check",
 				"install_symlink_html_docs"], **kwargs)
 			if qa_retval != os.EX_OK:
@@ -4297,6 +4276,33 @@
 				return qa_retval
 	return phase_retval
 
+def _post_src_install_uid_fix(mysettings):
+	"""
+	Files in $D with user and group bits that match the "portage"
+	user or group are automatically mapped to PORTAGE_INST_UID and
+	PORTAGE_INST_GID if necessary. The chown system call may clear
+	S_ISUID and S_ISGID bits, so those bits are restored if
+	necessary.
+	"""
+	inst_uid = int(mysettings["PORTAGE_INST_UID"])
+	inst_gid = int(mysettings["PORTAGE_INST_GID"])
+	for parent, dirs, files in os.walk(mysettings["D"]):
+		for fname in chain(dirs, files):
+			fpath = os.path.join(parent, fname)
+			mystat = os.lstat(fpath)
+			if mystat.st_uid != portage_uid and \
+				mystat.st_gid != portage_gid:
+				continue
+			myuid = -1
+			mygid = -1
+			if mystat.st_uid == portage_uid:
+				myuid = inst_uid
+			if mystat.st_gid == portage_gid:
+				mygid = inst_gid
+			apply_secpass_permissions(fpath, uid=myuid, gid=mygid,
+				mode=mystat.st_mode, stat_cached=mystat,
+				follow_links=False)
+
 def _spawn_misc_sh(mysettings, commands, **kwargs):
 	"""
 	@param mysettings: the ebuild config

-- 
gentoo-commits@lists.gentoo.org mailing list



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

only message in thread, other threads:[~2008-06-29  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-29  8:23 [gentoo-commits] portage r10846 - 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