Skip to content

Commit

Permalink
fix: improve messages when remote search order is inverted
Browse files Browse the repository at this point in the history
  • Loading branch information
Firefly35 committed Sep 27, 2021
1 parent 7f49f7d commit a5803a0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/managers/DependencyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,23 @@ void DependencyManager::retrieveDependency(Dependency & dependency)
{
fs::detail::utf8_codecvt_facet utf8;
shared_ptr<IFileRetriever> fileRetriever = FileHandlerFactory::instance()->getFileHandler(dependency, m_options);
std::string currentRepositoryType = dependency.getRepositoryType();
if (m_options.invertRepositoryOrder() && dependency.getType() == Dependency::Type::REMAKEN) {// what about cache management in this case ?
fileRetriever = FileHandlerFactory::instance()->getAlternateHandler(dependency.getType(),m_options);
if (!fileRetriever) { // no alternate repository found
BOOST_LOG_TRIVIAL(error)<<"==> No alternate repository defined for '"<<dependency.getPackageName()<<":"<<dependency.getVersion()<<"'";
throw std::runtime_error("No alternate repository defined for '" + dependency.getPackageName() +":" +dependency.getVersion() + "'");
}
dependency.changeBaseRepository(m_options.getAlternateRepoUrl());
currentRepositoryType = m_options.getAlternateRepoType();
}
std::string source = fileRetriever->computeSourcePath(dependency);
fs::path outputDirectory = fileRetriever->computeLocalDependencyRootDir(dependency);
fs::path libDirectory = fileRetriever->computeRootLibDir(dependency);
fs::path binDirectory = fileRetriever->computeRootBinDir(dependency);
if (installDep(dependency, source, outputDirectory, libDirectory, binDirectory) || m_options.force()) {
try {
std::cout<<"=> Installing "<<dependency.getRepositoryType()<<"::"<<source<<std::endl;
std::cout<<"=> Installing "<<currentRepositoryType<<"::"<<source<<std::endl;
try {
outputDirectory = fileRetriever->installArtefact(dependency);
}
Expand All @@ -200,7 +202,7 @@ void DependencyManager::retrieveDependency(Dependency & dependency)
fileRetriever = FileHandlerFactory::instance()->getFileHandler(dependency, m_options);
}
if (!fileRetriever) { // no alternate repository found
BOOST_LOG_TRIVIAL(error)<<"==> Unable to find '"<<dependency.getPackageName()<<":"<<dependency.getVersion()<<"' on "<<dependency.getRepositoryType()<<"('"<<dependency.getBaseRepository()<<"')";
BOOST_LOG_TRIVIAL(error)<<"==> Unable to find '"<<dependency.getPackageName()<<":"<<dependency.getVersion()<<"' on "<<currentRepositoryType<<"('"<<dependency.getBaseRepository()<<"')";
throw std::runtime_error(e.what());
}
else {
Expand Down

0 comments on commit a5803a0

Please sign in to comment.