Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r12067 - in main/branches/2.1.6/pym: _emerge portage
Date: Mon, 24 Nov 2008 00:34:20
Message-Id: E1L4PP8-0003hq-9S@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-11-24 00:34:17 +0000 (Mon, 24 Nov 2008)
3 New Revision: 12067
4
5 Modified:
6 main/branches/2.1.6/pym/_emerge/__init__.py
7 main/branches/2.1.6/pym/portage/__init__.py
8 Log:
9 Make emerge detect an invalid profile an bail out for anything except
10 --help, --info, --sync, and --version actions. When bailing out, suggest
11 to revert back to the previous profile configuration advise the user which
12 actions are allowed with an invalid profile. (trunk r12064:12066)
13
14
15 Modified: main/branches/2.1.6/pym/_emerge/__init__.py
16 ===================================================================
17 --- main/branches/2.1.6/pym/_emerge/__init__.py 2008-11-24 00:30:41 UTC (rev 12066)
18 +++ main/branches/2.1.6/pym/_emerge/__init__.py 2008-11-24 00:34:17 UTC (rev 12067)
19 @@ -13462,6 +13462,25 @@
20 print "!!! The short ebuild name \"%s\" is ambiguous. Please specify" % arg
21 print "!!! one of the above fully-qualified ebuild names instead.\n"
22
23 +def profile_check(trees, myaction, myopts):
24 + if myaction in ("info", "sync"):
25 + return os.EX_OK
26 + elif "--version" in myopts or "--help" in myopts:
27 + return os.EX_OK
28 + for root, root_trees in trees.iteritems():
29 + if root_trees["root_config"].settings.profiles:
30 + continue
31 + # generate some profile related warning messages
32 + validate_ebuild_environment(trees)
33 + msg = "If you have just changed your profile configuration, you " + \
34 + "should revert back to the previous configuration. Due to " + \
35 + "your current profile being invalid, allowed actions are " + \
36 + "limited to --help, --info, --sync, and --version."
37 + writemsg_level("".join("!!! %s\n" % l for l in textwrap.wrap(msg, 70)),
38 + level=logging.ERROR, noiselevel=-1)
39 + return 1
40 + return os.EX_OK
41 +
42 def emerge_main():
43 global portage # NFC why this is necessary now - genone
44 portage._disable_legacy_globals()
45 @@ -13482,6 +13501,9 @@
46 os.umask(022)
47 settings, trees, mtimedb = load_emerge_config()
48 portdb = trees[settings["ROOT"]]["porttree"].dbapi
49 + rval = profile_check(trees, myaction, myopts)
50 + if rval != os.EX_OK:
51 + return rval
52
53 if portage._global_updates(trees, mtimedb["updates"]):
54 mtimedb.commit()
55
56 Modified: main/branches/2.1.6/pym/portage/__init__.py
57 ===================================================================
58 --- main/branches/2.1.6/pym/portage/__init__.py 2008-11-24 00:30:41 UTC (rev 12066)
59 +++ main/branches/2.1.6/pym/portage/__init__.py 2008-11-24 00:34:17 UTC (rev 12067)
60 @@ -1220,7 +1220,7 @@
61 writemsg("!!! ParseError: %s\n" % str(e), noiselevel=-1)
62 del e
63 self.profiles = []
64 - if local_config:
65 + if local_config and self.profiles:
66 custom_prof = os.path.join(
67 config_root, CUSTOM_PROFILE_PATH.lstrip(os.path.sep))
68 if os.path.exists(custom_prof):