Skip to content
GitLab
Menu
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
875b425d
Commit
875b425d
authored
Aug 06, 2010
by
ck
Browse files
Maemo: Warn about problematic project name and try to work around it.
Reviewed-by: kh1
parent
9704844e
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp
View file @
875b425d
...
...
@@ -58,6 +58,7 @@
#include <QtCore/QProcess>
#include <QtCore/QProcessEnvironment>
#include <QtCore/QRegExp>
#include <QtCore/QStringBuilder>
#include <QtGui/QWidget>
...
...
@@ -134,6 +135,7 @@ bool MaemoPackageCreationStep::createPackage()
return
true
;
emit
addOutput
(
tr
(
"Creating package file ..."
),
BuildStep
::
MessageOutput
);
checkProjectName
();
m_buildProc
.
reset
(
new
QProcess
);
QString
error
;
if
(
!
preparePackagingProcess
(
m_buildProc
.
data
(),
maemoToolChain
(),
...
...
@@ -221,7 +223,8 @@ bool MaemoPackageCreationStep::removeDirectory(const QString &dirPath)
if
(
!
dir
.
exists
())
return
true
;
const
QStringList
&
files
=
dir
.
entryList
(
QDir
::
Files
);
const
QStringList
&
files
=
dir
.
entryList
(
QDir
::
Files
|
QDir
::
Hidden
|
QDir
::
System
);
foreach
(
const
QString
&
fileName
,
files
)
{
if
(
!
dir
.
remove
(
fileName
))
return
false
;
...
...
@@ -428,10 +431,34 @@ QString MaemoPackageCreationStep::packagingCommand(const MaemoToolChain *tc,
return
perl
+
tc
->
maddeRoot
()
%
QLatin1String
(
"/madbin/"
)
%
commandName
;
}
void
MaemoPackageCreationStep
::
checkProjectName
()
{
const
QRegExp
legalName
(
QLatin1String
(
"[0-9-+a-z
\\
.]+"
));
if
(
!
legalName
.
exactMatch
(
buildConfiguration
()
->
target
()
->
project
()
->
displayName
()))
{
emit
addTask
(
Task
(
Task
::
Warning
,
tr
(
"Your project name contains characters not allowed in Debian packages.
\n
"
"They must only use lower-case letters, numbers, '-', '+' and '.'.
\n
"
"We will try to work around that, but you may experience problems."
),
QString
(),
-
1
,
TASK_CATEGORY_BUILDSYSTEM
));
}
}
QString
MaemoPackageCreationStep
::
packageName
(
const
ProjectExplorer
::
Project
*
project
)
{
QString
packageName
=
project
->
displayName
().
toLower
();
const
QRegExp
legalLetter
(
QLatin1String
(
"[a-z0-9+-.]"
),
Qt
::
CaseSensitive
,
QRegExp
::
WildcardUnix
);
for
(
int
i
=
0
;
i
<
packageName
.
length
();
++
i
)
{
if
(
!
legalLetter
.
exactMatch
(
packageName
.
mid
(
i
,
1
)))
packageName
[
i
]
=
QLatin1Char
(
'-'
);
}
return
packageName
;
}
QString
MaemoPackageCreationStep
::
packageFileName
(
const
ProjectExplorer
::
Project
*
project
,
const
QString
&
version
)
{
return
p
roject
->
displayName
(
)
%
QLatin1Char
(
'_'
)
%
version
return
p
ackageName
(
project
)
%
QLatin1Char
(
'_'
)
%
version
%
QLatin1String
(
"_armel.deb"
);
}
...
...
src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h
View file @
875b425d
...
...
@@ -79,6 +79,7 @@ public:
const
QString
&
workingDir
,
QString
*
error
);
static
QString
packagingCommand
(
const
MaemoToolChain
*
tc
,
const
QString
&
commandName
);
static
QString
packageName
(
const
ProjectExplorer
::
Project
*
project
);
static
QString
packageFileName
(
const
ProjectExplorer
::
Project
*
project
,
const
QString
&
version
);
...
...
@@ -116,6 +117,7 @@ private:
const
Qt4BuildConfiguration
*
qt4BuildConfiguration
()
const
;
const
MaemoToolChain
*
maemoToolChain
()
const
;
MaemoDeployStep
*
deployStep
()
const
;
void
checkProjectName
();
static
const
QLatin1String
CreatePackageId
;
...
...
src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp
View file @
875b425d
...
...
@@ -147,7 +147,7 @@ bool MaemoTemplatesManager::createTemplatesIfNecessary(const ProjectExplorer::Ta
}
const
QString
command
=
QLatin1String
(
"dh_make -s -n -p "
)
+
project
->
displayName
(
)
+
QLatin1Char
(
'_'
)
+
MaemoPackageCreationStep
::
packageName
(
project
)
+
QLatin1Char
(
'_'
)
+
MaemoPackageCreationStep
::
DefaultVersionNumber
;
dh_makeProc
.
start
(
MaemoPackageCreationStep
::
packagingCommand
(
tc
,
command
));
if
(
!
dh_makeProc
.
waitForStarted
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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