From 0adec2be0dc38a5d1a9d1fe0452b315c2c9564f9 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Tue, 23 Jan 2024 10:31:30 -0500 Subject: [PATCH] Use consistent and less error-prone find rm's --- debian/pvc-client-cli.postinst | 6 ++++-- debian/pvc-daemon-api.preinst | 4 ++-- debian/pvc-daemon-common.preinst | 5 +++++ debian/pvc-daemon-health.preinst | 6 +++--- debian/pvc-daemon-node.preinst | 4 ++-- debian/pvc-daemon-worker.preinst | 4 ++-- debian/rules | 2 +- 7 files changed, 19 insertions(+), 12 deletions(-) create mode 100644 debian/pvc-daemon-common.preinst diff --git a/debian/pvc-client-cli.postinst b/debian/pvc-client-cli.postinst index d61943a8..5179a4a0 100644 --- a/debian/pvc-client-cli.postinst +++ b/debian/pvc-client-cli.postinst @@ -2,10 +2,12 @@ # Generate the bash completion configuration if [ -d /etc/bash_completion.d ]; then + echo "Installing BASH completion configuration" _PVC_COMPLETE=source_bash pvc > /etc/bash_completion.d/pvc fi -# Remove pycaches -find /usr/lib/python3/dist-packages/pvc -name "__pycache__" -exec rm -r {} \; +# Remove any cached CPython directories or files +echo "Cleaning up CPython caches" +find /usr/lib/python3/dist-packages/pvc -type d -name "__pycache__" -exec rm -fr {} + &>/dev/null || true exit 0 diff --git a/debian/pvc-daemon-api.preinst b/debian/pvc-daemon-api.preinst index 3b05fd62..93a9fc3a 100644 --- a/debian/pvc-daemon-api.preinst +++ b/debian/pvc-daemon-api.preinst @@ -1,5 +1,5 @@ #!/bin/sh # Remove any cached CPython directories or files -echo "Cleaning up existing CPython files" -find /usr/share/pvc/pvcapid -type d -name "__pycache__" -exec rm -rf {} \; &>/dev/null || true +echo "Cleaning up CPython caches" +find /usr/share/pvc/pvcapid -type d -name "__pycache__" -exec rm -fr {} + &>/dev/null || true diff --git a/debian/pvc-daemon-common.preinst b/debian/pvc-daemon-common.preinst new file mode 100644 index 00000000..cf8ae87e --- /dev/null +++ b/debian/pvc-daemon-common.preinst @@ -0,0 +1,5 @@ +#!/bin/sh + +# Remove any cached CPython directories or files +echo "Cleaning up CPython caches" +find /usr/share/pvc/daemon_lib -type d -name "__pycache__" -exec rm -fr {} + &>/dev/null || true diff --git a/debian/pvc-daemon-health.preinst b/debian/pvc-daemon-health.preinst index fe90f97b..1f7e165f 100644 --- a/debian/pvc-daemon-health.preinst +++ b/debian/pvc-daemon-health.preinst @@ -1,6 +1,6 @@ #!/bin/sh # Remove any cached CPython directories or files -echo "Cleaning up existing CPython files" -find /usr/share/pvc/pvchealthd -type d -name "__pycache__" -exec rm -rf {} \; &>/dev/null || true -find /usr/share/pvc/plugins -type d -name "__pycache__" -exec rm -rf {} \; &>/dev/null || true +echo "Cleaning up CPython caches" +find /usr/share/pvc/pvchealthd -type d -name "__pycache__" -exec rm -fr {} + &>/dev/null || true +find /usr/share/pvc/plugins -type d -name "__pycache__" -exec rm -fr {} + &>/dev/null || true diff --git a/debian/pvc-daemon-node.preinst b/debian/pvc-daemon-node.preinst index b213c07d..6780ed9f 100644 --- a/debian/pvc-daemon-node.preinst +++ b/debian/pvc-daemon-node.preinst @@ -1,5 +1,5 @@ #!/bin/sh # Remove any cached CPython directories or files -echo "Cleaning up existing CPython files" -find /usr/share/pvc/pvcnoded -type d -name "__pycache__" -exec rm -rf {} \; &>/dev/null || true +echo "Cleaning up CPython caches" +find /usr/share/pvc/pvcnoded -type d -name "__pycache__" -exec rm -fr {} + &>/dev/null || true diff --git a/debian/pvc-daemon-worker.preinst b/debian/pvc-daemon-worker.preinst index 93b5fce8..d6c90f82 100644 --- a/debian/pvc-daemon-worker.preinst +++ b/debian/pvc-daemon-worker.preinst @@ -1,5 +1,5 @@ #!/bin/sh # Remove any cached CPython directories or files -echo "Cleaning up existing CPython files" -find /usr/share/pvc/pvcworkerd -type d -name "__pycache__" -exec rm -rf {} \; &>/dev/null || true +echo "Cleaning up CPython caches" +find /usr/share/pvc/pvcworkerd -type d -name "__pycache__" -exec rm -fr {} + &>/dev/null || true diff --git a/debian/rules b/debian/rules index 324582d7..cfdabe4d 100755 --- a/debian/rules +++ b/debian/rules @@ -13,7 +13,7 @@ override_dh_python3: rm -r $(CURDIR)/client-cli/.pybuild $(CURDIR)/client-cli/pvc.egg-info override_dh_auto_clean: - find . -name "__pycache__" -o -name ".pybuild" -exec rm -r {} \; || true + find . -name "__pycache__" -o -name ".pybuild" -exec rm -fr {} + || true # If you need to rebuild the Sphinx documentation # Add spinxdoc to the dh --with line