summaryrefslogtreecommitdiff
authorandyq <andyq>2002-10-25 14:37:28 (UTC)
committer andyq <andyq>2002-10-25 14:37:28 (UTC)
commitf4007b261a7a4dc9672a1806be50ea16ccfc84f1 (patch) (unidiff)
tree5a2469d149be879bd221a1d1f07d9cab7cab5a49
parent3421736c248c6ca7171bafdf3af9e2edf94eb593 (diff)
downloadopie-f4007b261a7a4dc9672a1806be50ea16ccfc84f1.zip
opie-f4007b261a7a4dc9672a1806be50ea16ccfc84f1.tar.gz
opie-f4007b261a7a4dc9672a1806be50ea16ccfc84f1.tar.bz2
Hopefully handles upgrading to newer packages correctly
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.cpp7
-rw-r--r--noncore/settings/aqpkg/installdlgimpl.h2
-rw-r--r--noncore/settings/aqpkg/ipkg.cpp8
-rw-r--r--noncore/settings/aqpkg/networkpkgmgr.cpp4
4 files changed, 13 insertions, 8 deletions
diff --git a/noncore/settings/aqpkg/installdlgimpl.cpp b/noncore/settings/aqpkg/installdlgimpl.cpp
index f5aef94..83f983a 100644
--- a/noncore/settings/aqpkg/installdlgimpl.cpp
+++ b/noncore/settings/aqpkg/installdlgimpl.cpp
@@ -77,33 +77,33 @@ InstallDlgImpl::InstallDlgImpl( vector<InstallData> &packageList, DataManager *d
77 QString remove = "Remove\n"; 77 QString remove = "Remove\n";
78 QString install = "\nInstall\n"; 78 QString install = "\nInstall\n";
79 QString upgrade = "\nUpgrade\n"; 79 QString upgrade = "\nUpgrade\n";
80 for ( it = packageList.begin() ; it != packageList.end() ; ++it ) 80 for ( it = packageList.begin() ; it != packageList.end() ; ++it )
81 { 81 {
82 InstallData item = *it; 82 InstallData item = *it;
83 if ( item.option == "I" ) 83 if ( item.option == "I" )
84 { 84 {
85 installList.push_back( item ); 85 installList.push_back( item );
86 install += " " + item.packageName + "\n"; 86 install += " " + item.packageName + "\n";
87 } 87 }
88 else if ( item.option == "D" ) 88 else if ( item.option == "D" )
89 { 89 {
90 removeList.push_back( item ); 90 removeList.push_back( item );
91 remove += " " + item.packageName + "\n"; 91 remove += " " + item.packageName + "\n";
92 } 92 }
93 else if ( item.option == "U" ) 93 else if ( item.option == "U" || item.option == "R" )
94 { 94 {
95 updateList.push_back( item ); 95 updateList.push_back( item );
96 upgrade += " " + item.packageName + "\n"; 96 upgrade += " " + item.packageName + "\n";
97 } 97 }
98 } 98 }
99 99
100 output->setText( remove + install + upgrade ); 100 output->setText( remove + install + upgrade );
101} 101}
102 102
103InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl ) 103InstallDlgImpl::InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget *parent, const char *name, bool modal, WFlags fl )
104 : InstallDlg( parent, name, modal, fl ) 104 : InstallDlg( parent, name, modal, fl )
105{ 105{
106 pIpkg = ipkg; 106 pIpkg = ipkg;
107 output->setText( initialText ); 107 output->setText( initialText );
108} 108}
109 109
@@ -195,35 +195,38 @@ void InstallDlgImpl :: installSelected()
195 195
196 pIpkg->setFlags( tmpFlags ); 196 pIpkg->setFlags( tmpFlags );
197 pIpkg->runIpkg(); 197 pIpkg->runIpkg();
198 } 198 }
199 199
200 pIpkg->setOption( "install" ); 200 pIpkg->setOption( "install" );
201 pIpkg->setDestination( dest ); 201 pIpkg->setDestination( dest );
202 pIpkg->setDestinationDir( destDir ); 202 pIpkg->setDestinationDir( destDir );
203 pIpkg->setFlags( instFlags ); 203 pIpkg->setFlags( instFlags );
204 for ( it = installList.begin() ; it != installList.end() ; ++it ) 204 for ( it = installList.begin() ; it != installList.end() ; ++it )
205 { 205 {
206 pIpkg->setPackage( it->packageName ); 206 pIpkg->setPackage( it->packageName );
207 pIpkg->runIpkg(); 207 pIpkg->runIpkg();
208 } 208 }
209 209
210 flags |= FORCE_REINSTALL; 210 flags |= FORCE_REINSTALL;
211 pIpkg->setOption( "reinstall" );
212 for ( it = updateList.begin() ; it != updateList.end() ; ++it ) 211 for ( it = updateList.begin() ; it != updateList.end() ; ++it )
213 { 212 {
213 if ( it->option == "R" )
214 pIpkg->setOption( "reinstall" );
215 else
216 pIpkg->setOption( "upgrade" );
214 pIpkg->setDestination( it->destination->getDestinationName() ); 217 pIpkg->setDestination( it->destination->getDestinationName() );
215 pIpkg->setDestinationDir( it->destination->getDestinationPath() ); 218 pIpkg->setDestinationDir( it->destination->getDestinationPath() );
216 pIpkg->setPackage( it->packageName ); 219 pIpkg->setPackage( it->packageName );
217 220
218 int tmpFlags = flags; 221 int tmpFlags = flags;
219 if ( it->destination->linkToRoot() && it->recreateLinks ) 222 if ( it->destination->linkToRoot() && it->recreateLinks )
220 tmpFlags |= MAKE_LINKS; 223 tmpFlags |= MAKE_LINKS;
221 pIpkg->setFlags( tmpFlags ); 224 pIpkg->setFlags( tmpFlags );
222 pIpkg->runIpkg(); 225 pIpkg->runIpkg();
223 } 226 }
224 227
225 delete pIpkg; 228 delete pIpkg;
226 } 229 }
227 230
228 btnInstall->setEnabled( true ); 231 btnInstall->setEnabled( true );
229 btnInstall->setText( tr( "Close" ) ); 232 btnInstall->setText( tr( "Close" ) );
diff --git a/noncore/settings/aqpkg/installdlgimpl.h b/noncore/settings/aqpkg/installdlgimpl.h
index 6716ced..9819b2e 100644
--- a/noncore/settings/aqpkg/installdlgimpl.h
+++ b/noncore/settings/aqpkg/installdlgimpl.h
@@ -15,33 +15,33 @@
15 * * 15 * *
16 ***************************************************************************/ 16 ***************************************************************************/
17#ifndef INSTALLDLGIMPL_H 17#ifndef INSTALLDLGIMPL_H
18#define INSTALLDLGIMPL_H 18#define INSTALLDLGIMPL_H
19 19
20#include <vector> 20#include <vector>
21using namespace std; 21using namespace std;
22 22
23#include <qstring.h> 23#include <qstring.h>
24 24
25#include "ipkg.h" 25#include "ipkg.h"
26#include "install.h" 26#include "install.h"
27 27
28class InstallData 28class InstallData
29{ 29{
30public: 30public:
31 QString option; // I - install, D - delete, U - upgrade 31 QString option; // I - install, D - delete, R- reinstall U - upgrade
32 QString packageName; 32 QString packageName;
33 Destination *destination; 33 Destination *destination;
34 bool recreateLinks; 34 bool recreateLinks;
35}; 35};
36 36
37class InstallDlgImpl : public InstallDlg 37class InstallDlgImpl : public InstallDlg
38{ 38{
39public: 39public:
40 InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); 40 InstallDlgImpl( vector<InstallData> &packageList, DataManager *dataManager, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
41 InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 ); 41 InstallDlgImpl( Ipkg *ipkg, QString initialText, QWidget * parent = 0, const char* name = 0, bool modal = false, WFlags fl = 0 );
42 ~InstallDlgImpl(); 42 ~InstallDlgImpl();
43 43
44 bool showDlg(); 44 bool showDlg();
45 bool upgradeServer( QString &server ); 45 bool upgradeServer( QString &server );
46 46
47protected: 47protected:
diff --git a/noncore/settings/aqpkg/ipkg.cpp b/noncore/settings/aqpkg/ipkg.cpp
index 368548b..731a336 100644
--- a/noncore/settings/aqpkg/ipkg.cpp
+++ b/noncore/settings/aqpkg/ipkg.cpp
@@ -50,71 +50,69 @@ Ipkg :: ~Ipkg()
50// destDir is the dir that the destination alias points to (used to link to root) 50// destDir is the dir that the destination alias points to (used to link to root)
51// flags is the ipkg options flags 51// flags is the ipkg options flags
52// dir is the directory to run ipkg in (defaults to "") 52// dir is the directory to run ipkg in (defaults to "")
53bool Ipkg :: runIpkg( ) 53bool Ipkg :: runIpkg( )
54{ 54{
55 bool ret = false; 55 bool ret = false;
56 56
57 QDir::setCurrent( "/tmp" ); 57 QDir::setCurrent( "/tmp" );
58 QString cmd = ""; 58 QString cmd = "";
59 59
60 if ( runtimeDir != "" ) 60 if ( runtimeDir != "" )
61 { 61 {
62 cmd += "cd "; 62 cmd += "cd ";
63 cmd += runtimeDir; 63 cmd += runtimeDir;
64 cmd += " ; "; 64 cmd += " ; ";
65 } 65 }
66 cmd += "ipkg"; 66 cmd += "ipkg -force-defaults";
67 67 if ( option != "update" && option != "download" )
68 if ( option != "update" && option != "download" && option != "upgrade" )
69 { 68 {
70 cmd += " -dest "+ destination; 69 cmd += " -dest "+ destination;
71 cmd += " -force-defaults";
72 70
73 if ( flags & FORCE_DEPENDS ) 71 if ( flags & FORCE_DEPENDS )
74 cmd += " -force-depends"; 72 cmd += " -force-depends";
75 if ( flags & FORCE_REINSTALL ) 73 if ( flags & FORCE_REINSTALL )
76 cmd += " -force-reinstall"; 74 cmd += " -force-reinstall";
77 if ( flags & FORCE_REMOVE ) 75 if ( flags & FORCE_REMOVE )
78 cmd += " -force-removal-of-essential-packages"; 76 cmd += " -force-removal-of-essential-packages";
79 if ( flags & FORCE_OVERWRITE ) 77 if ( flags & FORCE_OVERWRITE )
80 cmd += " -force-overwrite"; 78 cmd += " -force-overwrite";
81 79
82 // Handle make links 80 // Handle make links
83 // Rules - If make links is switched on, create links to root 81 // Rules - If make links is switched on, create links to root
84 // if destDir is NOT / 82 // if destDir is NOT /
85 if ( flags & MAKE_LINKS ) 83 if ( flags & MAKE_LINKS )
86 { 84 {
87 // If destDir == / turn off make links as package is being insalled 85 // If destDir == / turn off make links as package is being insalled
88 // to root already. 86 // to root already.
89 if ( destDir == "/" ) 87 if ( destDir == "/" )
90 flags ^= MAKE_LINKS; 88 flags ^= MAKE_LINKS;
91 } 89 }
92 } 90 }
93 91
94#ifdef X86 92#ifdef X86
95 cmd += " -f "; 93 cmd += " -f ";
96 cmd += IPKG_CONF; 94 cmd += IPKG_CONF;
97#endif 95#endif
98 96
99 97
100 if ( option == "reinstall" ) 98 if ( option == "reinstall" )
101 cmd += " install"; 99 cmd += " install";
102 else 100 else
103 cmd += " " + option; 101 cmd += " " + option;
104 if ( option != "upgrade" ) 102 if ( package != "" )
105 cmd += " " + package; 103 cmd += " " + package;
106 cmd += " 2>&1"; 104 cmd += " 2>&1";
107 105
108 106
109 if ( package != "" ) 107 if ( package != "" )
110 emit outputText( QString( "Dealing with package " ) + package ); 108 emit outputText( QString( "Dealing with package " ) + package );
111 109
112 qApp->processEvents(); 110 qApp->processEvents();
113 111
114 // If we are removing packages and make links option is selected 112 // If we are removing packages and make links option is selected
115 // create the links 113 // create the links
116 if ( option == "remove" || option == "reinstall" ) 114 if ( option == "remove" || option == "reinstall" )
117 { 115 {
118 createLinks = false; 116 createLinks = false;
119 if ( flags & MAKE_LINKS ) 117 if ( flags & MAKE_LINKS )
120 { 118 {
diff --git a/noncore/settings/aqpkg/networkpkgmgr.cpp b/noncore/settings/aqpkg/networkpkgmgr.cpp
index a374266..3971aea 100644
--- a/noncore/settings/aqpkg/networkpkgmgr.cpp
+++ b/noncore/settings/aqpkg/networkpkgmgr.cpp
@@ -546,33 +546,37 @@ InstallData NetworkPackageManager :: dealWithItem( QCheckListItem *item )
546 item.option = "D"; 546 item.option = "D";
547 break; 547 break;
548 case 1: // Quit or Escape 548 case 1: // Quit or Escape
549 item.option = "U"; 549 item.option = "U";
550 break; 550 break;
551 } 551 }
552 } 552 }
553 else 553 else
554 { 554 {
555// item.option = stickyOption; 555// item.option = stickyOption;
556 } 556 }
557 557
558 // Check if we are reinstalling the same version 558 // Check if we are reinstalling the same version
559 if ( p->getVersion() != p->getInstalledVersion() ) 559 if ( p->getVersion() != p->getInstalledVersion() )
560 item.recreateLinks = true; 560 item.recreateLinks = true;
561 else 561 else
562 {
563 if ( item.option == "U" )
564 item.option = "R";
562 item.recreateLinks = false; 565 item.recreateLinks = false;
566 }
563 567
564 // User hit cancel (on dlg - assume remove) 568 // User hit cancel (on dlg - assume remove)
565 return item; 569 return item;
566 } 570 }
567} 571}
568 572
569void NetworkPackageManager :: displayText( const QString &t ) 573void NetworkPackageManager :: displayText( const QString &t )
570{ 574{
571 cout << t << endl; 575 cout << t << endl;
572} 576}
573 577
574 578
575void NetworkPackageManager :: letterPushed( QString t ) 579void NetworkPackageManager :: letterPushed( QString t )
576{ 580{
577 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild(); 581 QCheckListItem *top = (QCheckListItem *)packagesList->firstChild();
578 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem(); 582 QCheckListItem *start = (QCheckListItem *)packagesList->currentItem();