]> git.tdb.fi Git - builder.git/commitdiff
Don't put nulls into the new packages queue
authorMikko Rasa <tdb@tdb.fi>
Sun, 3 Sep 2006 19:06:28 +0000 (19:06 +0000)
committerMikko Rasa <tdb@tdb.fi>
Sun, 3 Sep 2006 19:06:28 +0000 (19:06 +0000)
Improve algorithm for checking missing packages

source/builder.cpp

index e6f036b7028f409ec0851615d068152dd1547966..b90f2c4153651628c04ffbf552c9450095931110 100644 (file)
@@ -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<std::string> missing;
        for(PackageMap::iterator i=packages.begin(); i!=packages.end(); ++i)
-       {
-               const list<PackageRef> &requires=i->second->get_requires();
-               for(list<PackageRef>::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<string>::iterator i=missing.begin(); i!=missing.end(); ++i)
                        cerr<<"  "<<*i<<'\n';