public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Add retry logic to rebaseall
@ 2014-01-16  4:23 David Boyce
  2014-01-16  6:19 ` Christopher Faylor
  0 siblings, 1 reply; 7+ messages in thread
From: David Boyce @ 2014-01-16  4:23 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 801 bytes --]

Jason et al,

Here's a suggested new flag (with patch, attached) for
/usr/bin/rebaseall. It adds a -w(ait) flag which causes the check for
running Cygwin processes to be done in a loop, breaking out and doing
the rebaseall as soon as it finds a quiescent moment.

We run Cygwin on build servers which are almost always busy. When they
need a rebase (which is rare with modern Cygwin but has happened) it's
hard to find a moment when things are quiet. Of course we can take a
server out of the queue, wait for builds to finish, rebase, and put it
back but that's a slow, manual process. Running "dash -c
'/usr/bin/rebaseall -w 10'" would tell it to try every 10 seconds
until it sees an opening, then go for it and exit.

Arguably, the flag should be -r (retry) but I'll leave that to you if accepted.

[-- Attachment #2: rebaseall.diff --]
[-- Type: text/plain, Size: 1972 bytes --]

--- /bin/rebaseall	2013-12-03 16:28:03.000000000 -0800
+++ /bin/rebaseall.dsb	2014-01-09 09:51:12.338413000 -0800
@@ -29,7 +29,7 @@
 PATH=$(cd $tp2 && pwd):/usr/bin:/bin
 
 ProgramName=${0##*/}
-ProgramOptions='48b:o:ps:tT:v'
+ProgramOptions='48b:o:ps:tT:vw:'
 DefaultBaseAddress=0x70000000
 DefaultOffset=0
 DefaultTouch=
@@ -41,7 +41,7 @@
 # Define functions
 usage()
 {
-    echo "usage: ${ProgramName} [-b BaseAddress] [-o Offset] [-s DllSuffix] [-T FileList | -] [-4|-8] [-p] [-t] [-v]"
+    echo "usage: ${ProgramName} [-b BaseAddress] [-o Offset] [-s DllSuffix] [-T FileList | -] [-4|-8] [-p] [-t] [-v] [-w seconds]"
     exit 1
 }
 
@@ -60,6 +60,7 @@
 Touch="${DefaultTouch}"
 NoDyn="${DefaultNoDyn}"
 Verbose="${DefaultVerbose}"
+WaitSeconds=0
 FileList="${DefaultFileList}"
 Suffixes="${DefaultSuffixes}"
 db_file_i386="/etc/rebase.db.i386"
@@ -123,11 +124,15 @@
 	FileList="${OPTARG}";;
     v)
 	Verbose="-v";;
+    w)
+	WaitSeconds="${OPTARG}";;
     \?)
 	usage;;
     esac
 done
 
+while :
+do
 # Verify only ash or dash processes are running
 if [ "${check_for_dash_only}" != "no" ]
 then
@@ -160,15 +165,25 @@
       ProcessResult=$?
       ;;
   esac
-  if [ $ProcessResult -eq 0 -a -z "${RebaseDebug}" ]
+      # If none found, we're good to go.
+      if [ $ProcessResult -ne 0 -o -n "${RebaseDebug}" ]
+      then
+	  break
+      fi
+      # Otherwise either quit or wait and retry.
+      if [ $WaitSeconds -eq 0 ]
   then
       echo "${ProgramName}: only ash or dash processes are allowed during rebasing"
       echo "    Exit all Cygwin processes and stop all Cygwin services."
       echo "    Execute ash (or dash) from Start/Run... or a cmd or command window."
       echo "    Execute '/bin/rebaseall' from ash (or dash)."
       exit 2
+      else
+	  echo "${ProgramName}: Cygwin processes found, retry in $WaitSeconds seconds ..."
+	  sleep $WaitSeconds
   fi
 fi
+done
 
 # Check if rebase database already exists.
 database_exists="no"

[-- Attachment #3: Type: text/plain, Size: 218 bytes --]

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

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

end of thread, other threads:[~2014-01-17 17:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-16  4:23 Add retry logic to rebaseall David Boyce
2014-01-16  6:19 ` Christopher Faylor
2014-01-16  8:54   ` Corinna Vinschen
2014-01-17 16:13     ` Jason Tishler
2014-01-17 16:31       ` David Boyce
2014-01-17 17:45         ` Jason Tishler
2014-01-17 17:50           ` Christopher Faylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).