Author: locilka Date: Wed Oct 3 17:47:40 2007 New Revision: 41242 URL: http://svn.opensuse.org/viewcvs/yast?rev=41242&view=rev Log: - During upgrade, old repositories are removed (they are already readded either enabled or disabled during the initial stage of the upgrade). - Before removing, repositories are backed up in /var/lib/YaST2/repos.d_backup directory (both #326325). Modified: trunk/packager/package/yast2-packager.changes trunk/packager/src/clients/pkg_finish.ycp Modified: trunk/packager/package/yast2-packager.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/package/yast2-packager.changes?rev=41242&r1=41241&r2=41242&view=diff ============================================================================== --- trunk/packager/package/yast2-packager.changes (original) +++ trunk/packager/package/yast2-packager.changes Wed Oct 3 17:47:40 2007 @@ -1,4 +1,13 @@ ------------------------------------------------------------------- +Wed Oct 3 17:42:05 CEST 2007 - locilka@suse.cz + +- During upgrade, old repositories are removed (they are already + readded either enabled or disabled during the initial stage + of the upgrade). +- Before removing, repositories are backed up in + /var/lib/YaST2/repos.d_backup directory (both #326325). + +------------------------------------------------------------------- Thu Sep 27 16:20:59 CEST 2007 - lslezak@suse.cz - fixed a wrong wording in the mediacheck help text (#304677) Modified: trunk/packager/src/clients/pkg_finish.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/packager/src/clients/pkg_finish.ycp?rev=41242&r1=41241&r2=41242&view=diff ============================================================================== --- trunk/packager/src/clients/pkg_finish.ycp (original) +++ trunk/packager/src/clients/pkg_finish.ycp Wed Oct 3 17:47:40 2007 @@ -17,12 +17,71 @@ textdomain "packager"; import "Installation"; +import "Mode"; +import "Stage"; import "String"; +import "FileUtils"; any ret = nil; string func = ""; map param = $[]; +// During upgrade, old sources are reinitialized +// either as enabled or disabled. +// The old sources from targed should go away. +void BackUpAllTargetSources () { + import "Directory"; + + string repos_dir = "/etc/zypp/repos.d"; + + if (! FileUtils::Exists (repos_dir)) { + y2error ("Directory %1 doesn't exist!", repos_dir); + return; + } + + list <string> current_repos = (list<string>) SCR::Read (.target.dir, repos_dir); + + if (current_repos == nil || size (current_repos) == 0) { + y2warning ("There are currently no repos in %1 conf dir", repos_dir); + return; + } else { + y2milestone ("These repos currently exist on a target: %1", current_repos); + } + + map cmd = (map) WFM::Execute (.local.bash_output, "date +%Y%m%d-%H%M%S"); + list <string> a_name_list = splitstring(cmd["stdout"]:"the_latest", "\n"); + string archive_name = "repos_" + a_name_list[0]:"" + ".tgz"; + + string shellcommand = sformat ( + "mkdir -p '%1' && cd '%1' && /bin/tar -czf '%2' '%3'", + String::Quote (Directory::vardir + "/repos.d_backup/"), + String::Quote (archive_name), + String::Quote (repos_dir) + ); + cmd = (map) SCR::Execute (.target.bash_output, shellcommand); + + if (cmd["exit"]:-1 != 0) { + y2error ("Unable to backup current repos; Command >%1< returned: %2", + shellcommand, cmd + ); + } + + boolean success = nil; + + foreach (string one_repo, current_repos, { + one_repo = repos_dir + "/" + one_repo; + y2milestone ("Removing target repository %1", one_repo); + success = (boolean) SCR::Execute (.target.remove, one_repo); + + if (success != true) { + y2error ("Cannot remove %1 file", one_repo); + } + }); + + y2milestone ("All old repositories were removed from the target"); + +} + /* Check arguments */ if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) { func = (string)WFM::Args(0); @@ -47,6 +106,11 @@ { Pkg::SourceCacheCopyTo (Installation::destdir); + // Remove (backup) all sources not used during the update + if (Stage::initial() && Mode::update()) { + BackUpAllTargetSources(); + } + // disable all repositories and finish target Pkg::SourceFinishAll (); Pkg::TargetFinish(); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org