- revision 6058
-------------------------------------------------------------------
+Wed Jul 18 14:16:59 CEST 2007 - duncan@suse.de
+
+- allow / in alias (#292628)
+
+-------------------------------------------------------------------
Tue Jul 17 15:57:03 CEST 2007 - ma@suse.de
- Fixed OnMediLocation to use safe defaults. Added setLocaltion and
repos = manager.knownRepositories();
BOOST_CHECK_EQUAL(repos.size(), (unsigned) 6);
+ RepoInfo office_dup;
+ office_dup.setAlias("office");
+ BOOST_CHECK_THROW(manager.addRepository(office_dup), RepoAlreadyExistsException);
+
// delete the office repo inside the propietary_1.repo
RepoInfo office;
office.setAlias("office");
////////////////////////////////////////////////////////////////////////////
+ /**
+ * \short Generate a related filename from a repo info
+ *
+ * From a repo info, it will try to use the alias as a filename
+ * escaping it if necessary. Other fallbacks can be added to
+ * this function in case there is no way to use the alias
+ */
+ static std::string generate_filename( const RepoInfo &info )
+ {
+ std::string fnd="/";
+ std::string rep="_";
+ std::string filename = info.alias();
+ // replace slashes with underscores
+ size_t pos = filename.find(fnd);
+ while(pos!=string::npos)
+ {
+ filename.replace(pos,fnd.length(),rep);
+ pos = filename.find(fnd,pos+rep.length());
+ }
+ filename = Pathname(filename).extend(".repo").asString();
+ MIL << "generating filename for repo [" << info.alias() << "] : '" << filename << "'" << endl;
+ return filename;
+ }
+
+
+ ////////////////////////////////////////////////////////////////////////////
+
void RepoManager::addRepository( const RepoInfo &info,
const ProgressData::ReceiverFnc & progressrcv )
{
filesystem::assert_dir(_pimpl->options.knownReposPath);
Pathname repofile = generate_non_existing_name(_pimpl->options.knownReposPath,
- Pathname(info.alias()).extend(".repo").asString());
+ generate_filename(info));
// now we have a filename that does not exists
MIL << "Saving repo in " << repofile << endl;