author | tille <tille> | 2002-07-24 11:22:45 (UTC) |
---|---|---|
committer | tille <tille> | 2002-07-24 11:22:45 (UTC) |
commit | 0948a167e4e46e6d2082809ec47be6a08a5de9d7 (patch) (unidiff) | |
tree | 31d9da85c68da2f2d4ca99a7ca3aaacce5ed72be | |
parent | 17068d35cc662a1cace883cfa98bb1f21534cb41 (diff) | |
download | opie-0948a167e4e46e6d2082809ec47be6a08a5de9d7.zip opie-0948a167e4e46e6d2082809ec47be6a08a5de9d7.tar.gz opie-0948a167e4e46e6d2082809ec47be6a08a5de9d7.tar.bz2 |
fix #136 -- parse packagelist without a nl at eof
-rw-r--r-- | noncore/unsupported/oipkg/packagelist.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/noncore/unsupported/oipkg/packagelist.cpp b/noncore/unsupported/oipkg/packagelist.cpp index 844f43f..998dae9 100644 --- a/noncore/unsupported/oipkg/packagelist.cpp +++ b/noncore/unsupported/oipkg/packagelist.cpp | |||
@@ -155,67 +155,78 @@ void PackageList::updateSections( Package* pack ) | |||
155 | sections += s; | 155 | sections += s; |
156 | QString ss = pack->subSection(); | 156 | QString ss = pack->subSection(); |
157 | if ( ss.isEmpty() || ss == "" ) return; | 157 | if ( ss.isEmpty() || ss == "" ) return; |
158 | if ( !subSections[s] ) { | 158 | if ( !subSections[s] ) { |
159 | subSections.insert( s, new QStringList() ); | 159 | subSections.insert( s, new QStringList() ); |
160 | QStringList *subsecs = subSections[s]; | 160 | QStringList *subsecs = subSections[s]; |
161 | *subsecs += "All"; | 161 | *subsecs += "All"; |
162 | } | 162 | } |
163 | QStringList *subsecs = subSections[s]; | 163 | QStringList *subsecs = subSections[s]; |
164 | *subsecs += ss; | 164 | *subsecs += ss; |
165 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); | 165 | if ( !subSections["All"] ) subSections.insert( "All", new QStringList() ); |
166 | subsecs = subSections["All"]; | 166 | subsecs = subSections["All"]; |
167 | *subsecs += ss; | 167 | *subsecs += ss; |
168 | } | 168 | } |
169 | 169 | ||
170 | 170 | ||
171 | void PackageList::readFileEntries( QString filename, QString dest ) | 171 | void PackageList::readFileEntries( QString filename, QString dest ) |
172 | { | 172 | { |
173 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); | 173 | pvDebug(5,"PackageList::readFileEntries "+filename+" dest "+dest); |
174 | QStringList packEntry; | 174 | QStringList packEntry; |
175 | QFile f( filename ); | 175 | QFile f( filename ); |
176 | if ( !f.open(IO_ReadOnly) ) return; | 176 | if ( !f.open(IO_ReadOnly) ) return; |
177 | QTextStream *statusStream = new QTextStream( &f ); | 177 | QTextStream *statusStream = new QTextStream( &f ); |
178 | while ( !statusStream ->eof() ) | 178 | while ( !statusStream ->eof() ) |
179 | { | 179 | { |
180 | QString line = statusStream->readLine(); | 180 | QString line = statusStream->readLine(); |
181 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) | 181 | if ( line.find(QRegExp("[\n\t ]*")) || line == "" ) |
182 | { | 182 | { |
183 | //end of package | 183 | //end of package |
184 | if ( ! packEntry.isEmpty() ) | 184 | if ( ! packEntry.isEmpty() ) |
185 | { | 185 | { |
186 | Package *p = new Package( packEntry, settings ); | 186 | Package *p = new Package( packEntry, settings ); |
187 | if ( p ) | 187 | if ( p ) |
188 | { | 188 | { |
189 | p->setDest( dest ); | 189 | p->setDest( dest ); |
190 | insertPackage( p ); | 190 | insertPackage( p ); |
191 | packEntry.clear(); | 191 | packEntry.clear(); |
192 | } | 192 | } |
193 | } | 193 | } |
194 | }else{ | 194 | }else{ |
195 | packEntry << line; | 195 | packEntry << line; |
196 | }; | 196 | }; |
197 | } | 197 | } |
198 | //there might be no nl at the end of the package file | ||
199 | if ( ! packEntry.isEmpty() ) | ||
200 | { | ||
201 | Package *p = new Package( packEntry, settings ); | ||
202 | if ( p ) | ||
203 | { | ||
204 | p->setDest( dest ); | ||
205 | insertPackage( p ); | ||
206 | packEntry.clear(); | ||
207 | } | ||
208 | } | ||
198 | delete statusStream; | 209 | delete statusStream; |
199 | return; | 210 | return; |
200 | } | 211 | } |
201 | 212 | ||
202 | void PackageList::setSettings( PackageManagerSettings *s ) | 213 | void PackageList::setSettings( PackageManagerSettings *s ) |
203 | { | 214 | { |
204 | settings = s; | 215 | settings = s; |
205 | } | 216 | } |
206 | 217 | ||
207 | Package* PackageList::getByName( QString n ) | 218 | Package* PackageList::getByName( QString n ) |
208 | { | 219 | { |
209 | return origPackageList[n]; | 220 | return origPackageList[n]; |
210 | } | 221 | } |
211 | 222 | ||
212 | void PackageList::clear() | 223 | void PackageList::clear() |
213 | { | 224 | { |
214 | origPackageList.clear(); | 225 | origPackageList.clear(); |
215 | packageList.clear(); | 226 | packageList.clear(); |
216 | } | 227 | } |
217 | 228 | ||
218 | void PackageList::allPackages() | 229 | void PackageList::allPackages() |
219 | { | 230 | { |
220 | packageList.clear(); | 231 | packageList.clear(); |
221 | QDictIterator<Package> filterIter( origPackageList ); | 232 | QDictIterator<Package> filterIter( origPackageList ); |