public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, cnf/
@ 2011-12-08 19:39 Zac Medico
  0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2011-12-08 19:39 UTC (permalink / raw
  To: gentoo-commits

commit:     9805fc263d785a93ea4a8a6571b73a7b53e85bba
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Dec  8 19:39:16 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Dec  8 19:39:16 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=9805fc26

make.globals: use ${EPREFIX} for PORTDIR, etc...

---
 cnf/make.globals                     |   10 +++++-----
 pym/portage/package/ebuild/config.py |    3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/cnf/make.globals b/cnf/make.globals
index f7f1780..e1243fb 100644
--- a/cnf/make.globals
+++ b/cnf/make.globals
@@ -30,13 +30,13 @@ ACCEPT_LICENSE="* -@EULA"
 ACCEPT_PROPERTIES="*"
 
 # Repository Paths
-PORTDIR=/usr/portage
-DISTDIR=/usr/portage/distfiles
-PKGDIR=/usr/portage/packages
-RPMDIR=/usr/portage/rpm
+PORTDIR=${EPREFIX}/usr/portage
+DISTDIR=${PORTDIR}/distfiles
+PKGDIR=${PORTDIR}/packages
+RPMDIR=${PORTDIR}/rpm
 
 # Temporary build directory
-PORTAGE_TMPDIR=/var/tmp
+PORTAGE_TMPDIR=${EPREFIX}/var/tmp
 
 # Fetching command (3 tries, passive ftp for firewall compatibility)
 FETCHCOMMAND="wget -t 3 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\""

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index fb79e5e..959ecbe 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -315,6 +315,9 @@ class config(object):
 			expand_map = {}
 			self._expand_map = expand_map
 
+			# Allow make.globals to set default paths relative to ${EPREFIX}.
+			expand_map["EPREFIX"] = eprefix
+
 			env_d = getconfig(os.path.join(eroot, "etc", "profile.env"),
 				expand=expand_map)
 



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, cnf/
@ 2011-12-09 22:36 Zac Medico
  0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2011-12-09 22:36 UTC (permalink / raw
  To: gentoo-commits

commit:     0c217d51685bde5085607a8b54e8507b3624c36e
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  9 22:36:12 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri Dec  9 22:36:12 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0c217d51

Auto-generate PORTAGE_INST_GID/UID for prefix.

For prefix environments, default to the UID and GID of the top-level
EROOT directory. This allows us to avoid using hardcoded defaults. It's
still possible to override these variables via make.conf.

---
 cnf/make.globals                     |    4 ----
 pym/portage/package/ebuild/config.py |   24 ++++++++++++++++++++----
 2 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/cnf/make.globals b/cnf/make.globals
index e1243fb..cd06fdc 100644
--- a/cnf/make.globals
+++ b/cnf/make.globals
@@ -111,10 +111,6 @@ CONFIG_PROTECT_MASK="/etc/env.d"
 # Disable auto-use
 USE_ORDER="env:pkg:conf:defaults:pkginternal:repo:env.d"
 
-# Default ownership of installed files.
-PORTAGE_INST_UID="0"
-PORTAGE_INST_GID="0"
-
 # Mode bits for ${WORKDIR} (see ebuild.5).
 PORTAGE_WORKDIR_MODE="0700"
 

diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 53a625b..bf33978 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -723,14 +723,30 @@ class config(object):
 					self["USERLAND"] = "GNU"
 				self.backup_changes("USERLAND")
 
-			for var in ("PORTAGE_INST_UID", "PORTAGE_INST_GID"):
+			default_inst_ids = {
+				"PORTAGE_INST_GID": "0",
+				"PORTAGE_INST_UID": "0",
+			}
+
+			if eprefix:
+				# For prefix environments, default to the UID and GID of
+				# the top-level EROOT directory.
+				try:
+					eroot_st = os.stat(eroot)
+				except OSError:
+					pass
+				else:
+					default_inst_ids["PORTAGE_INST_GID"] = str(eroot_st.st_gid)
+					default_inst_ids["PORTAGE_INST_UID"] = str(eroot_st.st_uid)
+
+			for var, default_val in default_inst_ids.items():
 				try:
-					self[var] = str(int(self.get(var, "0")))
+					self[var] = str(int(self.get(var, default_val)))
 				except ValueError:
 					writemsg(_("!!! %s='%s' is not a valid integer.  "
-						"Falling back to '0'.\n") % (var, self[var]),
+						"Falling back to %s.\n") % (var, self[var], default_val),
 						noiselevel=-1)
-					self[var] = "0"
+					self[var] = default_val
 				self.backup_changes(var)
 
 			# initialize self.features



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-12-09 22:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-09 22:36 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, cnf/ Zac Medico
  -- strict thread matches above, loose matches on Subject: below --
2011-12-08 19:39 Zac Medico

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