mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: PTXdist Mailing List <ptxdist@pengutronix.de>
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [ptxdist] [PATCH v3 1/2] ptxdist: introduce the "clean target" subcommand
Date: Wed, 22 May 2019 12:18:28 +0200	[thread overview]
Message-ID: <20190522101828.1557-1-rhi@pengutronix.de> (raw)
In-Reply-To: <20190520092605.19300-1-rhi@pengutronix.de>

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
v2 -> v3:
 more elegant solution using "set -- root" instead of a variable
 patch 2/2 stays the same as in v2.
---
 bin/ptxdist           | 16 ++++++++++++++++
 doc/ref_parameter.inc |  6 ++++++
 2 files changed, 22 insertions(+)

diff --git a/bin/ptxdist b/bin/ptxdist
index 03d6a37ffbba..1a8e02192669 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -967,6 +967,7 @@ Clean Actions:
 
   clean				cleanup build-host and build-cross dirs
   clean root			cleanup root directory for target
+  clean target			cleanup all target packages
   distclean			cleanup everything
 
 Misc:
@@ -1041,6 +1042,21 @@ EOF
 clean() {
 	local dir bdir
 
+	# we want to clean all target packages
+	if [ "${1}" = "target" ]; then
+		if [ ! -n "${PTXDIST_FORCE}${PTXDIST_QUIET}${PTXCONF_SETUP_DIRECT_CLEAN}" ]; then
+			read -e -p "really clean all target packages? [y/N] " r
+			case "${r}" in
+				y|Y) ;;
+				*) exit 1 ;;
+			esac
+		fi
+		check_premake_compiler &&
+		pkgs=($(ptxd_make "/print-PACKAGES /print-EXTRA_PACKAGES /print-LAZY_PACKAGES")) &&
+		ptxd_make_log "${pkgs[@]/%/_clean}"
+		set -- root
+	fi
+
 	# we want to clean the root dir
 	if [ "${1}" = "root" ]; then
 		echo
diff --git a/doc/ref_parameter.inc b/doc/ref_parameter.inc
index 0b11563c9ffd..4aecb04713d7 100644
--- a/doc/ref_parameter.inc
+++ b/doc/ref_parameter.inc
@@ -162,6 +162,12 @@ Clean Actions
   The ``clean root`` and ``go`` action is useful if the
   *targetinstall* stage for all packages should run again.
 
+``clean target``
+  this action will call the ``clean`` action for each target package,
+  and also clean the root file system afterwards.
+  This can be useful if you want to rebuild the target file system from
+  scratch, without throwing away the already built host and cross packages.
+
 ``clean <package>``
   this action will only clean the dedicated
   <package>. It will remove its build directory and all installed files
-- 
2.20.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

      parent reply	other threads:[~2019-05-22 10:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-20  9:26 [ptxdist] [PATCH v2 " Roland Hieber
2019-05-20  9:26 ` [ptxdist] [PATCH v2 2/2] ptxdist: clean root should clean all image packages too Roland Hieber
2019-05-22 10:18 ` Roland Hieber [this message]

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=20190522101828.1557-1-rhi@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=ptxdist@pengutronix.de \
    /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