author | tille <tille> | 2002-05-26 12:55:17 (UTC) |
---|---|---|
committer | tille <tille> | 2002-05-26 12:55:17 (UTC) |
commit | 5874b68d8447fa355f5034ad0e6c06bb48638f19 (patch) (unidiff) | |
tree | c3e3e28ad4b3ee0e42a78bfd9398f62090f3e160 | |
parent | 602e52f454a3d3a5cd973f3d7957d2d96f86464e (diff) | |
download | opie-5874b68d8447fa355f5034ad0e6c06bb48638f19.zip opie-5874b68d8447fa355f5034ad0e6c06bb48638f19.tar.gz opie-5874b68d8447fa355f5034ad0e6c06bb48638f19.tar.bz2 |
fixed makelinks got version in name
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 0fa4c61..7b3fa1e 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -1,398 +1,398 @@ | |||
1 | #include "pmipkg.h" | 1 | #include "pmipkg.h" |
2 | #include "pksettings.h" | 2 | #include "pksettings.h" |
3 | #include "package.h" | 3 | #include "package.h" |
4 | #include "packagelistitem.h" | 4 | #include "packagelistitem.h" |
5 | 5 | ||
6 | #include <qpe/process.h> | 6 | #include <qpe/process.h> |
7 | #include <qpe/resource.h> | 7 | #include <qpe/resource.h> |
8 | #include <qpe/config.h> | 8 | #include <qpe/config.h> |
9 | #include <qpe/stringutil.h> | 9 | #include <qpe/stringutil.h> |
10 | #include <qpe/qpeapplication.h> | 10 | #include <qpe/qpeapplication.h> |
11 | #include <qdir.h> | 11 | #include <qdir.h> |
12 | #include <qfile.h> | 12 | #include <qfile.h> |
13 | #include <qgroupbox.h> | 13 | #include <qgroupbox.h> |
14 | #include <qmultilineedit.h> | 14 | #include <qmultilineedit.h> |
15 | #include <qstring.h> | 15 | #include <qstring.h> |
16 | #include <qcheckbox.h> | 16 | #include <qcheckbox.h> |
17 | #include <qtextstream.h> | 17 | #include <qtextstream.h> |
18 | #include <qtextview.h> | 18 | #include <qtextview.h> |
19 | 19 | ||
20 | #include <qprogressbar.h> | 20 | #include <qprogressbar.h> |
21 | #include <qpushbutton.h> | 21 | #include <qpushbutton.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | 23 | ||
24 | #include <stdlib.h> | 24 | #include <stdlib.h> |
25 | #include <unistd.h> | 25 | #include <unistd.h> |
26 | 26 | ||
27 | #include "mainwindow.h" | 27 | #include "mainwindow.h" |
28 | 28 | ||
29 | 29 | ||
30 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) | 30 | PmIpkg::PmIpkg( PackageManagerSettings* s, QWidget* p, const char * name, WFlags f ) |
31 | : QObject ( p ) | 31 | : QObject ( p ) |
32 | { | 32 | { |
33 | settings = s; | 33 | settings = s; |
34 | runwindow = new RunWindow( p, name, true, f ); | 34 | runwindow = new RunWindow( p, name, true, f ); |
35 | } | 35 | } |
36 | 36 | ||
37 | PmIpkg::~PmIpkg() | 37 | PmIpkg::~PmIpkg() |
38 | { | 38 | { |
39 | } | 39 | } |
40 | 40 | ||
41 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) | 41 | bool PmIpkg::runIpkg(const QString& args, const QString& dest ) |
42 | { | 42 | { |
43 | bool ret=false; | 43 | bool ret=false; |
44 | QDir::setCurrent("/tmp"); | 44 | QDir::setCurrent("/tmp"); |
45 | QString cmd = "/usr/bin/ipkg "; | 45 | QString cmd = "/usr/bin/ipkg "; |
46 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); | 46 | pvDebug( 3,"PmIpkg::runIpkg got dest="+dest); |
47 | if ( dest == "" ) | 47 | if ( dest == "" ) |
48 | cmd += " -dest "+settings->getDestinationName(); | 48 | cmd += " -dest "+settings->getDestinationName(); |
49 | else | 49 | else |
50 | cmd += " -dest "+ dest; | 50 | cmd += " -dest "+ dest; |
51 | 51 | ||
52 | cmd += " -force-defaults "; | 52 | cmd += " -force-defaults "; |
53 | 53 | ||
54 | if (installDialog && installDialog->_force_depends) | 54 | if (installDialog && installDialog->_force_depends) |
55 | { | 55 | { |
56 | if (installDialog->_force_depends->isChecked()) | 56 | if (installDialog->_force_depends->isChecked()) |
57 | cmd += " -force-depends "; | 57 | cmd += " -force-depends "; |
58 | if (installDialog->_force_reinstall->isChecked()) | 58 | if (installDialog->_force_reinstall->isChecked()) |
59 | cmd += " -force-reinstall "; | 59 | cmd += " -force-reinstall "; |
60 | if (installDialog->_force_remove->isChecked()) | 60 | if (installDialog->_force_remove->isChecked()) |
61 | cmd += " -force-removal-of-essential-packages "; | 61 | cmd += " -force-removal-of-essential-packages "; |
62 | } | 62 | } |
63 | 63 | ||
64 | out( "Starting to "+ args+"\n"); | 64 | out( "Starting to "+ args+"\n"); |
65 | cmd += args; | 65 | cmd += args; |
66 | out( "running:\n"+cmd+"\n" ); | 66 | out( "running:\n"+cmd+"\n" ); |
67 | pvDebug(2,"running:"+cmd); | 67 | pvDebug(2,"running:"+cmd); |
68 | qApp->processEvents(); | 68 | qApp->processEvents(); |
69 | FILE *fp; | 69 | FILE *fp; |
70 | char line[130]; | 70 | char line[130]; |
71 | QString lineStr, lineStrOld; | 71 | QString lineStr, lineStrOld; |
72 | sleep(1); | 72 | sleep(1); |
73 | cmd +=" 2>&1"; | 73 | cmd +=" 2>&1"; |
74 | fp = popen( (const char *) cmd, "r"); | 74 | fp = popen( (const char *) cmd, "r"); |
75 | if ( !fp ) { | 75 | if ( !fp ) { |
76 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); | 76 | qDebug("Could not execute '" + cmd + "'! err=%d", fp); |
77 | pclose(fp); | 77 | pclose(fp); |
78 | out("\nError while executing "+ cmd+"\n\n"); | 78 | out("\nError while executing "+ cmd+"\n\n"); |
79 | return false; | 79 | return false; |
80 | } else { | 80 | } else { |
81 | while ( fgets( line, sizeof line, fp)) { | 81 | while ( fgets( line, sizeof line, fp)) { |
82 | lineStr = line; | 82 | lineStr = line; |
83 | lineStr=lineStr.left(lineStr.length()-1); | 83 | lineStr=lineStr.left(lineStr.length()-1); |
84 | //Configuring opie-oipkg...Done | 84 | //Configuring opie-oipkg...Done |
85 | if (lineStr.contains("Done")) | 85 | if (lineStr.contains("Done")) |
86 | ret = true; | 86 | ret = true; |
87 | if (lineStr!=lineStrOld) | 87 | if (lineStr!=lineStrOld) |
88 | out(lineStr); | 88 | out(lineStr); |
89 | lineStrOld = lineStr; | 89 | lineStrOld = lineStr; |
90 | qApp->processEvents(); | 90 | qApp->processEvents(); |
91 | } | 91 | } |
92 | pclose(fp); | 92 | pclose(fp); |
93 | } | 93 | } |
94 | //out( "Finished!"); | 94 | //out( "Finished!"); |
95 | pvDebug(2,QString(ret?"success\n":"failure\n")); | 95 | pvDebug(2,QString(ret?"success\n":"failure\n")); |
96 | return ret; | 96 | return ret; |
97 | } | 97 | } |
98 | 98 | ||
99 | void PmIpkg::makeLinks(Package *pack) | 99 | void PmIpkg::makeLinks(Package *pack) |
100 | { | 100 | { |
101 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); | 101 | pvDebug( 2, "PmIpkg::makeLinks "+ pack->name()); |
102 | linkPackage( pack->name(), pack->dest() ); | 102 | linkPackage( pack->installName(), pack->dest() ); |
103 | } | 103 | } |
104 | 104 | ||
105 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 105 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
106 | { | 106 | { |
107 | QString dest = settings->getDestinationUrlByName( d ); | 107 | QString dest = settings->getDestinationUrlByName( d ); |
108 | dest = dest==""?d:dest; | 108 | dest = dest==""?d:dest; |
109 | if (dest == "/" ) return 0; | 109 | if (dest == "/" ) return 0; |
110 | { | 110 | { |
111 | Config cfg( "oipkg", Config::User ); | 111 | Config cfg( "oipkg", Config::User ); |
112 | cfg.setGroup( "Common" ); | 112 | cfg.setGroup( "Common" ); |
113 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 113 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
114 | } | 114 | } |
115 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 115 | packFileName = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
116 | QFile f( packFileName ); | 116 | QFile f( packFileName ); |
117 | if ( ! f.open(IO_ReadOnly) ) | 117 | if ( ! f.open(IO_ReadOnly) ) |
118 | { | 118 | { |
119 | pvDebug(1," Panik! Could not open"); | 119 | pvDebug(1," Panik! Could not open"); |
120 | out( "Panik!\n Could not open:\n"+packFileName ); | 120 | out( "Panik!\n Could not open:\n"+packFileName ); |
121 | return (QStringList*)0; | 121 | return (QStringList*)0; |
122 | } | 122 | } |
123 | QStringList *fileList = new QStringList(); | 123 | QStringList *fileList = new QStringList(); |
124 | QTextStream t( &f ); | 124 | QTextStream t( &f ); |
125 | while ( !t.eof() ) | 125 | while ( !t.eof() ) |
126 | { | 126 | { |
127 | *fileList += t.readLine(); | 127 | *fileList += t.readLine(); |
128 | } | 128 | } |
129 | return fileList; | 129 | return fileList; |
130 | } | 130 | } |
131 | 131 | ||
132 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 132 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
133 | { | 133 | { |
134 | QStringList *fileList = getList( packFileName, dest ); | 134 | QStringList *fileList = getList( packFileName, dest ); |
135 | processFileList( fileList, dest ); | 135 | processFileList( fileList, dest ); |
136 | delete fileList; | 136 | delete fileList; |
137 | } | 137 | } |
138 | 138 | ||
139 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | 139 | void PmIpkg::processFileList( QStringList *fileList, QString d ) |
140 | { | 140 | { |
141 | if (!fileList) return; | 141 | if (!fileList) return; |
142 | for (uint i=0; i < fileList->count(); i++) | 142 | for (uint i=0; i < fileList->count(); i++) |
143 | { | 143 | { |
144 | QString dest = settings->getDestinationUrlByName( d ); | 144 | QString dest = settings->getDestinationUrlByName( d ); |
145 | dest = dest==""?d:dest; | 145 | dest = dest==""?d:dest; |
146 | processLinkDir( (*fileList)[i], dest ); | 146 | processLinkDir( (*fileList)[i], dest ); |
147 | } | 147 | } |
148 | } | 148 | } |
149 | 149 | ||
150 | 150 | ||
151 | void PmIpkg::processLinkDir( QString file, QString dest ) | 151 | void PmIpkg::processLinkDir( QString file, QString dest ) |
152 | { | 152 | { |
153 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); | 153 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); |
154 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); | 154 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); |
155 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); | 155 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); |
156 | if ( dest == "???" || dest == "" ) return; | 156 | if ( dest == "???" || dest == "" ) return; |
157 | QString destFile = file; | 157 | QString destFile = file; |
158 | file = dest+"/"+file; | 158 | file = dest+"/"+file; |
159 | if (file == dest) return; | 159 | if (file == dest) return; |
160 | // if (linkOpp==createLink) out( "\ncreating links\n" ); | 160 | // if (linkOpp==createLink) out( "\ncreating links\n" ); |
161 | // if (linkOpp==removeLink) out( "\nremoving links\n" ); | 161 | // if (linkOpp==removeLink) out( "\nremoving links\n" ); |
162 | QFileInfo fileInfo( file ); | 162 | QFileInfo fileInfo( file ); |
163 | if ( fileInfo.isDir() ) | 163 | if ( fileInfo.isDir() ) |
164 | { | 164 | { |
165 | pvDebug(4, "process dir "+file); | 165 | pvDebug(4, "process dir "+file); |
166 | QDir destDir( destFile ); | 166 | QDir destDir( destFile ); |
167 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); | 167 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
168 | QDir d( file ); | 168 | QDir d( file ); |
169 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 169 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
170 | const QFileInfoList *list = d.entryInfoList(); | 170 | const QFileInfoList *list = d.entryInfoList(); |
171 | QFileInfoListIterator it( *list ); | 171 | QFileInfoListIterator it( *list ); |
172 | QFileInfo *fi; | 172 | QFileInfo *fi; |
173 | while ( (fi=it.current()) ) | 173 | while ( (fi=it.current()) ) |
174 | { | 174 | { |
175 | pvDebug(4, "processLinkDir "+fi->absFilePath()); | 175 | pvDebug(4, "processLinkDir "+fi->absFilePath()); |
176 | processLinkDir( fi->absFilePath(), dest ); | 176 | processLinkDir( fi->absFilePath(), dest ); |
177 | ++it; | 177 | ++it; |
178 | } | 178 | } |
179 | } else | 179 | } else |
180 | if ( fileInfo.isFile() ) | 180 | if ( fileInfo.isFile() ) |
181 | { | 181 | { |
182 | const char *instFile = strdup( (file).ascii() ); | 182 | const char *instFile = strdup( (file).ascii() ); |
183 | const char *linkFile = strdup( (destFile).ascii()); | 183 | const char *linkFile = strdup( (destFile).ascii()); |
184 | if( linkOpp==createLink ) | 184 | if( linkOpp==createLink ) |
185 | { | 185 | { |
186 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 186 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
187 | symlink( instFile, linkFile ); | 187 | symlink( instFile, linkFile ); |
188 | } | 188 | } |
189 | } else { | 189 | } else { |
190 | const char *linkFile = strdup( (destFile).ascii()); | 190 | const char *linkFile = strdup( (destFile).ascii()); |
191 | if( linkOpp==removeLink ) | 191 | if( linkOpp==removeLink ) |
192 | { | 192 | { |
193 | QFileInfo toRemoveLink( destFile ); | 193 | QFileInfo toRemoveLink( destFile ); |
194 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) | 194 | if ( !QFile::exists( file ) && toRemoveLink.isSymLink() ) |
195 | { | 195 | { |
196 | pvDebug(4,"removing "+destFile+" no "+file); | 196 | pvDebug(4,"removing "+destFile+" no "+file); |
197 | unlink( linkFile ); | 197 | unlink( linkFile ); |
198 | } | 198 | } |
199 | } | 199 | } |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | void PmIpkg::loadList( PackageList *pl ) | 203 | void PmIpkg::loadList( PackageList *pl ) |
204 | { | 204 | { |
205 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) | 205 | for( Package *pack = pl->first();pack ; (pack = pl->next()) ) |
206 | { | 206 | { |
207 | if ( pack && (pack->name() != "") && pack) | 207 | if ( pack && (pack->name() != "") && pack) |
208 | { | 208 | { |
209 | if ( pack->toInstall() ) | 209 | if ( pack->toInstall() ) |
210 | to_install.append( pack ); | 210 | to_install.append( pack ); |
211 | if ( pack->toRemove() ) | 211 | if ( pack->toRemove() ) |
212 | to_remove.append( pack ); | 212 | to_remove.append( pack ); |
213 | } | 213 | } |
214 | } | 214 | } |
215 | } | 215 | } |
216 | 216 | ||
217 | void PmIpkg::commit() | 217 | void PmIpkg::commit() |
218 | { | 218 | { |
219 | int sizecount = 0; | 219 | int sizecount = 0; |
220 | installDialog = new InstallDialog(settings,0,0,true); | 220 | installDialog = new InstallDialog(settings,0,0,true); |
221 | installDialog->toRemoveItem->setOpen( true ); | 221 | installDialog->toRemoveItem->setOpen( true ); |
222 | installDialog->toInstallItem->setOpen( true ); | 222 | installDialog->toInstallItem->setOpen( true ); |
223 | for (uint i=0; i < to_remove.count(); i++) | 223 | for (uint i=0; i < to_remove.count(); i++) |
224 | { | 224 | { |
225 | sizecount += 1; | 225 | sizecount += 1; |
226 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); | 226 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); |
227 | } | 227 | } |
228 | for (uint i=0; i < to_install.count(); i++) | 228 | for (uint i=0; i < to_install.count(); i++) |
229 | { | 229 | { |
230 | sizecount += to_install.at(i)->size().toInt(); | 230 | sizecount += to_install.at(i)->size().toInt(); |
231 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); | 231 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); |
232 | } | 232 | } |
233 | runwindow->progress->setTotalSteps(sizecount); | 233 | runwindow->progress->setTotalSteps(sizecount); |
234 | qDebug("Install size %i",sizecount); | 234 | qDebug("Install size %i",sizecount); |
235 | installDialog->showMaximized(); | 235 | installDialog->showMaximized(); |
236 | installDialog->show(); | 236 | installDialog->show(); |
237 | if ( installDialog->exec() ) | 237 | if ( installDialog->exec() ) |
238 | { | 238 | { |
239 | doIt(); | 239 | doIt(); |
240 | runwindow->showMaximized(); | 240 | runwindow->showMaximized(); |
241 | runwindow->show(); | 241 | runwindow->show(); |
242 | } | 242 | } |
243 | installDialog->close(); | 243 | installDialog->close(); |
244 | delete installDialog; | 244 | delete installDialog; |
245 | out(tr("\nAll done.")); | 245 | out(tr("\nAll done.")); |
246 | } | 246 | } |
247 | 247 | ||
248 | void PmIpkg::doIt() | 248 | void PmIpkg::doIt() |
249 | { | 249 | { |
250 | runwindow->progress->setProgress(0); | 250 | runwindow->progress->setProgress(0); |
251 | show(); | 251 | show(); |
252 | remove(); | 252 | remove(); |
253 | install(); | 253 | install(); |
254 | } | 254 | } |
255 | 255 | ||
256 | 256 | ||
257 | void PmIpkg::remove() | 257 | void PmIpkg::remove() |
258 | { | 258 | { |
259 | if ( to_remove.count() == 0 ) return; | 259 | if ( to_remove.count() == 0 ) return; |
260 | 260 | ||
261 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); | 261 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); |
262 | 262 | ||
263 | QStringList *fileList; | 263 | QStringList *fileList; |
264 | for (uint i=0; i < to_remove.count(); i++) | 264 | for (uint i=0; i < to_remove.count(); i++) |
265 | { | 265 | { |
266 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); | 266 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); |
267 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) | 267 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) |
268 | { | 268 | { |
269 | runwindow->progress->setProgress( 1 ); | 269 | runwindow->progress->setProgress( 1 ); |
270 | linkOpp = removeLink; | 270 | linkOpp = removeLink; |
271 | to_remove.at(i)->processed(); | 271 | to_remove.at(i)->processed(); |
272 | pvDebug(3,"link "+QString::number(i)); | 272 | pvDebug(3,"link "+QString::number(i)); |
273 | if ( to_remove.at(i)->link() ) | 273 | if ( to_remove.at(i)->link() ) |
274 | processFileList( fileList, to_remove.at(i)->dest() ); | 274 | processFileList( fileList, to_remove.at(i)->dest() ); |
275 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); | 275 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); |
276 | //if ( to_remove.at(i) ) to_remove.take( i ); | 276 | //if ( to_remove.at(i) ) to_remove.take( i ); |
277 | 277 | ||
278 | out("\n"); | 278 | out("\n"); |
279 | }else{ | 279 | }else{ |
280 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); | 280 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); |
281 | if ( to_remove.at(i)->link() ) | 281 | if ( to_remove.at(i)->link() ) |
282 | processFileList( fileList, to_remove.at(i)->dest() ); | 282 | processFileList( fileList, to_remove.at(i)->dest() ); |
283 | } | 283 | } |
284 | if ( to_remove.at(i)->link() ) | 284 | if ( to_remove.at(i)->link() ) |
285 | processFileList( fileList, to_remove.at(i)->dest() ); | 285 | processFileList( fileList, to_remove.at(i)->dest() ); |
286 | if ( to_remove.at(i)->link() )delete fileList; | 286 | if ( to_remove.at(i)->link() )delete fileList; |
287 | } | 287 | } |
288 | to_remove.clear(); | 288 | to_remove.clear(); |
289 | out("\n"); | 289 | out("\n"); |
290 | } | 290 | } |
291 | 291 | ||
292 | 292 | ||
293 | void PmIpkg::install() | 293 | void PmIpkg::install() |
294 | { | 294 | { |
295 | if ( to_install.count() == 0 ) return; | 295 | if ( to_install.count() == 0 ) return; |
296 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); | 296 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); |
297 | for (uint i=0; i < to_install.count(); i++) | 297 | for (uint i=0; i < to_install.count(); i++) |
298 | { | 298 | { |
299 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug | 299 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug |
300 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) | 300 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) |
301 | { | 301 | { |
302 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); | 302 | runwindow->progress->setProgress( to_install.at(i)->size().toInt() + runwindow->progress->progress()); |
303 | to_install.at(i)->processed(); | 303 | to_install.at(i)->processed(); |
304 | linkOpp = createLink; | 304 | linkOpp = createLink; |
305 | if ( to_install.at(i)->link() ) | 305 | if ( to_install.at(i)->link() ) |
306 | makeLinks( to_install.at(i) ); | 306 | makeLinks( to_install.at(i) ); |
307 | // to_install.take( i ); | 307 | // to_install.take( i ); |
308 | out("\n"); | 308 | out("\n"); |
309 | }else{ | 309 | }else{ |
310 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); | 310 | out(tr("Error while installing")+to_install.at(i)->name()+"\n"); |
311 | linkOpp = createLink; | 311 | linkOpp = createLink; |
312 | if ( to_install.at(i)->link() ) | 312 | if ( to_install.at(i)->link() ) |
313 | makeLinks( to_install.at(i) ); | 313 | makeLinks( to_install.at(i) ); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | out("\n"); | 316 | out("\n"); |
317 | to_install.clear(); | 317 | to_install.clear(); |
318 | } | 318 | } |
319 | 319 | ||
320 | void PmIpkg::createLinks( const QString &dest ) | 320 | void PmIpkg::createLinks( const QString &dest ) |
321 | { | 321 | { |
322 | pvDebug(2,"PmIpkg::createLinks "+dest); | 322 | pvDebug(2,"PmIpkg::createLinks "+dest); |
323 | linkOpp=createLink; | 323 | linkOpp=createLink; |
324 | QString url = settings->getDestinationUrlByName( dest ); | 324 | QString url = settings->getDestinationUrlByName( dest ); |
325 | url = url==""?dest:url; | 325 | url = url==""?dest:url; |
326 | processLinkDir( "/opt", url ); | 326 | processLinkDir( "/opt", url ); |
327 | processLinkDir( "/usr", url ); | 327 | processLinkDir( "/usr", url ); |
328 | } | 328 | } |
329 | 329 | ||
330 | void PmIpkg::removeLinks( const QString &dest ) | 330 | void PmIpkg::removeLinks( const QString &dest ) |
331 | { | 331 | { |
332 | pvDebug(2,"PmIpkg::removeLinks "+dest); | 332 | pvDebug(2,"PmIpkg::removeLinks "+dest); |
333 | linkOpp=removeLink; | 333 | linkOpp=removeLink; |
334 | QString url = settings->getDestinationUrlByName( dest ); | 334 | QString url = settings->getDestinationUrlByName( dest ); |
335 | url = url==""?dest:url; | 335 | url = url==""?dest:url; |
336 | processLinkDir( "/opt", url ); | 336 | processLinkDir( "/opt", url ); |
337 | processLinkDir( "/usr", url ); | 337 | processLinkDir( "/usr", url ); |
338 | } | 338 | } |
339 | 339 | ||
340 | void PmIpkg::update() | 340 | void PmIpkg::update() |
341 | { | 341 | { |
342 | show(); | 342 | show(); |
343 | if ( runIpkg( "update" ) ) | 343 | if ( runIpkg( "update" ) ) |
344 | runwindow->close(); | 344 | runwindow->close(); |
345 | else out("An error occurred!\nPlease check the log."); | 345 | else out("An error occurred!\nPlease check the log."); |
346 | } | 346 | } |
347 | 347 | ||
348 | void PmIpkg::out( QString o ) | 348 | void PmIpkg::out( QString o ) |
349 | { | 349 | { |
350 | runwindow->outPut->append(o); | 350 | runwindow->outPut->append(o); |
351 | runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); | 351 | runwindow->outPut->setCursorPosition(runwindow->outPut->numLines() + 1,0,FALSE); |
352 | } | 352 | } |
353 | 353 | ||
354 | 354 | ||
355 | 355 | ||
356 | 356 | ||
357 | void PmIpkg::show() | 357 | void PmIpkg::show() |
358 | { | 358 | { |
359 | if (!runwindow->isVisible()) | 359 | if (!runwindow->isVisible()) |
360 | { | 360 | { |
361 | runwindow->showMaximized(); | 361 | runwindow->showMaximized(); |
362 | runwindow->show(); | 362 | runwindow->show(); |
363 | } | 363 | } |
364 | runwindow->outPut->setText(""); | 364 | runwindow->outPut->setText(""); |
365 | } | 365 | } |
366 | 366 | ||
367 | void PmIpkg::installFile(const QString &fileName, const QString &dest) | 367 | void PmIpkg::installFile(const QString &fileName, const QString &dest) |
368 | { | 368 | { |
369 | 369 | ||
370 | to_install.clear(); | 370 | to_install.clear(); |
371 | to_remove.clear(); | 371 | to_remove.clear(); |
372 | pvDebug( 2,"PmIpkg::installFile "+ fileName); | 372 | pvDebug( 2,"PmIpkg::installFile "+ fileName); |
373 | Package *p = new Package(fileName,settings); | 373 | Package *p = new Package(fileName,settings); |
374 | if ( dest!="") p->setDest( dest ); | 374 | if ( dest!="") p->setDest( dest ); |
375 | to_install.append( p ); | 375 | to_install.append( p ); |
376 | commit(); | 376 | commit(); |
377 | delete p; | 377 | delete p; |
378 | } | 378 | } |
379 | 379 | ||
380 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) | 380 | void PmIpkg::removeFile(const QString &fileName, const QString &dest) |
381 | { | 381 | { |
382 | 382 | ||
383 | to_install.clear(); | 383 | to_install.clear(); |
384 | to_remove.clear(); | 384 | to_remove.clear(); |
385 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); | 385 | pvDebug( 2,"PmIpkg::removeFile "+ fileName); |
386 | Package *p = new Package(fileName,settings); | 386 | Package *p = new Package(fileName,settings); |
387 | if ( dest!="") p->setDest( dest ); | 387 | if ( dest!="") p->setDest( dest ); |
388 | to_remove.append( p ); | 388 | to_remove.append( p ); |
389 | commit(); | 389 | commit(); |
390 | delete p; | 390 | delete p; |
391 | } | 391 | } |
392 | 392 | ||
393 | 393 | ||
394 | void PmIpkg::clearLists() | 394 | void PmIpkg::clearLists() |
395 | { | 395 | { |
396 | to_remove.clear(); | 396 | to_remove.clear(); |
397 | to_install.clear(); | 397 | to_install.clear(); |
398 | } | 398 | } |