From 9dfa0c6e7221906f07927266f4f2c91405fa7acd Mon Sep 17 00:00:00 2001 From: tjenssen Date: Tue, 13 Mar 2012 16:16:36 +0100 Subject: remove unused methods in repositorygen.cpp Change-Id: I5ff1a0580fec21e23fe262a6f605ba5eb76e0bd3 Reviewed-by: Karsten Heimrich --- installerbuilder/common/repositorygen.cpp | 99 ------------------------------- 1 file changed, 99 deletions(-) diff --git a/installerbuilder/common/repositorygen.cpp b/installerbuilder/common/repositorygen.cpp index 0f2f174da..b4610f3a4 100644 --- a/installerbuilder/common/repositorygen.cpp +++ b/installerbuilder/common/repositorygen.cpp @@ -98,105 +98,6 @@ static PackageInfo findMatchingPackage(const QString &name, const PackageInfoVec return PackageInfo(); } -/*! - Returns true, when the \a package's identifier starts with, but not equals \a prefix. -*/ -static bool packageHasPrefix(const PackageInfo &package, const QString &prefix) -{ - return package.name.startsWith(prefix) - && package.name.mid(prefix.length(), 1) == QLatin1String("."); -} - -/*! - Returns true, when all \a packages start with \a prefix -*/ -static bool allPackagesHavePrefix(const PackageInfoVector &packages, const QString &prefix) -{ - for (PackageInfoVector::const_iterator it = packages.begin(); it != packages.end(); ++it) { - if (!packageHasPrefix(*it, prefix)) - return false; - } - return true; -} - -/*! - Returns all packages out of \a all starting with \a prefix. -*/ -static PackageInfoVector packagesWithPrefix(const PackageInfoVector &all, const QString &prefix) -{ - PackageInfoVector result; - for (PackageInfoVector::const_iterator it = all.begin(); it != all.end(); ++it) { - if (packageHasPrefix(*it, prefix)) - result.push_back(*it); - } - return result; -} - -static PackageInfoVector calculateNeededPackages(const QStringList &components, - const PackageInfoVector &available, bool addDependencies = true) -{ - PackageInfoVector result; - - for (QStringList::const_iterator it = components.begin(); it != components.end(); ++it) { - static bool recursion = false; - static QStringList hitComponents; - - if (!recursion) - hitComponents.clear(); - - if (hitComponents.contains(*it)) - throw Error(QObject::tr("Circular dependencies detected.").arg(*it)); - hitComponents.push_back(*it); - - recursion = true; - - qDebug() << "Trying to find a package for name" << *it << "... "; - const PackageInfo info = findMatchingPackage(*it, available); - if (info.name.isEmpty()) { - qDebug() << "Not found :-o"; - qDebug() << "\tCouldn't find package for component " << *it << " bailing out..."; - throw Error(QObject::tr("Couldn't find package for component %1.").arg(*it)); - } - qDebug() << "Found."; - if (!result.contains(info)) { - result.push_back(info); - - if (addDependencies) { - PackageInfoVector dependencies; - - if (!info.dependencies.isEmpty()) { - qDebug() << "\tIt depends on:"; - for (QStringList::const_iterator dep = info.dependencies.begin(); - dep != info.dependencies.end(); ++dep) { - qDebug() << "\t\t" << *dep; - } - dependencies += calculateNeededPackages(info.dependencies, available); - } - // append all child items, as this package was requested explicitly - dependencies += packagesWithPrefix(available, info.name); - - for (PackageInfoVector::const_iterator dep = dependencies.begin(); - dep != dependencies.end(); ++dep) { - if (result.contains(*dep)) - continue; - - result += *dep; - const PackageInfoVector depdeps = calculateNeededPackages(QStringList() - << dep->name, available); - for (PackageInfoVector::const_iterator dep2 = depdeps.begin(); - dep2 != depdeps.end(); ++dep2) - if (!result.contains(*dep2)) - result += *dep2; - } - } - } - - recursion = false; - } - - return result; -} - void QInstaller::compressDirectory(const QStringList &paths, const QString &archivePath) { foreach (const QString &path, paths) { -- cgit v1.2.3