Author: lslezak Date: Mon Mar 10 14:47:04 2008 New Revision: 45330 URL: http://svn.opensuse.org/viewcvs/yast?rev=45330&view=rev Log: - check whether the alias of a new source is already in use, if yes then add a time stamp at the end (#363956) - 2.13.123 Modified: branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/VERSION branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/package/yast2-pkg-bindings.changes branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/src/Source.cc Modified: branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/VERSION?rev=45330&r1=45329&r2=45330&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/VERSION (original) +++ branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/VERSION Mon Mar 10 14:47:04 2008 @@ -1 +1 @@ -2.13.122 +2.13.123 Modified: branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/package/yast2-pkg-bindings.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/package/yast2-pkg-bindings.changes?rev=45330&r1=45329&r2=45330&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/package/yast2-pkg-bindings.changes (original) +++ branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/package/yast2-pkg-bindings.changes Mon Mar 10 14:47:04 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Mar 10 14:45:08 CET 2008 - lslezak@suse.cz + +- check whether the alias of a new source is already in use, if yes + then add a time stamp at the end (#363956) +- 2.13.123 + +------------------------------------------------------------------- Fri Feb 22 15:38:40 CET 2008 - lslezak@suse.cz - Pkg::ResolvablePreselectPatches(): Properly select patches for Modified: branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/src/Source.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/src/Source.cc?rev=45330&r1=45329&r2=45330&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/src/Source.cc (original) +++ branches/SuSE-SLE-10-SP2-Branch/pkg-bindings/src/Source.cc Mon Mar 10 14:47:04 2008 @@ -1023,7 +1023,7 @@ zypp::Url new_url; string alias = removeAlias (url_r, new_url); - y2milestone("Alias from URL: '%s'", alias.c_str()); + y2milestone("Using alias (from URL): '%s'", alias.c_str()); zypp::Source_Ref newsrc = (type.empty()) ? @@ -1031,10 +1031,40 @@ zypp::SourceFactory().createFrom(new_url, path_r, alias, zypp::filesystem::Pathname(), base_source) : // use required source type, autorefresh = true zypp::SourceFactory().createFrom(type, new_url, path_r, alias, zypp::filesystem::Pathname(), base_source, true); + + y2milestone("Alias of the new source: %s", newsrc.alias().c_str()); + + bool alias_found = false; + std::listzypp::SourceManager::SourceId ids = zypp::SourceManager::sourceManager()->allSources(); + + for( std::listzypp::SourceManager::SourceId::iterator it = ids.begin(); it != ids.end(); ++it) + { + try + { + zypp::Source_Ref src = zypp::SourceManager::sourceManager()->findSource(*it); + + if (src.alias() == newsrc.alias()) + { + alias_found = true; + break; + } + } + catch (const zypp::Exception& excpt) + { + // this should never happen + y2internal("Source ID %lu not found: %s", *it, excpt.msg().c_str()); + } + } + + if (alias_found) + { + y2milestone("Alias is already in use"); + } // if the source has empty alias use a time stamp - if (newsrc.alias().empty()) + if (newsrc.alias().empty() || alias_found) { + // use product name+edition as the alias // (URL is not enough for different sources in the same DVD drive) // alias must be unique, add timestamp @@ -1047,6 +1077,12 @@ zypp::ResObject::Ptr p = *b; alias = p->name () + '-' + p->edition ().asString () + '-'; } + + if (alias.empty()) + { + alias = newsrc.alias() + '-'; + } + alias += timestamp (); newsrc.setAlias( alias ); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org