mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH v2 1/2] ptxdist: introduce the "clean target" subcommand
@ 2019-05-20  9:26 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 ` [ptxdist] [PATCH v3 1/2] ptxdist: introduce the "clean target" subcommand Roland Hieber
  0 siblings, 2 replies; 3+ messages in thread
From: Roland Hieber @ 2019-05-20  9:26 UTC (permalink / raw)
  To: ptxdist; +Cc: Roland Hieber

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---

v1 -> v2:
 * set $cleanroot instead of calling "clean root" recursively


 bin/ptxdist           | 18 +++++++++++++++++-
 doc/ref_parameter.inc |  6 ++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index 03d6a37ffbba..57c094b33cd8 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,8 +1042,23 @@ 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}"
+		local cleanroot=1
+	fi
+
 	# we want to clean the root dir
-	if [ "${1}" = "root" ]; then
+	if [ "${1}" = "root" -o -n "$cleanroot" ]; then
 		echo
 		echo "${PTXDIST_LOG_PROMPT}cleaning image directory..."
 		rm -fr -- "${IMAGEDIR}"
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

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

* [ptxdist] [PATCH v2 2/2] ptxdist: clean root should clean all image packages too
  2019-05-20  9:26 [ptxdist] [PATCH v2 1/2] ptxdist: introduce the "clean target" subcommand Roland Hieber
@ 2019-05-20  9:26 ` Roland Hieber
  2019-05-22 10:18 ` [ptxdist] [PATCH v3 1/2] ptxdist: introduce the "clean target" subcommand Roland Hieber
  1 sibling, 0 replies; 3+ messages in thread
From: Roland Hieber @ 2019-05-20  9:26 UTC (permalink / raw)
  To: ptxdist; +Cc: Roland Hieber

The images are already removed by 'clean root', so the image packages
are built again anyways on the next build. Remove all left-over state
for the image packages too, as those files are now useless.

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
v1 -> v2: no changes in this patch.

 bin/ptxdist           | 2 ++
 doc/ref_parameter.inc | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/bin/ptxdist b/bin/ptxdist
index 57c094b33cd8..f1978418fae9 100755
--- a/bin/ptxdist
+++ b/bin/ptxdist
@@ -1060,6 +1060,8 @@ clean() {
 	# we want to clean the root dir
 	if [ "${1}" = "root" -o -n "$cleanroot" ]; then
 		echo
+		echo "${PTXDIST_LOG_PROMPT}cleaning image packages..."
+		rm -fr -- "${STATEDIR}"/image-*
 		echo "${PTXDIST_LOG_PROMPT}cleaning image directory..."
 		rm -fr -- "${IMAGEDIR}"
 		echo "${PTXDIST_LOG_PROMPT}cleaning root directory..."
diff --git a/doc/ref_parameter.inc b/doc/ref_parameter.inc
index 4aecb04713d7..35e68972203d 100644
--- a/doc/ref_parameter.inc
+++ b/doc/ref_parameter.inc
@@ -154,7 +154,7 @@ Clean Actions
   This is a way to start a fresh build cycle.
 
 ``clean root``
-  this action will only clean the root filesystem
+  this action will only clean the image packages and the root filesystem
   directories. All the build directories are left untouched.
   After using this action, the next ``go`` action  will regenerate all opkg
   archives from the already built packages as well as the root filesystem
-- 
2.20.1


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

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

* [ptxdist] [PATCH v3 1/2] ptxdist: introduce the "clean target" subcommand
  2019-05-20  9:26 [ptxdist] [PATCH v2 1/2] ptxdist: introduce the "clean target" subcommand 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
  1 sibling, 0 replies; 3+ messages in thread
From: Roland Hieber @ 2019-05-22 10:18 UTC (permalink / raw)
  To: PTXdist Mailing List; +Cc: Roland Hieber

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

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

end of thread, other threads:[~2019-05-22 10:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-20  9:26 [ptxdist] [PATCH v2 1/2] ptxdist: introduce the "clean target" subcommand 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 ` [ptxdist] [PATCH v3 1/2] ptxdist: introduce the "clean target" subcommand Roland Hieber

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