From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-685644-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id D27BF138A1F
	for <garchives@archives.gentoo.org>; Mon, 14 Apr 2014 01:16:17 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 836A7E0AF6;
	Mon, 14 Apr 2014 01:16:15 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id D4D7FE0AF6
	for <gentoo-commits@lists.gentoo.org>; Mon, 14 Apr 2014 01:16:14 +0000 (UTC)
Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id E08FD34002A
	for <gentoo-commits@lists.gentoo.org>; Mon, 14 Apr 2014 01:16:13 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by spoonbill.gentoo.org (Postfix) with ESMTP id 5546018732
	for <gentoo-commits@lists.gentoo.org>; Mon, 14 Apr 2014 01:16:11 +0000 (UTC)
From: "Robin H. Johnson" <robbat2@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Robin H. Johnson" <robbat2@gentoo.org>
Message-ID: <1397437170.deef895b91b8632033a1d1cd151c947f8b73a78a.robbat2@gentoo>
Subject: [gentoo-commits] proj/genkernel:master commit in: /
X-VCS-Repository: proj/genkernel
X-VCS-Files: gen_cmdline.sh gen_determineargs.sh genkernel
X-VCS-Directories: /
X-VCS-Committer: robbat2
X-VCS-Committer-Name: Robin H. Johnson
X-VCS-Revision: deef895b91b8632033a1d1cd151c947f8b73a78a
X-VCS-Branch: master
Date: Mon, 14 Apr 2014 01:16:11 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 48d54c17-efc4-4aef-aec8-c2b63c75b995
X-Archives-Hash: 710fe54ec0e5c22f3cc3e47692c7cdc1

commit:     deef895b91b8632033a1d1cd151c947f8b73a78a
Author:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 13 23:01:25 2014 +0000
Commit:     Robin H. Johnson <robbat2 <AT> gentoo <DOT> org>
CommitDate: Mon Apr 14 00:59:30 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=deef895b

Make it possible to turn off all of the on-exit cleanup.

Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org>

---
 gen_cmdline.sh       |  6 ++++++
 gen_determineargs.sh |  1 +
 genkernel            | 37 ++++++++++++++++++++++---------------
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/gen_cmdline.sh b/gen_cmdline.sh
index 715ad49..7bee618 100755
--- a/gen_cmdline.sh
+++ b/gen_cmdline.sh
@@ -22,6 +22,8 @@ longusage() {
   echo "	--logfile=<outfile>	Output file for debug info"
   echo "	--color			Output debug in color"
   echo "	--no-color		Do not output debug in color"
+  echo "	--debug-cleanup	Clean up temporary build directories on exit"
+  echo "	--no-debug-cleanup	Do not remove any temporary directories on exit"
   echo "  Kernel Configuration settings"
   echo "	--menuconfig		Run menuconfig after oldconfig"
   echo "	--no-menuconfig		Do not run menuconfig after oldconfig"
@@ -471,6 +473,10 @@ parse_cmdline() {
 			print_info 2 "USECOLOR: ${USECOLOR}"
 			setColorVars
 			;;
+		--debug-cleanup|--no-debug-cleanup)
+			CMD_DEBUGCLEANUP=`parse_optbool "$*"`
+			print_info 2 "DEBUGCLEANUP: ${DEBUGCLEANUP}"
+			;;
 		--logfile=*)
 			CMD_LOGFILE=`parse_opt "$*"`
 			LOGFILE=`parse_opt "$*"`

diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index e0c9984..615f274 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -136,6 +136,7 @@ determine_real_args() {
 	set_config_with_override BOOL   DOKEYMAPAUTO         CMD_DOKEYMAPAUTO
 	set_config_with_override STRING BUSYBOX_CONFIG       CMD_BUSYBOX_CONFIG
 	set_config_with_override BOOL   INSTALL              CMD_INSTALL              "yes"
+	set_config_with_override BOOL   DEBUGCLEANUP         CMD_DEBUGCLEANUP         "yes"
 
 	BOOTDIR=`arch_replace "${BOOTDIR}"`
 	BOOTDIR=${BOOTDIR%/}    # Remove any trailing slash

diff --git a/genkernel b/genkernel
index b62c3f7..f10cd49 100755
--- a/genkernel
+++ b/genkernel
@@ -61,21 +61,28 @@ trap_cleanup(){
 }
 
 cleanup(){
-    if [ -n "$TEMP" -a -d "$TEMP" ]; then
-	rm -rf "$TEMP"
-    fi
-
-    if isTrue ${POSTCLEAR}
-    then
-	    echo
-	    print_info 1 'RUNNING FINAL CACHE/TMP CLEANUP'
-	    print_info 1 "CACHE_DIR: ${CACHE_DIR}"
-	    CLEAR_CACHE_DIR='yes'
-	    setup_cache_dir
-	    echo
-	    print_info 1 "TMPDIR: ${TMPDIR}"
-	    clear_tmpdir
-	    fi
+	if [ "${CMD_DEBUGCLEANUP}" == "no" ]; then
+		print_info 1 "Not running any cleanup per DEBUGCLEANUP"
+		print_info 1 "TEMP: ${TEMP}"
+		print_info 1 "CACHE_DIR: ${CACHE_DIR}"
+		print_info 1 "TMPDIR: ${TMPDIR}"
+	else
+		if [ -n "$TEMP" -a -d "$TEMP" ]; then
+			rm -rf "$TEMP"
+		fi
+
+		if isTrue ${POSTCLEAR}
+		then
+			echo
+			print_info 1 'RUNNING FINAL CACHE/TMP CLEANUP'
+			print_info 1 "CACHE_DIR: ${CACHE_DIR}"
+			CLEAR_CACHE_DIR='yes'
+			setup_cache_dir
+			echo
+			print_info 1 "TMPDIR: ${TMPDIR}"
+			clear_tmpdir
+		fi
+	fi
 }
 
 trap trap_cleanup SIGHUP SIGQUIT SIGINT SIGTERM SIGKILL