From 9561e4cd6185b461646d1910e80bc849b677711d Mon Sep 17 00:00:00 2001
From: Niels Weber <niels.weber@digia.com>
Date: Fri, 22 Feb 2013 14:30:18 +0100
Subject: [PATCH] remove configfile use for repogen

Change-Id: I54b9e59ad5d9d4092996fe5fd58157631c552f3f
Reviewed-by: Karsten Heimrich <karsten.heimrich@digia.com>
---
 installerfw.pri                |  2 ++
 tools/common/repositorygen.cpp |  2 --
 tools/repogen/repogen.cpp      | 29 ++++++++---------------------
 3 files changed, 10 insertions(+), 23 deletions(-)

diff --git a/installerfw.pri b/installerfw.pri
index 3799fcdc..bec36d95 100644
--- a/installerfw.pri
+++ b/installerfw.pri
@@ -5,6 +5,8 @@ IFW_PRI_INCLUDED = 1
 
 IFW_VERSION = 1.2.81
 
+IFW_REPOSITORY_FORMAT_VERSION = 1.0.0
+
 IFW_NEWLINE = $$escape_expand(\\n\\t)
 
 defineReplace(toNativeSeparators) {
diff --git a/tools/common/repositorygen.cpp b/tools/common/repositorygen.cpp
index 6bdc52b4..4ca7867a 100644
--- a/tools/common/repositorygen.cpp
+++ b/tools/common/repositorygen.cpp
@@ -61,8 +61,6 @@ using namespace QInstallerTools;
 
 void QInstallerTools::printRepositoryGenOptions()
 {
-    std::cout << "  -c|--config file          The file containing the installer configuration" << std::endl;
-
     std::cout << "  -p|--packages dir         The directory containing the available packages." << std::endl;
     std::cout << "                            Defaults to the current working directory." << std::endl;
 
diff --git a/tools/repogen/repogen.cpp b/tools/repogen/repogen.cpp
index 9c20234a..1380e4eb 100644
--- a/tools/repogen/repogen.cpp
+++ b/tools/repogen/repogen.cpp
@@ -53,6 +53,9 @@
 
 #include <iostream>
 
+#define QUOTE_(x) #x
+#define QUOTE(x) QUOTE_(x)
+
 using namespace Lib7z;
 using namespace QInstaller;
 
@@ -76,7 +79,7 @@ static void printUsage()
 
     std::cout << std::endl;
     std::cout << "Example:" << std::endl;
-    std::cout << "  " << appName << " -p ../examples/packages -c ../examples/config/config.xml -u "
+    std::cout << "  " << appName << " -p ../examples/packages -u "
         "http://www.some-server.com:8080 repository/" << std::endl;
 }
 
@@ -107,7 +110,6 @@ int main(int argc, char** argv)
         QStringList filteredPackages;
         bool updateExistingRepository = false;
         QString packagesDir;
-        QString configFile;
         QString redirectUpdateUrl;
         QInstallerTools::FilterType filterType = QInstallerTools::Exclude;
         bool remove = false;
@@ -156,21 +158,8 @@ int main(int argc, char** argv)
                 args.removeFirst();
                 if (args.isEmpty())
                     return printErrorAndUsageAndExit(QObject::tr("Error: Config parameter missing argument"));
-                const QFileInfo fi(args.first());
-                if (!fi.exists()) {
-                    return printErrorAndUsageAndExit(QObject::tr("Error: Config file %1 not found "
-                        "at the specified location").arg(args.first()));
-                }
-                if (!fi.isFile()) {
-                    return printErrorAndUsageAndExit(QObject::tr("Error: Configuration %1 is not a "
-                        "file").arg(args.first()));
-                }
-                if (!fi.isReadable()) {
-                    return printErrorAndUsageAndExit(QObject::tr("Error: Config file %1 is not "
-                        "readable").arg(args.first()));
-                }
-                configFile = args.first();
                 args.removeFirst();
+                std::cout << "Config file parameter is deprecated and ignored." << std::endl;
             } else if (args.first() == QLatin1String("-u") || args.first() == QLatin1String("--updateurl")) {
                 args.removeFirst();
                 if (args.isEmpty())
@@ -189,7 +178,7 @@ int main(int argc, char** argv)
             }
         }
 
-        if ((packagesDir.isEmpty() || configFile.isEmpty() || args.count() != 1)) {
+        if (packagesDir.isEmpty() || (args.count() != 1)) {
                 printUsage();
                 return 1;
         }
@@ -224,10 +213,8 @@ int main(int argc, char** argv)
         const QString metaTmp = createTemporaryDirectory();
         tmpDeleter.add(metaTmp);
 
-        QString configDir = QFileInfo(configFile).canonicalPath();
-        const Settings &settings = Settings::fromFileAndPrefix(configFile, configDir);
-        generateMetaDataDirectory(metaTmp, repositoryDir, packages, settings.applicationName(),
-            settings.applicationVersion(), redirectUpdateUrl);
+        generateMetaDataDirectory(metaTmp, repositoryDir, packages, QLatin1String("{AnyApplication}"),
+            QLatin1String(QUOTE(IFW_REPOSITORY_FORMAT_VERSION)), redirectUpdateUrl);
         QInstallerTools::compressMetaDirectories(metaTmp, metaTmp, pathToVersionMapping);
 
         QDirIterator it(repositoryDir, QStringList(QLatin1String("Updates*.xml")), QDir::Files | QDir::CaseSensitive);