Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
44a953e8
Commit
44a953e8
authored
Apr 15, 2010
by
ck
Browse files
Maemo: Deploy and install packages instead of raw executables.
Reviewed-by: kh1
parent
588884be
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp
View file @
44a953e8
...
...
@@ -134,7 +134,7 @@ bool MaemoPackageCreationStep::createPackage()
if
(
!
QFileInfo
(
projectDir
+
QLatin1String
(
"/debian"
)).
exists
())
{
const
QString
command
=
QLatin1String
(
"dh_make -s -n -p "
)
%
executableFileName
()
%
versionString
();
%
executableFileName
()
.
toLower
()
%
versionString
();
if
(
!
runCommand
(
buildProc
,
command
))
return
false
;
QFile
rulesFile
(
projectDir
+
QLatin1String
(
"/debian/rules"
));
...
...
@@ -157,8 +157,7 @@ bool MaemoPackageCreationStep::createPackage()
return
false
;
const
QString
targetFile
(
projectDir
%
QLatin1String
(
"/debian/"
)
%
executableFileName
().
toLower
()
%
QLatin1String
(
"/usr/bin/"
)
%
executableFileName
());
%
executableFileName
().
toLower
()
%
executableFilePathOnTarget
());
if
(
QFile
::
exists
(
targetFile
))
{
if
(
!
QFile
::
remove
(
targetFile
))
{
qDebug
(
"Error: Could not remove '%s'"
,
qPrintable
(
targetFile
));
...
...
@@ -245,27 +244,30 @@ QString MaemoPackageCreationStep::targetRoot() const
bool
MaemoPackageCreationStep
::
packagingNeeded
()
const
{
#if 1
// TODO: When the package contents get user-modifiable, we need
// to check whether files have been added and/or removed and whether
// the newest one is newer than the package.
// For the first check, we should have a switch that the widget sets
// to true when the user has changed the package contents and which
// we set to false after a successful package creation.
QFileInfo
packageInfo
(
packageFilePath
(
executable
()
));
QFileInfo
packageInfo
(
packageFilePath
());
return
!
packageInfo
.
exists
()
||
packageInfo
.
lastModified
()
<=
QFileInfo
(
executable
()).
lastModified
();
#else
return
false
;
#endif
}
QString
MaemoPackageCreationStep
::
packageFilePath
(
const
QString
&
executableFilePath
)
QString
MaemoPackageCreationStep
::
packageFilePath
()
const
{
QFileInfo
execInfo
(
executable
());
return
execInfo
.
path
()
%
QDir
::
separator
()
%
execInfo
.
fileName
().
toLower
()
%
versionString
()
%
QLatin1String
(
"_armel.deb"
);
}
QString
MaemoPackageCreationStep
::
executableFilePathOnTarget
()
const
{
return
executableFilePath
%
versionString
()
%
QLatin1String
(
"_armel.deb"
);
return
QLatin1String
(
"/usr/bin/"
)
%
executableFileName
(
);
}
QString
MaemoPackageCreationStep
::
versionString
()
QString
MaemoPackageCreationStep
::
versionString
()
const
{
return
QLatin1String
(
"_0.1"
);
}
...
...
src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h
View file @
44a953e8
...
...
@@ -56,11 +56,13 @@ class Qt4BuildConfiguration;
class
MaemoPackageCreationStep
:
public
ProjectExplorer
::
BuildStep
{
Q_OBJECT
friend
class
MaemoPackageCreationFactory
;
public:
MaemoPackageCreationStep
(
ProjectExplorer
::
BuildConfiguration
*
buildConfig
);
static
QString
packageFilePath
(
const
QString
&
executableFilePath
);
QString
packageFilePath
()
const
;
QString
executableFilePathOnTarget
()
const
;
private:
MaemoPackageCreationStep
(
ProjectExplorer
::
BuildConfiguration
*
buildConfig
,
MaemoPackageCreationStep
*
other
);
...
...
@@ -80,7 +82,7 @@ private:
QString
targetRoot
()
const
;
bool
packagingNeeded
()
const
;
static
QString
versionString
();
QString
versionString
()
const
;
static
const
QLatin1String
CreatePackageId
;
};
...
...
src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.cpp
View file @
44a953e8
...
...
@@ -30,6 +30,7 @@
#include
"maemoconstants.h"
#include
"maemomanager.h"
#include
"maemopackagecreationstep.h"
#include
"maemorunconfigurationwidget.h"
#include
"maemotoolchain.h"
...
...
@@ -39,6 +40,7 @@
#include
<projectexplorer/projectexplorer.h>
#include
<projectexplorer/session.h>
#include
<qt4projectmanager/qt4buildconfiguration.h>
#include
<qt4projectmanager/qt4project.h>
#include
<utils/qtcassert.h>
...
...
@@ -211,7 +213,8 @@ void MaemoRunConfiguration::getDeployTimesFromMap(const QString &key,
bool
MaemoRunConfiguration
::
currentlyNeedsDeployment
(
const
QString
&
host
)
const
{
return
fileNeedsDeployment
(
executable
(),
m_lastDeployed
.
value
(
host
));
return
fileNeedsDeployment
(
packageStep
()
->
packageFilePath
(),
m_lastDeployed
.
value
(
host
));
}
void
MaemoRunConfiguration
::
wasDeployed
(
const
QString
&
host
)
...
...
@@ -293,6 +296,20 @@ const QString MaemoRunConfiguration::gdbCmd() const
return
QString
();
}
const
MaemoPackageCreationStep
*
MaemoRunConfiguration
::
packageStep
()
const
{
const
QList
<
ProjectExplorer
::
BuildStep
*>
&
buildSteps
=
activeQt4BuildConfiguration
()
->
steps
(
ProjectExplorer
::
Build
);
for
(
int
i
=
buildSteps
.
count
()
-
1
;
i
>=
0
;
--
i
)
{
const
MaemoPackageCreationStep
*
const
pStep
=
qobject_cast
<
MaemoPackageCreationStep
*>
(
buildSteps
.
at
(
i
));
if
(
pStep
)
return
pStep
;
}
Q_ASSERT
(
!
"Impossible: Maemo run configuration without packaging step."
);
return
0
;
}
QString
MaemoRunConfiguration
::
maddeRoot
()
const
{
if
(
const
MaemoToolChain
*
tc
=
toolchain
())
...
...
src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h
View file @
44a953e8
...
...
@@ -52,6 +52,7 @@ class Qt4BuildConfiguration;
class
Qt4ProFileNode
;
class
Qt4Target
;
class
MaemoPackageCreationStep
;
class
MaemoRunConfigurationFactory
;
class
MaemoRunConfiguration
:
public
ProjectExplorer
::
RunConfiguration
...
...
@@ -75,6 +76,8 @@ public:
bool
debuggingHelpersNeedDeployment
(
const
QString
&
host
)
const
;
void
debuggingHelpersDeployed
(
const
QString
&
host
);
const
MaemoPackageCreationStep
*
packageStep
()
const
;
QString
maddeRoot
()
const
;
QString
executable
()
const
;
const
QString
sysRoot
()
const
;
...
...
src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp
View file @
44a953e8
...
...
@@ -33,6 +33,8 @@
****************************************************************************/
#include
"maemoruncontrol.h"
#include
"maemopackagecreationstep.h"
#include
"maemosshthread.h"
#include
"maemorunconfiguration.h"
...
...
@@ -122,7 +124,7 @@ void AbstractMaemoRunControl::startDeployment(bool forDebugging)
}
else
{
m_deployables
.
clear
();
if
(
m_runConfig
->
currentlyNeedsDeployment
(
m_devConfig
.
host
))
{
m_deployables
.
append
(
Deployable
(
executabl
eFileName
(),
m_deployables
.
append
(
Deployable
(
packag
eFileName
(),
QFileInfo
(
executableOnHost
()).
canonicalPath
(),
&
MaemoRunConfiguration
::
wasDeployed
));
}
...
...
@@ -181,6 +183,21 @@ bool AbstractMaemoRunControl::isDeploying() const
return
m_sshDeployer
&&
m_sshDeployer
->
isRunning
();
}
QString
AbstractMaemoRunControl
::
packageFileName
()
const
{
return
QFileInfo
(
packageFilePath
()).
fileName
();
}
QString
AbstractMaemoRunControl
::
packageFilePath
()
const
{
return
m_runConfig
->
packageStep
()
->
packageFilePath
();
}
QString
AbstractMaemoRunControl
::
executableFilePathOnTarget
()
const
{
return
m_runConfig
->
packageStep
()
->
executableFilePathOnTarget
();
}
bool
AbstractMaemoRunControl
::
isCleaning
()
const
{
return
m_initialCleaner
&&
m_initialCleaner
->
isRunning
();
...
...
@@ -277,13 +294,6 @@ const QString AbstractMaemoRunControl::executableOnHost() const
return
m_runConfig
->
executable
();
}
const
QString
AbstractMaemoRunControl
::
sshPort
()
const
{
return
m_devConfig
.
type
==
MaemoDeviceConfig
::
Physical
?
QString
::
number
(
m_devConfig
.
sshPort
)
:
m_runConfig
->
simulatorSshPort
();
}
const
QString
AbstractMaemoRunControl
::
executableFileName
()
const
{
return
QFileInfo
(
executableOnHost
()).
fileName
();
...
...
@@ -294,34 +304,27 @@ const QString AbstractMaemoRunControl::remoteDir() const
return
homeDirOnDevice
(
m_devConfig
.
uname
);
}
const
QString
List
AbstractMaemoRunControl
::
options
()
const
QString
AbstractMaemoRunControl
::
remoteSudo
()
const
{
const
bool
usePassword
=
m_devConfig
.
authentication
==
MaemoDeviceConfig
::
Password
;
const
QLatin1String
opt
(
"-o"
);
QStringList
optionList
;
if
(
!
usePassword
)
optionList
<<
QLatin1String
(
"-i"
)
<<
m_devConfig
.
keyFile
;
return
optionList
<<
opt
<<
QString
::
fromLatin1
(
"PasswordAuthentication=%1"
).
arg
(
usePassword
?
"yes"
:
"no"
)
<<
opt
<<
QString
::
fromLatin1
(
"PubkeyAuthentication=%1"
).
arg
(
usePassword
?
"no"
:
"yes"
)
<<
opt
<<
QString
::
fromLatin1
(
"ConnectTimeout=%1"
).
arg
(
m_devConfig
.
timeout
)
<<
opt
<<
QLatin1String
(
"CheckHostIP=no"
)
<<
opt
<<
QLatin1String
(
"StrictHostKeyChecking=no"
);
return
QLatin1String
(
"/usr/lib/mad-developer/devrootsh"
);
}
const
QString
AbstractMaemoRunControl
::
executableOnTarget
()
const
QString
AbstractMaemoRunControl
::
remoteInstallCommand
()
const
{
return
QString
::
fromLocal8Bit
(
"%1
/
%2"
).
arg
(
remote
Dir
())
.
arg
(
executabl
eFileName
());
return
QString
::
fromLocal8Bit
(
"%1
dpkg -i
%2"
).
arg
(
remote
Sudo
())
.
arg
(
packag
eFileName
());
}
const
QString
AbstractMaemoRunControl
::
targetCmdLinePrefix
()
const
{
return
QString
::
fromLocal8Bit
(
"chmod u+x %1; source /etc/profile; "
).
arg
(
executableOnTarget
());
return
QString
::
fromLocal8Bit
(
"%1 && %2 chmod u+x %3 && source /etc/profile && "
)
.
arg
(
remoteInstallCommand
()).
arg
(
remoteSudo
())
.
arg
(
executableFilePathOnTarget
());
}
QString
AbstractMaemoRunControl
::
targetCmdLineSuffix
()
const
{
return
m_runConfig
->
arguments
().
join
(
" "
);
}
void
AbstractMaemoRunControl
::
handleError
(
const
QString
&
errString
)
...
...
@@ -348,9 +351,8 @@ void MaemoRunControl::startInternal()
QString
MaemoRunControl
::
remoteCall
()
const
{
return
QString
::
fromLocal8Bit
(
"%1 %2 %3"
)
.
arg
(
targetCmdLinePrefix
()).
arg
(
executableOnTarget
())
.
arg
(
m_runConfig
->
arguments
().
join
(
" "
));
return
QString
::
fromLocal8Bit
(
"%1 %2 %3"
).
arg
(
targetCmdLinePrefix
())
.
arg
(
executableFilePathOnTarget
()).
arg
(
targetCmdLineSuffix
());
}
void
MaemoRunControl
::
stopInternal
()
...
...
@@ -407,7 +409,7 @@ QString MaemoDebugRunControl::remoteCall() const
{
return
QString
::
fromLocal8Bit
(
"%1 gdbserver :%2 %3 %4"
)
.
arg
(
targetCmdLinePrefix
()).
arg
(
gdbServerPort
())
.
arg
(
executableOnTarget
()).
arg
(
m_runConfig
->
arguments
().
join
(
" "
));
.
arg
(
executable
FilePath
OnTarget
()).
arg
(
targetCmdLineSuffix
(
));
}
void
MaemoDebugRunControl
::
handleRemoteOutput
(
const
QString
&
output
)
...
...
src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h
View file @
44a953e8
...
...
@@ -77,12 +77,14 @@ protected:
void
startExecution
();
void
handleError
(
const
QString
&
errString
);
const
QString
executableOnHost
()
const
;
const
QString
executableOnTarget
()
const
;
const
QString
executableFileName
()
const
;
const
QString
sshPort
()
const
;
const
QString
targetCmdLinePrefix
()
const
;
QString
targetCmdLineSuffix
()
const
;
const
QString
remoteDir
()
const
;
const
QStringList
options
()
const
;
QString
packageFileName
()
const
;
QString
packageFilePath
()
const
;
QString
executableFilePathOnTarget
()
const
;
private
slots
:
virtual
void
handleRemoteOutput
(
const
QString
&
output
)
=
0
;
void
handleInitialCleanupFinished
();
...
...
@@ -98,10 +100,13 @@ private:
virtual
void
startInternal
()
=
0
;
virtual
void
stopInternal
()
=
0
;
virtual
QString
remoteCall
()
const
=
0
;
void
startInitialCleanup
();
void
killRemoteProcesses
(
const
QStringList
&
apps
,
bool
initialCleanup
);
bool
isCleaning
()
const
;
bool
isDeploying
()
const
;
QString
remoteSudo
()
const
;
QString
remoteInstallCommand
()
const
;
QFutureInterface
<
void
>
m_progress
;
QScopedPointer
<
MaemoSshDeployer
>
m_sshDeployer
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment