mirror of
https://github.com/QuasarApp/installer-framework.git
synced 2025-05-23 18:19:34 +00:00
Add new commandline argument.
In case we run an offline installer, --create-offline-repository will dump the whole installer content into the install directory and add an extra url to the repositories pointing to the mentioned local repository. This allows an offline user to add packages without the need of a new installation. Change-Id: I3e7eb0c56f632b74f5ea41b96bf3d9be83173f41 Reviewed-by: Tim Jenssen <tim.jenssen@nokia.com> Reviewed-by: Niels Weber <niels.2.weber@nokia.com>
This commit is contained in:
parent
9cad5d54cf
commit
92948d7ff3
@ -77,6 +77,7 @@ static QFont sVirtualComponentsFont;
|
||||
|
||||
static bool sNoForceInstallation = false;
|
||||
static bool sVirtualComponentsVisible = false;
|
||||
static bool sCreateLocalRepositoryFromBinary = false;
|
||||
|
||||
static QScriptValue checkArguments(QScriptContext *context, int amin, int amax)
|
||||
{
|
||||
@ -558,6 +559,18 @@ void PackageManagerCore::setNoForceInstallation(bool value)
|
||||
sNoForceInstallation = value;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool PackageManagerCore::createLocalRepositoryFromBinary()
|
||||
{
|
||||
return sCreateLocalRepositoryFromBinary;
|
||||
}
|
||||
|
||||
/* static */
|
||||
void PackageManagerCore::setCreateLocalRepositoryFromBinary(bool create)
|
||||
{
|
||||
sCreateLocalRepositoryFromBinary = create;
|
||||
}
|
||||
|
||||
RunMode PackageManagerCore::runMode() const
|
||||
{
|
||||
return isUpdater() ? UpdaterMode : AllMode;
|
||||
@ -1927,18 +1940,6 @@ QString PackageManagerCore::findDisplayVersion(const QString &componentName,
|
||||
return findDisplayVersion(replaceWith, components, versionKey, visited);
|
||||
}
|
||||
|
||||
bool PackageManagerCore::createLocalRepositoryFromBinary() const
|
||||
{
|
||||
return d->m_createLocalRepositoryFromBinary;
|
||||
}
|
||||
|
||||
void PackageManagerCore::setCreateLocalRepositoryFromBinary(bool create)
|
||||
{
|
||||
if (!isOfflineOnly())
|
||||
return;
|
||||
d->m_createLocalRepositoryFromBinary = create;
|
||||
}
|
||||
|
||||
ComponentModel *PackageManagerCore::componentModel(PackageManagerCore *core, const QString &objectName) const
|
||||
{
|
||||
ComponentModel *model = new ComponentModel(4, core);
|
||||
|
@ -98,6 +98,9 @@ public:
|
||||
static bool noForceInstallation();
|
||||
static void setNoForceInstallation(bool value);
|
||||
|
||||
static bool createLocalRepositoryFromBinary();
|
||||
static void setCreateLocalRepositoryFromBinary(bool create);
|
||||
|
||||
bool fetchLocalPackagesTree();
|
||||
LocalPackagesHash localInstalledPackages();
|
||||
|
||||
@ -233,9 +236,6 @@ public:
|
||||
bool needsRestart() const;
|
||||
bool finishedWithSuccess() const;
|
||||
|
||||
Q_INVOKABLE bool createLocalRepositoryFromBinary() const;
|
||||
Q_INVOKABLE void setCreateLocalRepositoryFromBinary(bool create);
|
||||
|
||||
public Q_SLOTS:
|
||||
bool runInstaller();
|
||||
bool runUninstaller();
|
||||
|
@ -168,7 +168,6 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core)
|
||||
, m_updateSourcesAdded(false)
|
||||
, m_componentsToInstallCalculated(false)
|
||||
, m_proxyFactory(0)
|
||||
, m_createLocalRepositoryFromBinary(false)
|
||||
, m_defaultModel(0)
|
||||
, m_updaterModel(0)
|
||||
{
|
||||
@ -193,7 +192,6 @@ PackageManagerCorePrivate::PackageManagerCorePrivate(PackageManagerCore *core, q
|
||||
, m_magicBinaryMarker(magicInstallerMaker)
|
||||
, m_componentsToInstallCalculated(false)
|
||||
, m_proxyFactory(0)
|
||||
, m_createLocalRepositoryFromBinary(false)
|
||||
, m_defaultModel(0)
|
||||
, m_updaterModel(0)
|
||||
, m_dependsOnLocalInstallerBinary(false)
|
||||
@ -519,7 +517,6 @@ void PackageManagerCorePrivate::initialize()
|
||||
{
|
||||
m_coreCheckedHash.clear();
|
||||
m_componentsToInstallCalculated = false;
|
||||
m_createLocalRepositoryFromBinary = false;
|
||||
|
||||
// first set some common variables that may used e.g. as placeholder
|
||||
// in some of the settings variables or in a script or...
|
||||
@ -1433,13 +1430,14 @@ bool PackageManagerCorePrivate::runInstaller()
|
||||
m_settings.applicationVersion()));
|
||||
|
||||
const int progressOperationCount = countProgressOperations(componentsToInstall)
|
||||
+ (m_createLocalRepositoryFromBinary ? 1 : 0); // add one more operation as we support progress
|
||||
// add one more operation as we support progress
|
||||
+ (PackageManagerCore::createLocalRepositoryFromBinary() ? 1 : 0);
|
||||
double progressOperationSize = componentsInstallPartProgressSize / progressOperationCount;
|
||||
|
||||
foreach (Component *component, componentsToInstall)
|
||||
installComponent(component, progressOperationSize, adminRightsGained);
|
||||
|
||||
if (m_createLocalRepositoryFromBinary) {
|
||||
if (m_core->isOfflineOnly() && PackageManagerCore::createLocalRepositoryFromBinary()) {
|
||||
emit m_core->titleMessageChanged(tr("Creating local repository"));
|
||||
ProgressCoordinator::instance()->emitLabelAndDetailTextChanged(QString());
|
||||
ProgressCoordinator::instance()->emitLabelAndDetailTextChanged(tr("Creating local repository"));
|
||||
|
@ -249,7 +249,6 @@ private:
|
||||
QSet<Component*> m_componentsToUninstall;
|
||||
QString m_componentsToInstallError;
|
||||
FileDownloaderProxyFactory *m_proxyFactory;
|
||||
bool m_createLocalRepositoryFromBinary;
|
||||
|
||||
ComponentModel *m_defaultModel;
|
||||
ComponentModel *m_updaterModel;
|
||||
|
@ -322,6 +322,8 @@ int main(int argc, char *argv[])
|
||||
core.addUserRepositories(repoList);
|
||||
} else if (argument == QLatin1String("--no-force-installations")) {
|
||||
PackageManagerCore::setNoForceInstallation(true);
|
||||
} else if (argument == QLatin1String("--create-offline-repository")) {
|
||||
PackageManagerCore::setCreateLocalRepositoryFromBinary(true);
|
||||
} else {
|
||||
std::cerr << "Unknown option: " << argument << std::endl;
|
||||
}
|
||||
|
@ -303,6 +303,9 @@ void InstallerBase::showUsage()
|
||||
<< "Set system proxy on Win and Mac. This option has no effect on Linux." << std::endl;
|
||||
std::cout << std::setw(55) << std::setiosflags(std::ios::left) << " --verbose" << std::setw(40)
|
||||
<< "Show debug output on the console" << std::endl;
|
||||
std::cout << std::setw(55) << std::setiosflags(std::ios::left) << " --create-offline-repository"
|
||||
<< std::setw(40) << "Offline installer only: Create a local repository inside the installation "
|
||||
"directory based on the offline installer's content" << std::endl;
|
||||
|
||||
std::cout << "\nDeveloper:"<< std::endl;
|
||||
std::cout << std::setw(55) << std::setiosflags(std::ios::left)
|
||||
|
Loading…
x
Reference in New Issue
Block a user