Thanks for accepting the repro-check patch. A minor enhancement is attached.

The function is in pkg_pkg.cygpart instead of pkg_cleanup.cygpart because then it is easier to keep it in sync with the other __repro_* functions.

PS: I have a local script which checks SPDX Identifiers and expressions. Any interest to add this to cygport and then check LICENSE settings?

--
Regards,
Christian

From b08796262308cf1b3a2c063349d024a5ccfd2455 Mon Sep 17 00:00:00 2001
From: Christian Franke <christian.fra...@t-online.de>
Date: Mon, 11 Mar 2024 12:12:32 +0100
Subject: [PATCH] Add repro-finish command

This command removes the temporary directory used by repro-check.
---
 README              |  7 ++++---
 bin/cygport.in      |  4 ++++
 lib/help.cygpart    |  1 +
 lib/pkg_pkg.cygpart | 24 +++++++++++++++++++++++-
 4 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/README b/README
index 3c9e4d4a..a0897a4f 100644
--- a/README
+++ b/README
@@ -163,9 +163,10 @@ Other COMMANDs are meant primarily for maintainers:
     diff     - write a patch file capturing changes to source in the working 
directory
     stage    - as upload, but don't request processing of uploaded packages
     announce - compose and send a package announcement
-    repro-build - rebuild from created source package to temp directory
-    repro-diff  - check whether packages from original and rebuild differ
-    repro-check - run repro-build and repro-diff
+    repro-build  - rebuild from created source package to temp directory
+    repro-diff   - check whether packages from original and rebuild differ
+    repro-check  - run repro-build and repro-diff
+    repro-finish - delete the temp directory used for rebuild
 
 The standard arguments --help or --version may also be passed to cygport.
 
diff --git a/bin/cygport.in b/bin/cygport.in
index df38a8b5..15bd559e 100755
--- a/bin/cygport.in
+++ b/bin/cygport.in
@@ -801,6 +801,10 @@ do
                        __pkg_repro_diff
                        _status=$?
                        ;;
+               repro-finish)
+                       __pkg_repro_finish
+                       _status=$?
+                       ;;
                help)
                        __show_help;
                        exit 0;
diff --git a/lib/help.cygpart b/lib/help.cygpart
index d28fd7bb..ff03fb5f 100644
--- a/lib/help.cygpart
+++ b/lib/help.cygpart
@@ -59,6 +59,7 @@ __show_help() {
                  repro-build   rebuild from created source package to temp 
directory
                  repro-diff    check whether packages from original and 
rebuild differ
                  repro-check   run repro-build and repro-diff
+                 repro-finish  delete the temp directory used for rebuild
 
                See the included README file for further documentation.
 
diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index 25b80906..07313c66 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -1048,6 +1048,28 @@ __pkg_repro_diff() {
        inform "Rebuild produced identical packages"
 }
 
+__pkg_repro_finish() {
+       local t_spkgdir=${T}/${spkgdir##*/}
+
+       cd ${top}
+
+       __step "Removing rebuild directory in 2 seconds..."
+       inform "Rebuild dir: ${t_spkgdir}"
+       if ! [ -d ${t_spkgdir} ]
+       then
+               inform "Rebuild directory does not exist"
+               return 0
+       fi
+
+       sleep 2 || exit $?
+
+       __step "Removing rebuild directory NOW."
+       rm -rf ${t_spkgdir}
+
+       __step "Finished."
+}
+
 # protect functions
 readonly -f __pkg_binpkg __pkg_diff __gpg_sign __pkg_srcpkg __pkg_dist \
-        __pkg_repro_build __pkg_repro_diff __squeeze_whitespace __tar
+        __pkg_repro_build __pkg_repro_diff __pkg_repro_finish \
+        __squeeze_whitespace __tar
-- 
2.43.0

Reply via email to