public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Arfrever Frehtes Taifersar Arahesis" <arfrever.fta@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/package/ebuild/_config/, bin/, ...
Date: Sat, 13 Jul 2013 05:33:54 +0000 (UTC)	[thread overview]
Message-ID: <1373693439.7b2d968c768ac77d23e28de96727440e4da5af94.arfrever@gentoo> (raw)

commit:     7b2d968c768ac77d23e28de96727440e4da5af94
Author:     Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Sat Jul 13 05:30:39 2013 +0000
Commit:     Arfrever Frehtes Taifersar Arahesis <arfrever.fta <AT> gmail <DOT> com>
CommitDate: Sat Jul 13 05:30:39 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=7b2d968c

Support PORTAGE_REPOSITORIES environmental variable, which overrides
whole configuration of repositories (repos.conf, PORTDIR, PORTDIR_OVERLAY).
Format of PORTAGE_REPOSITORIES is identical to format of repos.conf.

---
 bin/phase-functions.sh                             |  2 +-
 .../package/ebuild/_config/special_env_vars.py     |  2 +-
 pym/portage/package/ebuild/doebuild.py             |  1 +
 pym/portage/repository/config.py                   | 31 ++++++++++++++++++----
 4 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh
index 5c17243..f67879e 100644
--- a/bin/phase-functions.sh
+++ b/bin/phase-functions.sh
@@ -25,7 +25,7 @@ PORTAGE_READONLY_VARS="D EBUILD EBUILD_PHASE EBUILD_PHASE_FUNC \
 	PORTAGE_MUTABLE_FILTERED_VARS PORTAGE_OVERRIDE_EPREFIX \
 	PORTAGE_PYM_PATH PORTAGE_PYTHON \
 	PORTAGE_READONLY_METADATA PORTAGE_READONLY_VARS \
-	PORTAGE_REPO_NAME PORTAGE_RESTRICT \
+	PORTAGE_REPO_NAME PORTAGE_REPOSITORIES PORTAGE_RESTRICT \
 	PORTAGE_SAVED_READONLY_VARS PORTAGE_SIGPIPE_STATUS \
 	PORTAGE_TMPDIR PORTAGE_UPDATE_ENV PORTAGE_USERNAME \
 	PORTAGE_VERBOSE PORTAGE_WORKDIR_MODE PORTAGE_XATTR_EXCLUDE \

diff --git a/pym/portage/package/ebuild/_config/special_env_vars.py b/pym/portage/package/ebuild/_config/special_env_vars.py
index d34d603..85b699e 100644
--- a/pym/portage/package/ebuild/_config/special_env_vars.py
+++ b/pym/portage/package/ebuild/_config/special_env_vars.py
@@ -69,7 +69,7 @@ environ_whitelist += [
 	"PORTAGE_IPC_DAEMON", "PORTAGE_IUSE",
 	"PORTAGE_LOG_FILE", "PORTAGE_OVERRIDE_EPREFIX", "PORTAGE_PIPE_FD",
 	"PORTAGE_PYM_PATH", "PORTAGE_PYTHON", "PORTAGE_QUIET",
-	"PORTAGE_REPO_NAME", "PORTAGE_RESTRICT",
+	"PORTAGE_REPO_NAME", "PORTAGE_REPOSITORIES", "PORTAGE_RESTRICT",
 	"PORTAGE_SIGPIPE_STATUS",
 	"PORTAGE_TMPDIR", "PORTAGE_UPDATE_ENV", "PORTAGE_USERNAME",
 	"PORTAGE_VERBOSE", "PORTAGE_WORKDIR_MODE", "PORTAGE_XATTR_EXCLUDE",

diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 06ea111..7ffe66b 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -306,6 +306,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
 		repo = mydbapi.repositories.get_repo_for_location(mytree)
 		mysettings['PORTDIR'] = repo.eclass_db.porttrees[0]
 		mysettings['PORTDIR_OVERLAY'] = ' '.join(repo.eclass_db.porttrees[1:])
+		mysettings['PORTAGE_REPOSITORIES'] = mydbapi.repositories.config_string()
 		mysettings.configdict["pkg"]["PORTAGE_REPO_NAME"] = repo.name
 
 	mysettings["PORTDIR"] = os.path.realpath(mysettings["PORTDIR"])

diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index fded7bd..5d4966a 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -548,8 +548,12 @@ class RepoConfigLoader(object):
 		ignored_map = {}
 		ignored_location_map = {}
 
-		portdir = settings.get('PORTDIR', '')
-		portdir_overlay = settings.get('PORTDIR_OVERLAY', '')
+		if "PORTAGE_REPOSITORIES" in settings:
+			portdir = ""
+			portdir_overlay = ""
+		else:
+			portdir = settings.get("PORTDIR", "")
+			portdir_overlay = settings.get("PORTDIR_OVERLAY", "")
 
 		try:
 			self._parse(paths, prepos, ignored_map,
@@ -827,11 +831,28 @@ class RepoConfigLoader(object):
 	def __contains__(self, repo_name):
 		return repo_name in self.prepos
 
+	def config_string(self):
+		config_string = ""
+		for repo_name, repo in self.prepos.items():
+			config_string += "[%s]\n" % repo_name
+			for key in ("format", "location", "main_repo", "priority", "sync"):
+				if getattr(repo, key) is not None:
+					config_string += "%s = %s\n" % (key.replace("_", "-"), getattr(repo, key))
+			for key in ("aliases", "eclass_overrides"):
+				if getattr(repo, key) is not None:
+					config_string += "%s = %s\n" % (key.replace("_", "-"), " ".join(getattr(repo, key)))
+			for key in ("masters",):
+				if getattr(repo, key) is not None:
+					config_string += "%s = %s\n" % (key.replace("_", "-"), " ".join(x.name for x in getattr(repo, key)))
+		return config_string
+
 def load_repository_config(settings):
-	#~ repoconfigpaths = [os.path.join(settings.global_config_path, "repos.conf")]
 	repoconfigpaths = []
-	repoconfigpaths.append(os.path.join(settings["PORTAGE_CONFIGROOT"],
-		USER_CONFIG_PATH, "repos.conf"))
+	if "PORTAGE_REPOSITORIES" in settings:
+		repoconfigpaths.append(io.StringIO(settings["PORTAGE_REPOSITORIES"]))
+	else:
+		# repoconfigpaths.append(os.path.join(settings.global_config_path, "repos.conf"))
+		repoconfigpaths.append(os.path.join(settings["PORTAGE_CONFIGROOT"], USER_CONFIG_PATH, "repos.conf"))
 	return RepoConfigLoader(repoconfigpaths, settings)
 
 def _get_repo_name(repo_location, cached=None):


             reply	other threads:[~2013-07-13  5:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-13  5:33 Arfrever Frehtes Taifersar Arahesis [this message]
  -- strict thread matches above, loose matches on Subject: below --
2013-07-22 18:08 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/package/ebuild/_config/, bin/, Zac Medico
2012-11-16  4:38 Arfrever Frehtes Taifersar Arahesis
2012-08-29 16:28 Zac Medico
2012-01-08  6:22 Arfrever Frehtes Taifersar Arahesis
2011-12-11  6:52 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1373693439.7b2d968c768ac77d23e28de96727440e4da5af94.arfrever@gentoo \
    --to=arfrever.fta@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox