Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Ross Burton <ross.burton@intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH] wipe-sysroot: explain what is being deleted and require confirmation
Date: Fri,  1 Nov 2013 19:47:13 +0000	[thread overview]
Message-ID: <1383335233-12366-1-git-send-email-ross.burton@intel.com> (raw)

Instead of rushing into deleting entire directory trees without any warning,
print the directories and files that will be deleted and require confirmation
from the user (via --force) that they want files to be deleted.

[ YOCTO #5423 ]

Signed-off-by: Ross Burton <ross.burton@intel.com>
---
 scripts/wipe-sysroot |   27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/scripts/wipe-sysroot b/scripts/wipe-sysroot
index 7ca26fe..306c877 100755
--- a/scripts/wipe-sysroot
+++ b/scripts/wipe-sysroot
@@ -33,14 +33,23 @@ if [ -z "$SSTATE_MANIFESTS" -o -z "$STAGING_DIR" -o -z "$STAMPS_DIR" ]; then
     exit 1
 fi
 
-# The sysroots themselves
-rm -rf $STAGING_DIR
+echo "Will delete $STAGING_DIR."
+echo "Will also delete selected stamps from $SSTATE_MANIFESTS and $STAMPS_DIR."
 
-# The stamps that said the sysroot was populated
-rm -rf $STAMPS_DIR/*/*/*.do_populate_sysroot.*
-rm -rf $STAMPS_DIR/*/*/*.do_populate_sysroot_setscene.*
-rm -rf $STAMPS_DIR/*/*/*.do_packagedata.*
-rm -rf $STAMPS_DIR/*/*/*.do_packagedata_setscene.*
+if [ "$1" = "--force" ]; then
+    echo "Deleting..."
 
-# The sstate manifests
-rm -rf $SSTATE_MANIFESTS/manifest-*.populate-sysroot
+    # The sysroots themselves
+    rm -rf $STAGING_DIR
+
+    # The stamps that said the sysroot was populated
+    rm -rf $STAMPS_DIR/*/*/*.do_populate_sysroot.*
+    rm -rf $STAMPS_DIR/*/*/*.do_populate_sysroot_setscene.*
+    rm -rf $STAMPS_DIR/*/*/*.do_packagedata.*
+    rm -rf $STAMPS_DIR/*/*/*.do_packagedata_setscene.*
+
+    # The sstate manifests
+    rm -rf $SSTATE_MANIFESTS/manifest-*.populate-sysroot
+else
+    echo "\nThis was a dry-run.  Run with --force to delete the files."
+fi
-- 
1.7.10.4



             reply	other threads:[~2013-11-01 19:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-01 19:47 Ross Burton [this message]
2013-11-01 21:04 ` [PATCH] wipe-sysroot: explain what is being deleted and require confirmation Phil Blundell
2013-11-01 23:21   ` Burton, Ross
2013-11-02 16:19     ` Phil Blundell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1383335233-12366-1-git-send-email-ross.burton@intel.com \
    --to=ross.burton@intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox