Merge remote-tracking branch 'origin/master'

This commit is contained in:
Xinyu Hou 2014-10-21 16:00:56 +01:00
commit a58ca97941
3 changed files with 49 additions and 6 deletions

View File

@ -941,6 +941,24 @@ class InternalCommands:
print self.find_revision() print self.find_revision()
def find_revision(self): def find_revision(self):
return self.getGitRevision()
def getGitRevision(self):
if sys.version_info < (2, 4):
raise Exception("Python 2.4 or greater required.")
else:
p = subprocess.Popen(
["git", "log", "--pretty=format:%h", "-n", "1"],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
if p.returncode != 0:
raise Exception('Could not get revision - git info failed with code: ' + str(p.returncode))
return stdout
def find_revision_svn(self):
if sys.version_info < (2, 4): if sys.version_info < (2, 4):
stdout = commands.getoutput('svn info') stdout = commands.getoutput('svn info')
else: else:
@ -1174,7 +1192,8 @@ class InternalCommands:
shutil.rmtree(exportPath) shutil.rmtree(exportPath)
print 'Exporting repository to: ' + exportPath print 'Exporting repository to: ' + exportPath
err = os.system('svn export . ' + exportPath) os.mkdir(exportPath)
err = os.system('git archive master | tar -x -C ' + exportPath)
if err != 0: if err != 0:
raise Exception('Repository export failed: ' + str(err)) raise Exception('Repository export failed: ' + str(err))
@ -1403,7 +1422,7 @@ class InternalCommands:
def dist_name_rev(self, type): def dist_name_rev(self, type):
# find the version number (we're puting the rev in after this) # find the version number (we're puting the rev in after this)
pattern = '(.*\d+\.\d+\.\d+)(.*)' pattern = '(.*\d+\.\d+\.\d+)(.*)'
replace = '\g<1>-r' + self.find_revision() + '\g<2>' replace = '\g<1>-' + self.find_revision() + '\g<2>'
return re.sub(pattern, replace, self.dist_name(type)) return re.sub(pattern, replace, self.dist_name(type))
def dist_usage(self): def dist_usage(self):

View File

@ -62,6 +62,10 @@ enum {
kSynergyMouseScrollAxisY = 'saxy' kSynergyMouseScrollAxisY = 'saxy'
}; };
enum {
kCarbonLoopWaitTimeout = 10
};
// TODO: upgrade deprecated function usage in these functions. // TODO: upgrade deprecated function usage in these functions.
void setZeroSuppressionInterval(); void setZeroSuppressionInterval();
void avoidSupression(); void avoidSupression();
@ -1693,17 +1697,24 @@ COSXScreen::watchSystemPowerThread(void*)
// setting m_pmThreadReady to true otherwise the parent thread will // setting m_pmThreadReady to true otherwise the parent thread will
// block waiting for it. // block waiting for it.
if (m_pmRootPort == 0) { if (m_pmRootPort == 0) {
LOG((CLOG_WARN "failed to init watchSystemPowerThread"));
return; return;
} }
LOG((CLOG_DEBUG "started watchSystemPowerThread")); LOG((CLOG_DEBUG "started watchSystemPowerThread"));
LOG((CLOG_DEBUG "waiting for event loop"));
m_events->waitForReady(); m_events->waitForReady();
#if defined(MAC_OS_X_VERSION_10_7) #if defined(MAC_OS_X_VERSION_10_7)
{ {
CLock lockCarbon(m_carbonLoopMutex); CLock lockCarbon(m_carbonLoopMutex);
if (*m_carbonLoopReady == false) { if (*m_carbonLoopReady == false) {
// we signalling carbon loop ready before starting
// unless we know how to do it within the loop
LOG((CLOG_DEBUG "signalling carbon loop ready"));
*m_carbonLoopReady = true; *m_carbonLoopReady = true;
m_carbonLoopReady->signal(); m_carbonLoopReady->signal();
} }
@ -1713,6 +1724,7 @@ COSXScreen::watchSystemPowerThread(void*)
// start the run loop // start the run loop
LOG((CLOG_DEBUG "starting carbon loop")); LOG((CLOG_DEBUG "starting carbon loop"));
CFRunLoopRun(); CFRunLoopRun();
LOG((CLOG_DEBUG "carbon loop has stopped"));
// cleanup // cleanup
if (notificationPortRef) { if (notificationPortRef) {
@ -2126,14 +2138,26 @@ void
COSXScreen::waitForCarbonLoop() const COSXScreen::waitForCarbonLoop() const
{ {
#if defined(MAC_OS_X_VERSION_10_7) #if defined(MAC_OS_X_VERSION_10_7)
double timeout = ARCH->time() + 10; if (*m_carbonLoopReady) {
LOG((CLOG_DEBUG "carbon loop already ready"));
return;
}
CLock lock(m_carbonLoopMutex); CLock lock(m_carbonLoopMutex);
LOG((CLOG_DEBUG "waiting for carbon loop"));
double timeout = ARCH->time() + kCarbonLoopWaitTimeout;
while (!m_carbonLoopReady->wait()) { while (!m_carbonLoopReady->wait()) {
if(ARCH->time() > timeout) { if(ARCH->time() > timeout) {
throw std::runtime_error("carbon loop is not ready within 5 sec"); LOG((CLOG_DEBUG "carbon loop not ready, waiting again"));
timeout = ARCH->time() + kCarbonLoopWaitTimeout;
} }
} }
LOG((CLOG_DEBUG "carbon loop ready"));
#endif #endif
} }
#pragma GCC diagnostic ignored "-Wdeprecated-declarations" #pragma GCC diagnostic ignored "-Wdeprecated-declarations"

2
test
View File

@ -1 +1 @@
2 3