[yast-commit] r62639 - in /trunk/packager: VERSION package/yast2-packager.changes src/clients/repositories.ycp src/include/repositories_include.ycp
Author: lslezak Date: Fri Oct 15 10:52:37 2010 New Revision: 62639 URL: http://svn.opensuse.org/viewcvs/yast?rev=62639&view=rev Log: - don't change repository alias (ABC -> ABC_1) when changing repository URL, keep the original alias (bnc#557556) - 2.20.5 Modified: trunk/packager/VERSION trunk/packager/package/yast2-packager.changes trunk/packager/src/clients/repositories.ycp trunk/packager/src/include/repositories_include.ycp Modified: trunk/packager/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/VERSION?rev=62639&r1=62638&r2=62639&view=diff ============================================================================== --- trunk/packager/VERSION (original) +++ trunk/packager/VERSION Fri Oct 15 10:52:37 2010 @@ -1 +1 @@ -2.20.4 +2.20.5 Modified: trunk/packager/package/yast2-packager.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.changes?rev=62639&r1=62638&r2=62639&view=diff ============================================================================== --- trunk/packager/package/yast2-packager.changes (original) +++ trunk/packager/package/yast2-packager.changes Fri Oct 15 10:52:37 2010 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri Oct 15 08:43:42 UTC 2010 - lslezak@suse.cz + +- don't change repository alias (ABC -> ABC_1) when changing + repository URL, keep the original alias (bnc#557556) +- 2.20.5 + +------------------------------------------------------------------- Thu Oct 14 13:06:14 UTC 2010 - lslezak@suse.cz - offer also Ignore/Retry when a patch script fails during system Modified: trunk/packager/src/clients/repositories.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/clients/repositories.ycp?rev=62639&r1=62638&r2=62639&view=diff ============================================================================== --- trunk/packager/src/clients/repositories.ycp (original) +++ trunk/packager/src/clients/repositories.ycp Fri Oct 15 10:52:37 2010 @@ -1008,7 +1008,12 @@ { y2milestone ("URL or plaindir flag changed, recreating the source"); // copy the refresh flag - createResult = createSource( url, SourceDialogs::IsPlainDir(), sourceState["do_refresh"]:false, SourceDialogs::GetRepoName ()); + + // get current alias + string alias = generalData["alias"]:"alias"; + y2milestone("Reusing alias: %1", alias); + + createResult = createSourceWithAlias( url, SourceDialogs::IsPlainDir(), sourceState["do_refresh"]:false, SourceDialogs::GetRepoName (), alias); if ( createResult == `ok ) { // restore the origonal properties (enabled, autorefresh, keeppackages) // the added repository is at the end of the list Modified: trunk/packager/src/include/repositories_include.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/include/repositories_include.ycp?rev=62639&r1=62638&r2=62639&view=diff ============================================================================== --- trunk/packager/src/include/repositories_include.ycp (original) +++ trunk/packager/src/include/repositories_include.ycp Fri Oct 15 10:52:37 2010 @@ -41,7 +41,7 @@ return ret; } - define symbol createSourceImpl(string url, boolean plaindir, boolean download, string preffered_name) + define symbol createSourceImpl(string url, boolean plaindir, boolean download, string preffered_name, string force_alias) { y2milestone("createSource: %1, plaindir: %2, download: %3, name: %4", URL::HidePassword(url), plaindir, download, preffered_name); @@ -219,26 +219,34 @@ } } - string alias = name; - // replace " " -> "_" (avoid spaces in .repo file name) - alias = mergestring(splitstring(alias, " "), "_"); - string alias_orig = alias; + string alias = ""; - // all current aliases - list<string> aliases = maplist(integer i, Pkg::SourceGetCurrent(false), + if (force_alias == "") + { + // replace " " -> "_" (avoid spaces in .repo file name) + alias = mergestring(splitstring(name, " "), "_"); + string alias_orig = alias; + + // all current aliases + list<string> aliases = maplist(integer i, Pkg::SourceGetCurrent(false), + { + map info = Pkg::SourceGeneralData(i); + return info["alias"]:""; + } + ); + + // repository alias must be unique + // if it already exists add "_<number>" suffix to it + integer idx = 1; + while (contains(aliases, alias)) { - map info = Pkg::SourceGeneralData(i); - return info["alias"]:""; + alias = sformat("%1_%2", alias_orig, idx); + idx = idx + 1; } - ); - - // repository alias must be unique - // if it already exists add "_<number>" suffix to it - integer idx = 1; - while (contains(aliases, alias)) + } + else { - alias = sformat("%1_%2", alias_orig, idx); - idx = idx + 1; + alias = force_alias; } // map with repository parameters: $[ "enabled" : boolean, @@ -254,6 +262,12 @@ repo_prop["base_urls"] = [ url ]; repo_prop["type"] = repo_type; + if (force_alias != "") + { + // don't check uniqueness of the alias, force the alias + repo_prop["check_alias"] = false; + } + Progress::NextStage(); integer new_repo_id = Pkg::RepositoryAdd(repo_prop); @@ -345,7 +359,17 @@ symbol createSource(string url, boolean plaindir, boolean download, string preffered_name) { Wizard::CreateDialog(); - symbol ret = createSourceImpl(url, plaindir, download, preffered_name); + symbol ret = createSourceImpl(url, plaindir, download, preffered_name, ""); + Wizard::CloseDialog(); + return ret; +} + +// create source with alias +// *IMPORTANT*: make sure the alias is unique!! Otherwise the repo will be overwritten!! +symbol createSourceWithAlias(string url, boolean plaindir, boolean download, string preffered_name, string alias) +{ + Wizard::CreateDialog(); + symbol ret = createSourceImpl(url, plaindir, download, preffered_name, alias); Wizard::CloseDialog(); return ret; } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
lslezak@svn2.opensuse.org