summaryrefslogtreecommitdiffstats
path: root/tools/binarycreator/binarycreator.cpp
diff options
context:
space:
mode:
authorKonstantin Podsvirov <konstantin@podsvirov.pro>2017-02-03 16:56:37 +0300
committerKatja Marttila <katja.marttila@qt.io>2017-03-13 05:11:47 +0000
commit2385184b8b1aeaac6d0b42739b44c4786a6e9cab (patch)
tree887115e79c0c196637c7a9e0ecfc88acd901bf3c /tools/binarycreator/binarycreator.cpp
parent6f6a632b2d53670ff62fc8c3842468c5dbeafb12 (diff)
Teach 'binarycreator' and 'repogen' to repack packages from repository
To both tools added options: --repository The directory containing the available repository. --ignore-invalid-repositories Ignore all invalid repositories instead of aborting. Documentation added to ifw-tools.html page. Task-number: QTIFW-925 Change-Id: I36519385df6166d0e450c0ef9d7df44c8611d6a6 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'tools/binarycreator/binarycreator.cpp')
-rw-r--r--tools/binarycreator/binarycreator.cpp44
1 files changed, 35 insertions, 9 deletions
diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp
index 7ffbe9bc9..85d89aab1 100644
--- a/tools/binarycreator/binarycreator.cpp
+++ b/tools/binarycreator/binarycreator.cpp
@@ -598,6 +598,7 @@ int main(int argc, char **argv)
QString target;
QString configFile;
QStringList packagesDirectories;
+ QStringList repositoryDirectories;
bool onlineOnly = false;
bool offlineOnly = false;
QStringList resources;
@@ -621,6 +622,16 @@ int main(int argc, char **argv)
"specified location."));
}
packagesDirectories.append(*it);
+ } else if (*it == QLatin1String("--repository")) {
+ ++it;
+ if (it == args.end()) {
+ return printErrorAndUsageAndExit(QString::fromLatin1("Error: Repository parameter missing argument."));
+ }
+ if (QFileInfo(*it).exists()) {
+ repositoryDirectories.append(*it);
+ } else {
+ return printErrorAndUsageAndExit(QString::fromLatin1("Error: Only local filesystem repositories now supported."));
+ }
} else if (*it == QLatin1String("-e") || *it == QLatin1String("--exclude")) {
++it;
if (!filteredPackages.isEmpty())
@@ -733,8 +744,8 @@ int main(int argc, char **argv)
if (configFile.isEmpty())
return printErrorAndUsageAndExit(QString::fromLatin1("Error: No configuration file selected."));
- if (packagesDirectories.isEmpty())
- return printErrorAndUsageAndExit(QString::fromLatin1("Error: Package directory parameter missing."));
+ if (packagesDirectories.isEmpty() && repositoryDirectories.isEmpty())
+ return printErrorAndUsageAndExit(QString::fromLatin1("Error: Both Package directory and Repository parameters missing."));
qDebug() << "Parsed arguments, ok.";
@@ -752,14 +763,29 @@ int main(int argc, char **argv)
// Note: the order here is important
- // 1; create the list of available packages
- QInstallerTools::PackageInfoVector packages =
- QInstallerTools::createListOfPackages(packagesDirectories, &filteredPackages, ftype);
+ QInstallerTools::PackageInfoVector packages;
+
+ // 1; update the list of available compressed packages
+ if (!repositoryDirectories.isEmpty()) {
+ // 1.1; search packages
+ QInstallerTools::PackageInfoVector precompressedPackages = QInstallerTools::createListOfRepositoryPackages(repositoryDirectories,
+ &filteredPackages, ftype);
+ // 1.2; add to common vector
+ packages.append(precompressedPackages);
+ }
- // 2; copy the packages data and setup the packages vector with the files we copied,
- // must happen before copying meta data because files will be compressed if
- // needed and meta data generation relies on this
- QInstallerTools::copyComponentData(packagesDirectories, tmpRepoDir, &packages);
+ // 2; update the list of available prepared packages
+ if (!packagesDirectories.isEmpty()) {
+ // 2.1; search packages
+ QInstallerTools::PackageInfoVector preparedPackages = QInstallerTools::createListOfPackages(packagesDirectories,
+ &filteredPackages, ftype);
+ // 2.2; copy the packages data and setup the packages vector with the files we copied,
+ // must happen before copying meta data because files will be compressed if
+ // needed and meta data generation relies on this
+ QInstallerTools::copyComponentData(packagesDirectories, tmpRepoDir, &preparedPackages);
+ // 2.3; add to common vector
+ packages.append(preparedPackages);
+ }
// 3; copy the meta data of the available packages, generate Updates.xml
QInstallerTools::copyMetaData(tmpMetaDir, tmpRepoDir, packages, settings