Display a short notification when an existing ${T}/environment
authorZac Medico <zmedico@gentoo.org>
Thu, 27 Sep 2007 06:50:15 +0000 (06:50 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 27 Sep 2007 06:50:15 +0000 (06:50 -0000)
sourced since it is easy to ignore and ignorance of it often
leads to mysterious problems and general confusion. This
message should not show in cases where it is obviously
irrelevant, FEATURES=noauto, or PORTAGE_QUIET=1.

svn path=/main/trunk/; revision=7844

bin/ebuild

index 442dd46448b099ef9434a8b906469e7966616e7e..00c63a0ce44b0977308043c403b543993f22f1ab 100755 (executable)
@@ -138,6 +138,25 @@ if "test" in pargs and "test" not in tmpsettings.features:
        tmpsettings["FEATURES"] = " ".join(tmpsettings.features)
        tmpsettings.backup_changes("FEATURES")
 
+build_dir_phases = set(["setup", "unpack", "compile",
+       "test", "install", "package", "rpm"])
+
+if "clean" not in pargs and \
+       "noauto" not in tmpsettings.features and \
+       tmpsettings.get("PORTAGE_QUIET") != "1" and \
+       build_dir_phases.intersection(pargs):
+       portage.doebuild_environment(ebuild, "setup", portage.root,
+               tmpsettings, debug, 1, portage.portdb)
+       env_filename = os.path.join(tmpsettings["T"], "environment")
+       if os.path.exists(env_filename):
+               msg = ("Existing ${T}/environment for '%s' will be sourced. " + \
+                       "Run 'clean' to start with a fresh environment.") % \
+                       (tmpsettings["PF"], )
+               from textwrap import wrap
+               msg = wrap(msg, 70)
+               for x in msg:
+                       portage.writemsg(">>> %s\n" % x)
+
 for arg in pargs:
        try:
                if arg == "digest" and force: