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 | |||
@@ -167,43 +167,54 @@ void PackageList::updateSections( Package* pack ) | |||
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]; |