Bug #287950 - Add a --fail-clean[=n] option, for enabling or disabling
authorZac Medico <zmedico@gentoo.org>
Thu, 8 Oct 2009 00:06:10 +0000 (00:06 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 8 Oct 2009 00:06:10 +0000 (00:06 -0000)
 FEATURES=fail-clean from the command line.

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

man/emerge.1
pym/_emerge/actions.py
pym/_emerge/help.py
pym/_emerge/main.py

index 602fda926349eab146bfd12308862889335d66df..12be26e7cf511936feff67f7d08cd40e1ede322e 100644 (file)
@@ -330,6 +330,13 @@ specifications while differing from the installed set of packages as
 little as possible.  You should run with \fB\-\-pretend\fR first to make 
 sure the result is what you expect.
 .TP
+.BR "\-\-fail\-clean[=n]"
+Clean up temporary files after a build failure. This is
+particularly useful if you have \fBPORTAGE_TMPDIR\fR on
+tmpfs. If this option is enabled, you probably also want
+to enable \fBPORT_LOGDIR\fR (see \fBmake.conf\fR(5)) in
+order to save the build log.
+.TP
 .BR "\-\-fetchonly " (\fB\-f\fR)
 Instead of doing any package building, just perform fetches for all
 packages (fetch things from SRC_URI based upon USE setting).
index eaaa69650286c7de360ff83f82f2fbe536c33513..5fc43bd7b909a6633b1d984dd6c9150c0e06d37a 100644 (file)
@@ -2330,6 +2330,19 @@ def adjust_config(myopts, settings):
                settings['FEATURES'] = ' '.join(sorted(settings.features))
                settings.backup_changes("FEATURES")
 
+       fail_clean = myopts.get('--fail-clean')
+       if fail_clean is not None:
+               if fail_clean is True and \
+                       'fail-clean' not in settings.features:
+                       settings.features.add('fail-clean')
+                       settings['FEATURES'] = ' '.join(sorted(settings.features))
+                       settings.backup_changes('FEATURES')
+               elif fail_clean == 'n' and \
+                       'fail-clean' in settings.features:
+                       settings.features.remove('fail-clean')
+                       settings['FEATURES'] = ' '.join(sorted(settings.features))
+                       settings.backup_changes('FEATURES')
+
        CLEAN_DELAY = 5
        try:
                CLEAN_DELAY = int(settings.get("CLEAN_DELAY", str(CLEAN_DELAY)))
index c0a6d01d525cf84959d257b5bb8c461688302826..312952295b432e37444955d03c589d8448e6c544 100644 (file)
@@ -346,6 +346,15 @@ def help(myopts, havecolor=1):
                print("              it possible for developers to get a complete overview of the")
                print("              complete dependency tree of a certain package.")
                print()
+               print("       "+green("--fail-clean[=n]"))
+               desc = "Clean up temporary files after a build failure. This is " + \
+                       "particularly useful if you have PORTAGE_TMPDIR on " + \
+                       "tmpfs. If this option is enabled, you probably also want " + \
+                       "to enable PORT_LOGDIR (see make.conf(5)) in " + \
+                       "order to save the build log."
+               for line in wrap(desc, desc_width):
+                       print(desc_indent + line)
+               print()
                print("       "+green("--fetchonly")+" ("+green("-f")+" short option)")
                print("              Instead of doing any package building, just perform fetches for")
                print("              all packages (main package as well as all dependencies.) When")
index 8afa37dddf8d96c6da38f417832a53f222576675..2eedee3418c751f69a217520b7efee6dd08cb292 100644 (file)
@@ -382,6 +382,7 @@ def insert_optional_args(args):
                '--deep'       : valid_integers,
                '--deselect'   : ('n',),
                '--binpkg-respect-use'   : ('n', 'y',),
+               '--fail-clean'           : ('n',),
                '--getbinpkg'            : ('n',),
                '--getbinpkgonly'        : ('n',),
                '--jobs'       : valid_integers,
@@ -537,6 +538,12 @@ def parse_opts(tmpcmdline, silent=False):
                        "choices" : ("True", "n")
                },
 
+               "--fail-clean": {
+                       "help"    : "clean temp files after build failure",
+                       "type"    : "choice",
+                       "choices" : ("True", "n")
+               },
+
                "--jobs": {
 
                        "shortopt" : "-j",
@@ -671,6 +678,9 @@ def parse_opts(tmpcmdline, silent=False):
        else:
                myoptions.complete_graph = None
 
+       if myoptions.fail_clean == "True":
+               myoptions.fail_clean = True
+
        if myoptions.getbinpkg in ("True",):
                myoptions.getbinpkg = True
        else: