From: David Boyce <david.s.boyce@gmail.com>
To: cygwin@cygwin.com
Subject: Add retry logic to rebaseall
Date: Thu, 16 Jan 2014 04:23:00 -0000 [thread overview]
Message-ID: <CACUHbYNK6e+NrBiNo9RUynqc=F39mLWnizQNFeU-DUSVj0rmeQ@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2014-01-16 4:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-16 4:23 David Boyce [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CACUHbYNK6e+NrBiNo9RUynqc=F39mLWnizQNFeU-DUSVj0rmeQ@mail.gmail.com' \
--to=david.s.boyce@gmail.com \
--cc=cygwin@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).