- obj.components.sort(component_sort);
-
- for(map<string, string>::const_iterator i=install_map.begin(); i!=install_map.end(); ++i)
- {
- for(ComponentList::iterator j=obj.components.begin(); j!=obj.components.end(); ++j)
- {
- const Component::SourceList &sources = j->get_sources();
- for(Component::SourceList::const_iterator k=sources.begin(); k!=sources.end(); ++k)
- {
- string k_str = k->str();
- if(!i->first.compare(0, k_str.size(), k_str))
- {
- const_cast<InstallMap &>(j->get_install_map()).add_mapping(obj.source_dir/i->first, i->second);
- }
- }
- }
- }
+ /* Make sure the source tarball is last in the list so targets from all
+ other components wil be created first */
+ ComponentList::iterator i = find(obj.components.begin(), obj.components.end(), obj.source_archive);
+ if(i!=obj.components.end())
+ obj.components.splice(obj.components.end(), obj.components, i);