manager.addRepositories(url);
// check it was not overwriten the proprietary.repo file
- BOOST_CHECK( PathInfo(Pathname(dir) + "/repos.d/proprietary_1.repo").isExist() );
+ BOOST_CHECK( PathInfo(tmpKnownReposPath.path() + "/proprietary.repo_1").isExist() );
// now there should be 6 repos
repos = manager.knownRepositories();
repos = manager.knownRepositories();
BOOST_CHECK_EQUAL(repos.size(), (unsigned) 5);
// the file still contained one repo, so it should still exists
- BOOST_CHECK( PathInfo(Pathname(dir) + "/repos.d/proprietary_1.repo").isExist() );
+ BOOST_CHECK( PathInfo(tmpKnownReposPath.path() + "/proprietary.repo_1").isExist() );
// now delete the macromedia one
RepoInfo macromedia;
repos = manager.knownRepositories();
BOOST_CHECK_EQUAL(repos.size(), (unsigned) 4);
// the file should not exist anymore
- BOOST_CHECK( ! PathInfo(Pathname(dir) + "/repos.d/proprietary_1.repo").isExist() );
+ BOOST_CHECK( ! PathInfo(tmpKnownReposPath.path() + "/proprietary.repo_1").isExist() );
+
+ // for now skip creation
+ return;
RepoInfo repo(repos.front());
manager.refreshMetadata(repo);
ZYPP_THROW(RepoAlreadyExistsException(info.alias()));
}
- Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath, info.alias()).extend(".repo");
+ Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath,
+ Pathname(info.alias()).extend(".repo").asString());
// now we have a filename that does not exists
MIL << "Saving repo in " << repofile << endl;
if ( filename == Pathname() )
ZYPP_THROW(RepoException("Invalid repo file name at " + url.asString() ));
- Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath, filename).extend(".repo");
+ Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath, filename);
// now we have a filename that does not exists
MIL << "Saving " << repos.size() << " repo" << ( repos.size() ? "s" : "" ) << " in " << repofile << endl;
// we have a matcing repository, now we need to know
// where it does come from.
- if (info.filepath().empty())
+ RepoInfo todelete = *it;
+ if (todelete.filepath().empty())
{
ZYPP_THROW(RepoException("Can't figure where the repo is stored"));
}
else
{
// figure how many repos are there in the file:
- std::list<RepoInfo> filerepos = repositories_in_file(info.filepath());
- if ( (filerepos.size() == 1) && ( filerepos.front().alias() == info.alias() ) )
+ std::list<RepoInfo> filerepos = repositories_in_file(todelete.filepath());
+ if ( (filerepos.size() == 1) && ( filerepos.front().alias() == todelete.alias() ) )
{
// easy, only this one, just delete the file
- if ( filesystem::unlink(info.filepath()) != 0 )
+ if ( filesystem::unlink(todelete.filepath()) != 0 )
{
- ZYPP_THROW(RepoException("Can't delete " + info.filepath().asString()));
+ ZYPP_THROW(RepoException("Can't delete " + todelete.filepath().asString()));
}
return;
}
{
// there are more repos in the same file
// write them back except the deleted one.
- TmpFile tmp;
- std::ofstream file(tmp.path().c_str());
+ //TmpFile tmp;
+ //std::ofstream file(tmp.path().c_str());
+ std::ofstream file(todelete.filepath().c_str());
if (!file) {
- ZYPP_THROW (Exception( "Can't open " + tmp.path().asString() ) );
+ //ZYPP_THROW (Exception( "Can't open " + tmp.path().asString() ) );
+ ZYPP_THROW (Exception( "Can't open " + todelete.filepath().asString() ) );
}
for ( std::list<RepoInfo>::const_iterator fit = filerepos.begin();
fit != filerepos.end();
++fit )
{
- if ( (*fit).alias() != info.alias() )
+ if ( (*fit).alias() != todelete.alias() )
(*fit).dumpRepoOn(file);
}
+
+
+
return;
}
} // else filepath is empty