From: Mikko Rasa Date: Sun, 3 Sep 2006 19:06:28 +0000 (+0000) Subject: Don't put nulls into the new packages queue X-Git-Tag: 0.9~64 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=93f48173c60fd6ac16b1fde9c795cd45423e87cb;p=builder.git Don't put nulls into the new packages queue Improve algorithm for checking missing packages --- diff --git a/source/builder.cpp b/source/builder.cpp index e6f036b..b90f2c4 100644 --- a/source/builder.cpp +++ b/source/builder.cpp @@ -132,7 +132,8 @@ Package *Builder::get_package(const string &n) Package *pkg=Package::create(*this, n); packages.insert(PackageMap::value_type(n, pkg)); - new_pkgs.push_back(pkg); + if(pkg) + new_pkgs.push_back(pkg); return pkg; } @@ -216,17 +217,12 @@ int Builder::main() std::list missing; for(PackageMap::iterator i=packages.begin(); i!=packages.end(); ++i) - { - const list &requires=i->second->get_requires(); - for(list::const_iterator j=requires.begin(); j!=requires.end(); ++j) - if(!j->get_package()) - missing.push_back(j->get_name()); - } + if(!i->second) + missing.push_back(i->first); if(!missing.empty()) { missing.sort(); - missing.unique(); cerr<<"The following packages were not found on the system:\n"; for(list::iterator i=missing.begin(); i!=missing.end(); ++i) cerr<<" "<<*i<<'\n';