https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/cygport.git;h=8728a790b21f99484af237b9a3f1786928e1a9aa

commit 8728a790b21f99484af237b9a3f1786928e1a9aa
Author: Christian Franke <[email protected]>
Date:   Mon Mar 11 12:12:32 2024 +0100

    Add repro-finish command
    
    This command removes the temporary directory used by repro-check.


Diff:
---
 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

Reply via email to