4 #include <wibble/test.h>
10 #include <wibble/exception.h>
12 #include <apt-pkg/pkgcache.h>
13 #include <apt-pkg/sourcelist.h>
14 #include <apt-pkg/error.h>
15 #include <apt-pkg/policy.h>
16 #include <apt-pkg/cachefile.h>
17 #include <apt-pkg/progress.h>
18 #include <apt-pkg/pkgcachegen.h>
19 #include <apt-pkg/init.h>
28 std::string
desc()
const throw () {
33 while ( !_error->empty() ) {
35 _error->PopMessage( err );
36 std::cerr << err << std::endl;
165 if ( !_config->FindB(
"Initialized") ) {
166 pkgInitConfig(*_config);
167 _config->Set(
"Initialized", 1);
168 pkgInitSystem(*_config, _system);
176 }
catch ( std::exception e ) {
185 if ( list.ReadMainList() == false ) {
186 _error->DumpErrors();
187 throw wibble::exception::System(
188 "The list of sources could not be read." );
195 std::cerr <<
"The package lists or status file "
196 "could not be parsed or opened." << std::endl;
198 "The package lists or status file "
199 "could not be parsed or opened." );
202 m_cache =
new pkgCache( m,
true );
204 if ( ReadPinFile( *
m_policy ) ==
false )
205 throw wibble::exception::System(
"error reading pin file" );
210 if ( _config->FindB(
"Initialized") ) {
222 pkgCache::VerIterator
anyVersion( pkgCache::PkgIterator pi ) {
223 if ( pi.end() )
return pkgCache::VerIterator();
224 return pi.VersionList();
228 pkgCache::PkgIterator pi =
cache().FindPkg( p.
package() );
229 if ( pi.end() )
return Token();
230 pkgCache::VerIterator vi =
policy().GetCandidateVer( pi );
231 if ( vi.end() )
return Token();
238 if ( pi.end() )
return pkgCache::VerIterator();
239 pkgCache::VerIterator vi =
policy().GetCandidateVer( pi );
240 if ( vi.end() )
return pkgCache::VerIterator();
245 if ( pi.end() )
return pkgCache::VerIterator();
246 pkgCache::VerIterator vi = pkgCache::VerIterator(
cache(),
247 cache().VerP + pi->CurrentVer );
248 if ( vi.end() )
return pkgCache::VerIterator();
261 return pkgCache::VerIterator();
262 for (pkgCache::VerIterator vi = pi.VersionList(); !vi.end(); ++vi)
263 if ( t.
version() == vi.VerStr() )
265 return pkgCache::VerIterator();
269 pkgCache::VerIterator vi )
272 return pkgCache::VerFileIterator();
273 pkgCache::VerFileIterator vfi = vi.FileList();
274 for ( ; !vfi.end(); vfi++ )
275 if ( ( vfi.File()->Flags & pkgCache::Flag::NotSource ) == 0)
291 if ( ! ( P->CurrentState == pkgCache::State::ConfigFiles
292 || P->CurrentState == pkgCache::State::NotInstalled ) )
297 pkgDepCache::StateCache S =
state()[ P ];
300 if ( ( S.iFlags & pkgDepCache::ReInstall )
301 == pkgDepCache::ReInstall )
307 if ( ( S.iFlags & pkgDepCache::Purge ) == pkgDepCache::Purge )
311 if ( S.InstBroken() )
313 if ( P->SelectedState == pkgCache::State::Hold )
341 template<
typename Internal >
391 extern const char *
fields[];
396 typedef std::string
T;