Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] wipe-sysroot: explain what is being deleted and require confirmation
@ 2013-11-01 19:47 Ross Burton
  2013-11-01 21:04 ` Phil Blundell
  0 siblings, 1 reply; 4+ messages in thread
From: Ross Burton @ 2013-11-01 19:47 UTC (permalink / raw)
  To: openembedded-core

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] wipe-sysroot: explain what is being deleted and require confirmation
  2013-11-01 19:47 [PATCH] wipe-sysroot: explain what is being deleted and require confirmation Ross Burton
@ 2013-11-01 21:04 ` Phil Blundell
  2013-11-01 23:21   ` Burton, Ross
  0 siblings, 1 reply; 4+ messages in thread
From: Phil Blundell @ 2013-11-01 21:04 UTC (permalink / raw)
  To: Ross Burton; +Cc: openembedded-core

On Fri, 2013-11-01 at 19:47 +0000, Ross Burton wrote:
> 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.

"--force" seems like a bit of an odd name for an argument that you have
to supply in order for the script to do anything useful.  Why would the
user be running a script named "wipe-sysroot" if they didn't want the
sysroot to be deleted?

p.




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] wipe-sysroot: explain what is being deleted and require confirmation
  2013-11-01 21:04 ` Phil Blundell
@ 2013-11-01 23:21   ` Burton, Ross
  2013-11-02 16:19     ` Phil Blundell
  0 siblings, 1 reply; 4+ messages in thread
From: Burton, Ross @ 2013-11-01 23:21 UTC (permalink / raw)
  To: Phil Blundell; +Cc: OE-core

On 1 November 2013 21:04, Phil Blundell <pb@pbcl.net> wrote:
> On Fri, 2013-11-01 at 19:47 +0000, Ross Burton wrote:
>> 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.
>
> "--force" seems like a bit of an odd name for an argument that you have
> to supply in order for the script to do anything useful.  Why would the
> user be running a script named "wipe-sysroot" if they didn't want the
> sysroot to be deleted?

I'm open to alternative wording but the essence is "don't delete stuff
if the user does something like wipe-sysroot --help".

Ross


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] wipe-sysroot: explain what is being deleted and require confirmation
  2013-11-01 23:21   ` Burton, Ross
@ 2013-11-02 16:19     ` Phil Blundell
  0 siblings, 0 replies; 4+ messages in thread
From: Phil Blundell @ 2013-11-02 16:19 UTC (permalink / raw)
  To: Burton, Ross; +Cc: OE-core

On Fri, 2013-11-01 at 23:21 +0000, Burton, Ross wrote:
> On 1 November 2013 21:04, Phil Blundell <pb@pbcl.net> wrote:
> > On Fri, 2013-11-01 at 19:47 +0000, Ross Burton wrote:
> >> 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.
> >
> > "--force" seems like a bit of an odd name for an argument that you have
> > to supply in order for the script to do anything useful.  Why would the
> > user be running a script named "wipe-sysroot" if they didn't want the
> > sysroot to be deleted?
> 
> I'm open to alternative wording but the essence is "don't delete stuff
> if the user does something like wipe-sysroot --help".

How about:

if [ $# -gt 0 ]; then
  echo "Usage: $0" >&2
  exit 1
fi

p.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-02 16:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-01 19:47 [PATCH] wipe-sysroot: explain what is being deleted and require confirmation Ross Burton
2013-11-01 21:04 ` Phil Blundell
2013-11-01 23:21   ` Burton, Ross
2013-11-02 16:19     ` Phil Blundell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox