1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #include "s60createpackageparser.h"
36 #include <projectexplorer/projectexplorerconstants.h>
37 #include <projectexplorer/taskwindow.h>
39 #include <QtCore/QDebug>
41 using namespace Qt4ProjectManager::Internal;
43 S60CreatePackageParser::S60CreatePackageParser(const QString &packageName) :
44 m_packageName(packageName),
45 m_needPassphrase(false)
47 setObjectName(QLatin1String("S60CreatePackageParser"));
48 m_signSis.setPattern("^(\\s*|\\(\\d+\\)\\s*:\\s*)(error\\s?:\\s?)+(.+)$");
49 m_signSis.setMinimal(true);
50 m_signSis.setCaseSensitivity(Qt::CaseInsensitive);
53 bool S60CreatePackageParser::parseLine(const QString &line)
55 if (line.startsWith("Patching: ")) {
56 m_patchingLines.append(line.mid(10).trimmed());
59 if (!m_patchingLines.isEmpty()) {
60 emit packageWasPatched(m_packageName, m_patchingLines);
62 QString lines = m_patchingLines.join("\n");
63 m_patchingLines.clear();
64 //: %1 package name, %2 will be replaced by a list of patching lines.
65 QString message = tr("The binary package '%1' was patched to be installable after being self-signed.\n%2\n"
66 "Use a developer certificate or any other signing option to prevent "
67 "this patching from happening.").
68 arg(m_packageName, lines);
69 ProjectExplorer::Task task(ProjectExplorer::Task::Warning, message, QString(), -1,
70 ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM);
72 QTextLayout::FormatRange fr;
73 fr.start = message.indexOf(lines);
74 fr.length = lines.length();
75 fr.format.setFontItalic(true);
76 task.formats.append(fr);
81 if (m_signSis.indexIn(line) > -1) {
82 QString errorMessage(m_signSis.cap(3));
83 if (errorMessage.contains(QLatin1String("bad password"))
84 || errorMessage.contains(QLatin1String("bad decrypt")))
85 m_needPassphrase = true;
86 else if (errorMessage.contains(QLatin1String("Cannot open file"))
87 && errorMessage.contains(QLatin1String("smartinstaller")))
88 emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error,
89 tr("Cannot create Smart Installer package "
90 "as the Smart Installer's base file is missing. "
91 "Please ensure that it is located in the SDK."),
93 ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
95 emit addTask(ProjectExplorer::Task(ProjectExplorer::Task::Error, errorMessage, QString(), -1,
96 ProjectExplorer::Constants::TASK_CATEGORY_BUILDSYSTEM));
102 void S60CreatePackageParser::stdOutput(const QString &line)
104 if (!parseLine(line))
105 IOutputParser::stdOutput(line);
108 void S60CreatePackageParser::stdError(const QString &line)
110 if (!parseLine(line))
111 IOutputParser::stdError(line);
114 bool S60CreatePackageParser::needPassphrase() const
116 return m_needPassphrase;
120 make[1]: Entering directory `C:/temp/test/untitled131'
121 createpackage.bat -g untitled131_template.pkg RELEASE-armv5
122 Auto-patching capabilities for self signed package.
124 Patching package file and relevant binaries...
125 Patching: Removed dependency to qt.sis (0x2001E61C) to avoid installation issues in case qt.sis is also patched.
128 NOTE: A patched package may not work as expected due to reduced capabilities and other modifications,
129 so it should not be used for any kind of Symbian signing or distribution!
130 Use a proper certificate to avoid the need to patch the package.
132 Processing untitled131_release-armv5.pkg...
136 (35) : error: Cannot find file : c:/QtSDK/Symbian/SDKs/Symbian3Qt471/epoc32/data/z/resource/apps/untitledSymbian.mif