Update of /cvsroot/kde-cygwin/tools/installer/console
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8626/installer/console
Modified Files:
main.cpp
Log Message:
version 0.5.2
Index: main.cpp
===================================================================
RCS file: /cvsroot/kde-cygwin/tools/installer/console/main.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- main.cpp 22 Jan 2006 18:40:04 -0000 1.1
+++ main.cpp 22 Jan 2006 18:42:14 -0000 1.2
@@ -27,43 +27,14 @@
#include "downloader.h"
#include "installer.h"
-// this functions will go into class PackageList
-QStringList filterPackageFiles(const QStringList &list,const QString &mode)
-{
- QStringList result;
- for (int j = 0; j < list.size(); ++j) {
- QUrl url(list.at(j));
- QFileInfo fileInfo(url.path());
- QString fileName = fileInfo.fileName();
-
- // only download package not already downloaded and only bin and lib packages
- if (mode == "URL" && QFile::exists(fileName))
- qDebug() << fileName << " - already downloaded";
- else if(fileName.contains("src") )
- qDebug() << fileName << " - ignored";
- else {
- if (mode == "URL")
- qDebug() << fileName << " - downloading";
- else
- qDebug() << fileName << " - installing";
- if (mode == "URL")
- result << list.at(j);
- else
- result << fileName;
- }
- }
- return result;
-}
-
-
-
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
- PackageList packageList;
- Installer installer(&packageList);
Downloader downloader(/*blocking=*/ true);
+ PackageList packageList(&downloader);
+ Installer installer(&packageList);
+ installer.setRoot("packages");
if (!QFile::exists("packages.txt")) {
// download package list
@@ -89,10 +60,7 @@
return 1;
if ( !QFile::exists("bin\\unzip.exe") ) {
- QStringList files = packageList.getFilesForDownload("unzip");
- files = filterPackageFiles(files,"URL");
- for (int j = 0; j < files.size(); ++j)
- downloader.start(files.at(j));
+ packageList.downloadPackage("unzip");
}
// print list
@@ -119,19 +87,13 @@
qDebug() << "the following packages are considered for downloading: " << packages;
for (int i = 0; i < packages.size(); ++i) {
- QStringList files = packageList.getFilesForDownload(packages.at(i));
- files = filterPackageFiles(files,"URL");
- for (int j = 0; j < files.size(); ++j)
- downloader.start(files.at(j));
+ packageList.downloadPackage(packages.at(i));
}
// install packages
if ( QFile::exists("bin/unzip.exe")) {
qDebug() << "prelimary installer found, now installing";
for (int i = 0; i < packages.size(); ++i) {
- QStringList files = packageList.getFilesToInstall(packages.at(i));
- files = filterPackageFiles(files,"PATH");
- for (int j = 0; j < files.size(); ++j)
- installer.install(files.at(j),"");
+ packageList.installPackage(packages.at(i));
}
}
|