From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 3B52C138A1F for ; Wed, 16 Apr 2014 08:33:40 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E1791E0B24; Wed, 16 Apr 2014 08:33:38 +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 612EEE0B24 for ; Wed, 16 Apr 2014 08:33:38 +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 11167340051 for ; Wed, 16 Apr 2014 08:33:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id E9D48180E8 for ; Wed, 16 Apr 2014 08:33:33 +0000 (UTC) From: "Robin H. Johnson" 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" Message-ID: <1397637140.be1d4c66a79701f400a7bbbea588582164b0f5ca.robbat2@gentoo> Subject: [gentoo-commits] proj/genkernel:master commit in: / X-VCS-Repository: proj/genkernel X-VCS-Files: gen_compile.sh genkernel X-VCS-Directories: / X-VCS-Committer: robbat2 X-VCS-Committer-Name: Robin H. Johnson X-VCS-Revision: be1d4c66a79701f400a7bbbea588582164b0f5ca X-VCS-Branch: master Date: Wed, 16 Apr 2014 08:33:33 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 38274beb-73f0-4f22-a27b-8f6b6e72e64a X-Archives-Hash: d11d836639e2cd1a5fd4af254b0ff398 commit: be1d4c66a79701f400a7bbbea588582164b0f5ca Author: Robin H. Johnson gentoo org> AuthorDate: Wed Apr 16 08:32:11 2014 +0000 Commit: Robin H. Johnson gentoo org> CommitDate: Wed Apr 16 08:32:20 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/genkernel.git;a=commit;h=be1d4c66 Improve debugcleanup code - Improve the debug-cleanup code to use isTrue and match other code style. - add explicit return 0 after debug-cleanup to avoid passing a false negative failure code up to a higher level function. Signed-off-by: Robin H. Johnson gentoo.org> --- gen_compile.sh | 30 +++++++++++++++++++----------- genkernel | 12 ++++++------ 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/gen_compile.sh b/gen_compile.sh index 9b5df01..0fb33d5 100755 --- a/gen_compile.sh +++ b/gen_compile.sh @@ -430,7 +430,7 @@ compile_busybox() { yes '' 2>/dev/null | compile_generic oldconfig utils print_info 1 'busybox: >> Compiling...' - compile_generic all utils + compile_generic all utils V=1 print_info 1 'busybox: >> Copying to cache...' [ -f "${TEMP}/${BUSYBOX_DIR}/busybox" ] || gen_die 'Busybox executable does not exist!' @@ -440,7 +440,8 @@ compile_busybox() { gen_die 'Could not create the busybox bincache!' cd "${TEMP}" - rm -rf "${BUSYBOX_DIR}" > /dev/null + isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${BUSYBOX_DIR}" > /dev/null + return 0 fi } @@ -485,8 +486,9 @@ compile_lvm() { gen_die 'Could not create binary cache' cd "${TEMP}" - rm -rf "${TEMP}/lvm" > /dev/null - rm -rf "${LVM_DIR}" lvm + isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${TEMP}/lvm" > /dev/null + isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${LVM_DIR}" lvm + return 0 fi } @@ -525,7 +527,8 @@ compile_mdadm() { gen_die 'Could not create binary cache' cd "${TEMP}" - rm -rf "${MDADM_DIR}" mdadm + isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${MDADM_DIR}" mdadm + return 0 fi } @@ -574,8 +577,9 @@ compile_dmraid() { gen_die 'Could not create binary cache' cd "${TEMP}" - rm -rf "${TEMP}/lvm" > /dev/null - rm -rf "${DMRAID_DIR}" dmraid + isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${TEMP}/lvm" > /dev/null + isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${DMRAID_DIR}" dmraid + return 0 fi } @@ -612,7 +616,8 @@ compile_fuse() { # gen_die 'Could not create fuse bincache!' cd "${TEMP}" -# rm -rf "${FUSE_DIR}" > /dev/null +# isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${FUSE_DIR}" > /dev/null + return 0 fi } @@ -647,7 +652,8 @@ compile_unionfs_fuse() { gen_die 'Could not copy the unionfs binary to the package directory, does the directory exist?' cd "${TEMP}" - rm -rf "${UNIONFS_FUSE_DIR}" > /dev/null + isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${UNIONFS_FUSE_DIR}" > /dev/null + return 0 fi } @@ -697,7 +703,8 @@ compile_iscsi() { gen_die 'Could not copy the iscsistart binary to the package directory, does the directory exist?' cd "${TEMP}" - rm -rf "${ISCSI_DIR}" > /dev/null + isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${ISCSI_DIR}" > /dev/null + return 0 fi } @@ -742,6 +749,7 @@ compile_gpg() { gen_die 'Could not copy the gpg binary to the package directory, does the directory exist?' cd "${TEMP}" - rm -rf "${GPG_DIR}" > /dev/null + isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${GPG_DIR}" > /dev/null + return 0 fi } diff --git a/genkernel b/genkernel index ed7f3ad..1d2a372 100755 --- a/genkernel +++ b/genkernel @@ -61,12 +61,7 @@ trap_cleanup(){ } cleanup(){ - 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 isTrue "${CMD_DEBUGCLEANUP}"; then if [ -n "$TEMP" -a -d "$TEMP" ]; then rm -rf "$TEMP" fi @@ -82,6 +77,11 @@ cleanup(){ print_info 1 "TMPDIR: ${TMPDIR}" clear_tmpdir fi + else + 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}" fi }