author | tille <tille> | 2002-07-24 11:49:21 (UTC) |
---|---|---|
committer | tille <tille> | 2002-07-24 11:49:21 (UTC) |
commit | 919228ff6aeb72b6d2585ae108e86d27d0b6bdb1 (patch) (unidiff) | |
tree | 329dae48711cda4d05b0e7c02ae3a329b80606ff | |
parent | adfb21cd5e2fcf750543570ab9c6427f1fba9968 (diff) | |
download | opie-919228ff6aeb72b6d2585ae108e86d27d0b6bdb1.zip opie-919228ff6aeb72b6d2585ae108e86d27d0b6bdb1.tar.gz opie-919228ff6aeb72b6d2585ae108e86d27d0b6bdb1.tar.bz2 |
hopeing to fix bug #119
-rw-r--r-- | noncore/unsupported/oipkg/pmipkg.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/unsupported/oipkg/pmipkg.cpp b/noncore/unsupported/oipkg/pmipkg.cpp index 11c0f97..7682d49 100644 --- a/noncore/unsupported/oipkg/pmipkg.cpp +++ b/noncore/unsupported/oipkg/pmipkg.cpp | |||
@@ -121,97 +121,97 @@ void PmIpkg::makeLinks(Package *pack) | |||
121 | 121 | ||
122 | QStringList* PmIpkg::getList( QString packFileName, QString d ) | 122 | QStringList* PmIpkg::getList( QString packFileName, QString d ) |
123 | { | 123 | { |
124 | QString dest = settings->getDestinationUrlByName( d ); | 124 | QString dest = settings->getDestinationUrlByName( d ); |
125 | dest = dest==""?d:dest; | 125 | dest = dest==""?d:dest; |
126 | // if (dest == "/" ) return 0; | 126 | // if (dest == "/" ) return 0; |
127 | { | 127 | { |
128 | Config cfg( "oipkg", Config::User ); | 128 | Config cfg( "oipkg", Config::User ); |
129 | cfg.setGroup( "Common" ); | 129 | cfg.setGroup( "Common" ); |
130 | QString statusDir = cfg.readEntry( "statusDir", "" ); | 130 | QString statusDir = cfg.readEntry( "statusDir", "" ); |
131 | } | 131 | } |
132 | QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list"; | 132 | QString packFileDir = dest+"/"+statusDir+"/info/"+packFileName+".list"; |
133 | QFile f( packFileDir ); | 133 | QFile f( packFileDir ); |
134 | qDebug("Try to open %s", packFileDir.latin1()); | 134 | qDebug("Try to open %s", packFileDir.latin1()); |
135 | if ( ! f.open(IO_ReadOnly) ) | 135 | if ( ! f.open(IO_ReadOnly) ) |
136 | { | 136 | { |
137 | out( "Could not open:\n"+packFileDir ); | 137 | out( "Could not open:\n"+packFileDir ); |
138 | f.close(); | 138 | f.close(); |
139 | packFileDir = "/"+statusDir+"/info/"+packFileName+".list"; | 139 | packFileDir = "/"+statusDir+"/info/"+packFileName+".list"; |
140 | f.setName( packFileDir ); | 140 | f.setName( packFileDir ); |
141 | qDebug("Try to open %s", packFileDir.latin1()); | 141 | qDebug("Try to open %s", packFileDir.latin1()); |
142 | if ( ! f.open(IO_ReadOnly) ) | 142 | if ( ! f.open(IO_ReadOnly) ) |
143 | { | 143 | { |
144 | qDebug(" Panik! Could not open"+packFileDir); | 144 | qDebug(" Panik! Could not open"+packFileDir); |
145 | out( "Could not open:\n"+packFileDir+"\n Panik!" ); | 145 | out( "Could not open:\n"+packFileDir+"\n Panik!" ); |
146 | return (QStringList*)0; | 146 | return (QStringList*)0; |
147 | } | 147 | } |
148 | } | 148 | } |
149 | QStringList *fileList = new QStringList(); | 149 | QStringList *fileList = new QStringList(); |
150 | QTextStream t( &f ); | 150 | QTextStream t( &f ); |
151 | while ( !t.eof() ) | 151 | while ( !t.eof() ) |
152 | { | 152 | { |
153 | *fileList += t.readLine(); | 153 | *fileList += t.readLine(); |
154 | } | 154 | } |
155 | f.close(); | 155 | f.close(); |
156 | return fileList; | 156 | return fileList; |
157 | } | 157 | } |
158 | 158 | ||
159 | void PmIpkg::linkPackage( QString packFileName, QString dest ) | 159 | void PmIpkg::linkPackage( QString packFileName, QString dest ) |
160 | { | 160 | { |
161 | if (dest == "root" || dest == "/" ) return; | 161 | if (dest == "root" || dest == "/" ) return; |
162 | QStringList *fileList = getList( packFileName, dest ); | 162 | QStringList *fileList = getList( packFileName, dest ); |
163 | processFileList( fileList, dest ); | 163 | processFileList( fileList, dest ); |
164 | delete fileList; | 164 | delete fileList; |
165 | } | 165 | } |
166 | 166 | ||
167 | void PmIpkg::processFileList( QStringList *fileList, QString d ) | 167 | void PmIpkg::processFileList( QStringList *fileList, QString d ) |
168 | { | 168 | { |
169 | if (!fileList) return; | 169 | if (!fileList || fileList->isEmpty()) return; |
170 | for (uint i=0; i < fileList->count(); i++) | 170 | for (uint i=0; i < fileList->count(); i++) |
171 | { | 171 | { |
172 | QString dest = settings->getDestinationUrlByName( d ); | 172 | QString dest = settings->getDestinationUrlByName( d ); |
173 | dest = dest==""?d:dest; | 173 | dest = dest==""?d:dest; |
174 | processLinkDir( (*fileList)[i], dest ); | 174 | processLinkDir( (*fileList)[i], dest ); |
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | 178 | ||
179 | void PmIpkg::processLinkDir( QString file, QString dest ) | 179 | void PmIpkg::processLinkDir( QString file, QString dest ) |
180 | { | 180 | { |
181 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); | 181 | pvDebug( 4,"PmIpkg::processLinkDir "+file+" to "+ dest); |
182 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); | 182 | if (linkOpp==createLink) pvDebug( 4,"opp: createLink"); |
183 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); | 183 | if (linkOpp==removeLink) pvDebug( 4,"opp: removeLink"); |
184 | if ( dest == "???" || dest == "" ) return; | 184 | if ( dest == "???" || dest == "" ) return; |
185 | QString destFile = file; | 185 | QString destFile = file; |
186 | file = dest+"/"+file; | 186 | file = dest+"/"+file; |
187 | if (file == dest) return; | 187 | if (file == dest) return; |
188 | // if (linkOpp==createLink) out( "\ncreating links\n" ); | 188 | // if (linkOpp==createLink) out( "\ncreating links\n" ); |
189 | // if (linkOpp==removeLink) out( "\nremoving links\n" ); | 189 | // if (linkOpp==removeLink) out( "\nremoving links\n" ); |
190 | QFileInfo fileInfo( file ); | 190 | QFileInfo fileInfo( file ); |
191 | if ( fileInfo.isDir() ) | 191 | if ( fileInfo.isDir() ) |
192 | { | 192 | { |
193 | pvDebug(4, "process dir "+file); | 193 | pvDebug(4, "process dir "+file); |
194 | QDir destDir( destFile ); | 194 | QDir destDir( destFile ); |
195 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); | 195 | if (linkOpp==createLink) destDir.mkdir( destFile, true ); |
196 | QDir d( file ); | 196 | QDir d( file ); |
197 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); | 197 | // d.setFilter( QDir::Files | QDir::Hidden | QDir::NoSymLinks ); |
198 | const QFileInfoList *list = d.entryInfoList(); | 198 | const QFileInfoList *list = d.entryInfoList(); |
199 | QFileInfoListIterator it( *list ); | 199 | QFileInfoListIterator it( *list ); |
200 | QFileInfo *fi; | 200 | QFileInfo *fi; |
201 | while ( (fi=it.current()) ) | 201 | while ( (fi=it.current()) ) |
202 | { | 202 | { |
203 | pvDebug(4, "processLinkDir "+fi->absFilePath()); | 203 | pvDebug(4, "processLinkDir "+fi->absFilePath()); |
204 | processLinkDir( fi->absFilePath(), dest ); | 204 | processLinkDir( fi->absFilePath(), dest ); |
205 | ++it; | 205 | ++it; |
206 | } | 206 | } |
207 | } else | 207 | } else |
208 | if ( fileInfo.isFile() ) | 208 | if ( fileInfo.isFile() ) |
209 | { | 209 | { |
210 | const char *instFile = strdup( (file).latin1() ); | 210 | const char *instFile = strdup( (file).latin1() ); |
211 | const char *linkFile = strdup( (destFile).latin1()); | 211 | const char *linkFile = strdup( (destFile).latin1()); |
212 | if( linkOpp==createLink ) | 212 | if( linkOpp==createLink ) |
213 | { | 213 | { |
214 | pvDebug(4, "linking: "+file+" -> "+destFile ); | 214 | pvDebug(4, "linking: "+file+" -> "+destFile ); |
215 | symlink( instFile, linkFile ); | 215 | symlink( instFile, linkFile ); |
216 | } | 216 | } |
217 | } else { | 217 | } else { |
@@ -247,97 +247,97 @@ void PmIpkg::commit() | |||
247 | int sizecount = 0; | 247 | int sizecount = 0; |
248 | installDialog = new InstallDialog(settings,0,0,true); | 248 | installDialog = new InstallDialog(settings,0,0,true); |
249 | installDialog->toRemoveItem->setOpen( true ); | 249 | installDialog->toRemoveItem->setOpen( true ); |
250 | installDialog->toInstallItem->setOpen( true ); | 250 | installDialog->toInstallItem->setOpen( true ); |
251 | for (uint i=0; i < to_remove.count(); i++) | 251 | for (uint i=0; i < to_remove.count(); i++) |
252 | { | 252 | { |
253 | sizecount += 1; | 253 | sizecount += 1; |
254 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); | 254 | installDialog->toRemoveItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_remove.at(i),settings) ); |
255 | } | 255 | } |
256 | for (uint i=0; i < to_install.count(); i++) | 256 | for (uint i=0; i < to_install.count(); i++) |
257 | { | 257 | { |
258 | sizecount += to_install.at(i)->size().toInt(); | 258 | sizecount += to_install.at(i)->size().toInt(); |
259 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); | 259 | installDialog->toInstallItem->insertItem( new PackageListItem(installDialog->ListViewPackages, to_install.at(i),settings) ); |
260 | } | 260 | } |
261 | runwindow->progress->setTotalSteps(sizecount); | 261 | runwindow->progress->setTotalSteps(sizecount); |
262 | qDebug("Install size %i",sizecount); | 262 | qDebug("Install size %i",sizecount); |
263 | installDialog->showMaximized(); | 263 | installDialog->showMaximized(); |
264 | installDialog->show(); | 264 | installDialog->show(); |
265 | if ( installDialog->exec() ) | 265 | if ( installDialog->exec() ) |
266 | { | 266 | { |
267 | doIt(); | 267 | doIt(); |
268 | runwindow->showMaximized(); | 268 | runwindow->showMaximized(); |
269 | runwindow->show(); | 269 | runwindow->show(); |
270 | } | 270 | } |
271 | installDialog->close(); | 271 | installDialog->close(); |
272 | delete installDialog; | 272 | delete installDialog; |
273 | installDialog = 0; | 273 | installDialog = 0; |
274 | out(tr("\nAll done.")); | 274 | out(tr("\nAll done.")); |
275 | } | 275 | } |
276 | 276 | ||
277 | void PmIpkg::doIt() | 277 | void PmIpkg::doIt() |
278 | { | 278 | { |
279 | runwindow->progress->setProgress(0); | 279 | runwindow->progress->setProgress(0); |
280 | show(); | 280 | show(); |
281 | remove(); | 281 | remove(); |
282 | install(); | 282 | install(); |
283 | } | 283 | } |
284 | 284 | ||
285 | 285 | ||
286 | void PmIpkg::remove() | 286 | void PmIpkg::remove() |
287 | { | 287 | { |
288 | if ( to_remove.count() == 0 ) return; | 288 | if ( to_remove.count() == 0 ) return; |
289 | 289 | ||
290 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); | 290 | out(tr("Removing")+"\n"+tr("please wait")+"\n\n"); |
291 | 291 | ||
292 | QStringList *fileList; | 292 | QStringList *fileList; |
293 | for (uint i=0; i < to_remove.count(); i++) | 293 | for (uint i=0; i < to_remove.count(); i++) |
294 | { | 294 | { |
295 | if ( to_remove.at(i)->link() )fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); | 295 | if ( to_remove.at(i)->link() ) fileList = getList( to_remove.at(i)->name(), to_remove.at(i)->dest() ); |
296 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) | 296 | if ( runIpkg("remove " + to_remove.at(i)->installName(), to_remove.at(i)->dest() )) |
297 | { | 297 | { |
298 | runwindow->progress->setProgress( 1 ); | 298 | runwindow->progress->setProgress( 1 ); |
299 | linkOpp = removeLink; | 299 | linkOpp = removeLink; |
300 | to_remove.at(i)->processed(); | 300 | to_remove.at(i)->processed(); |
301 | pvDebug(3,"link "+QString::number(i)); | 301 | pvDebug(3,"link "+QString::number(i)); |
302 | if ( to_remove.at(i)->link() ) | 302 | if ( to_remove.at(i)->link() ) |
303 | processFileList( fileList, to_remove.at(i)->dest() ); | 303 | processFileList( fileList, to_remove.at(i)->dest() ); |
304 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); | 304 | //pvDebug(3,"take "+QString::number(i)+" of "+QString::number(to_remove.count())); |
305 | //if ( to_remove.at(i) ) to_remove.take( i ); | 305 | //if ( to_remove.at(i) ) to_remove.take( i ); |
306 | 306 | ||
307 | out("\n"); | 307 | out("\n"); |
308 | }else{ | 308 | }else{ |
309 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); | 309 | out(tr("Error while removing ")+to_remove.at(i)->name()+"\n"); |
310 | if ( to_remove.at(i)->link() ) | 310 | if ( to_remove.at(i)->link() ) |
311 | processFileList( fileList, to_remove.at(i)->dest() ); | 311 | processFileList( fileList, to_remove.at(i)->dest() ); |
312 | } | 312 | } |
313 | if ( to_remove.at(i)->link() ) | 313 | if ( to_remove.at(i)->link() ) |
314 | processFileList( fileList, to_remove.at(i)->dest() ); | 314 | processFileList( fileList, to_remove.at(i)->dest() ); |
315 | if ( to_remove.at(i)->link() )delete fileList; | 315 | if ( to_remove.at(i)->link() )delete fileList; |
316 | } | 316 | } |
317 | to_remove.clear(); | 317 | to_remove.clear(); |
318 | out("\n"); | 318 | out("\n"); |
319 | } | 319 | } |
320 | 320 | ||
321 | 321 | ||
322 | void PmIpkg::install() | 322 | void PmIpkg::install() |
323 | { | 323 | { |
324 | if ( to_install.count() == 0 ) return; | 324 | if ( to_install.count() == 0 ) return; |
325 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); | 325 | out(tr("Installing")+"\n"+tr("please wait")+"\n"); |
326 | for (uint i=0; i < to_install.count(); i++) | 326 | for (uint i=0; i < to_install.count(); i++) |
327 | { | 327 | { |
328 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug | 328 | qDebug("install loop %i of %i installing %s",i,to_install.count(),to_install.at(i)->installName().latin1()); //pvDebug |
329 | if (to_install.at(i)->link()) | 329 | if (to_install.at(i)->link()) |
330 | { | 330 | { |
331 | // hack to have package.list | 331 | // hack to have package.list |
332 | // in "dest"/usr/lib/ipkg/info/ | 332 | // in "dest"/usr/lib/ipkg/info/ |
333 | QString rds = settings->getDestinationUrlByName("root"); | 333 | QString rds = settings->getDestinationUrlByName("root"); |
334 | QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest()); | 334 | QString lds = settings->getDestinationUrlByName(to_install.at(i)->dest()); |
335 | QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list"; | 335 | QString listFile = "usr/lib/ipkg/lists/"+to_install.at(i)->name()+".list"; |
336 | rds += listFile; | 336 | rds += listFile; |
337 | lds += listFile; | 337 | lds += listFile; |
338 | const char *rd = rds.latin1(); | 338 | const char *rd = rds.latin1(); |
339 | const char *ld = lds.latin1(); | 339 | const char *ld = lds.latin1(); |
340 | pvDebug(4, "linking: "+rds+" -> "+lds ); | 340 | pvDebug(4, "linking: "+rds+" -> "+lds ); |
341 | symlink( rd, ld ); | 341 | symlink( rd, ld ); |
342 | } | 342 | } |
343 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) | 343 | if ( runIpkg("install " + to_install.at(i)->installName(), to_install.at(i)->dest() )) |