On Tue, Jun 14, 2011 at 12:00:23PM -0000, [email protected] wrote: > Author: lslezak > Date: Tue Jun 14 14:00:22 2011 > New Revision: 64343 > > URL: http://svn.opensuse.org/viewcvs/yast?rev=64343&view=rev > Log: > - implemented download in advance mode support (fate#308951) > - 2.21.0 > > Modified: > trunk/wagon/ (props changed) > trunk/wagon/VERSION > trunk/wagon/package/yast2-wagon.changes > trunk/wagon/src/clients/wagon_update_proposal.ycp > trunk/wagon/src/config/cd_update.desktop (props changed) > trunk/wagon/src/modules/Wagon.ycp (contents, props changed) > trunk/wagon/yast2-wagon.spec.in > > Modified: trunk/wagon/VERSION > URL: > http://svn.opensuse.org/viewcvs/yast/trunk/wagon/VERSION?rev=64343&r1=64342&r2=64343&view=diff > ============================================================================== > --- trunk/wagon/VERSION (original) > +++ trunk/wagon/VERSION Tue Jun 14 14:00:22 2011 > @@ -1 +1 @@ > -2.20.3 > +2.21.0 > > Modified: trunk/wagon/package/yast2-wagon.changes > URL: > http://svn.opensuse.org/viewcvs/yast/trunk/wagon/package/yast2-wagon.changes?rev=64343&r1=64342&r2=64343&view=diff > ============================================================================== > --- trunk/wagon/package/yast2-wagon.changes (original) > +++ trunk/wagon/package/yast2-wagon.changes Tue Jun 14 14:00:22 2011 > @@ -1,4 +1,10 @@ > ------------------------------------------------------------------- > +Tue Jun 14 08:42:02 UTC 2011 - [email protected] > + > +- implemented download in advance mode support (fate#308951) > +- 2.21.0 > + > +------------------------------------------------------------------- > Fri Feb 18 14:22:27 CET 2011 - [email protected] > > - yast2-wagon control files have been moved to separate packages > > Modified: trunk/wagon/src/clients/wagon_update_proposal.ycp > URL: > http://svn.opensuse.org/viewcvs/yast/trunk/wagon/src/clients/wagon_update_proposal.ycp?rev=64343&r1=64342&r2=64343&view=diff > ============================================================================== > --- trunk/wagon/src/clients/wagon_update_proposal.ycp (original) > +++ trunk/wagon/src/clients/wagon_update_proposal.ycp Tue Jun 14 14:00:22 2011 > @@ -20,6 +20,7 @@ > > import "Wagon"; > import "Report"; > + import "PackageInstallation"; > > string func = (string) WFM::Args(0); > map param = (map) WFM::Args(1); > @@ -40,11 +41,23 @@ > } > > Wagon::ProposeDUP(); > + Wagon::ProposeDownloadMode(); > > ret = Wagon::ProposalSummary(); > > } else if (func == "AskUser") { > - Report::Message (_("There is nothing to set.")); > + string chosen_id = param["chosen_id"]:""; > + > + // toggle the download mode status > + if (chosen_id == Wagon::GetDownloadModeLink()) > + { > + > PackageInstallation::SetDownloadInAdvance(!PackageInstallation::DownloadInAdvance()); > + } > + else > + { > + Report::Message (_("There is nothing to set.")); > + } > + > ret = $[ "workflow_sequence" : `next ]; > > } else if (func == "Description") { > > Modified: trunk/wagon/src/modules/Wagon.ycp > URL: > http://svn.opensuse.org/viewcvs/yast/trunk/wagon/src/modules/Wagon.ycp?rev=64343&r1=64342&r2=64343&view=diff > ============================================================================== > --- trunk/wagon/src/modules/Wagon.ycp (original) > +++ trunk/wagon/src/modules/Wagon.ycp Tue Jun 14 14:00:22 2011 > @@ -31,6 +31,8 @@ > import "Update"; > import "FileUtils"; > import "String"; > + import "Packages"; > + import "PackageInstallation"; > > boolean running_by_applet = false; > > @@ -75,6 +77,13 @@ > return update_workflow_type; > } > > + const string download_mode_link = "wagon-download_in_advance"; > + > + global define string GetDownloadModeLink() > + { > + return download_mode_link; > + } > + > string migration_method = nil; > > global string migration_method_file = sformat > ("%1/wagon_migration_method", Directory::vardir); > @@ -379,6 +388,68 @@ > return true; > } > > + string FindMountPoint(string dir, list<string> dirs) > + { > + while (dir != nil && dir != "" && !contains(dirs, dir)) > + { > + // strip the last path component and try it again > + list<string> comps = splitstring(dir, "/"); > + comps = remove(comps, size(comps) - 1); > + dir = mergestring(comps, "/"); > + } > + > + return dir; > + }
^
I *think* that this function fails if it should return "/",
returning "" instead. Unit tests? A descriptive comment for the
function, mentioning the corner cases?
> +
> + map<string, any> CheckDownloadSpace()
> + {
> + map<string, list> du = Pkg::TargetGetDU();
> + list<string> mounts = maplist(string dir, list info, du, {return dir;});
> +
> + map<string,any> zconfig = Pkg::ZConfig();
> + string pkg_path = zconfig["repo_packages_path"]:"";
> +
> + string packages_mount = FindMountPoint(pkg_path, mounts);
> + y2milestone("Packages will we downloaded to mountpoint %1",
> packages_mount);
> +
> + // download size in bytes
> + integer download_size = Packages::CountSizeToBeDownloaded();
> + y2milestone("Size of packages to download: %1MB", download_size >> 20);
> +
> + // du contains maps: $[ "dir" : [ total, used, pkgusage, readonly ],
> .... ]
> + integer after_install = du[packages_mount, 2]:0;
> + integer total = du[packages_mount, 0]:0;
> +
> + symbol result = `ok;
> + string message = "";
> +
> + if (after_install + download_size < total)
> + {
> + result = `error;
> + message = "Not enough free space";
_() missing?
> + y2error("Not enough free space for download in advance upgrade");
> + }
> + else if (after_install + download_size < total - 100<<20)
> + {
> + result = `warning;
> + message = "Not enough free space";
_() ?
> + y2error("Not enough free space for download in advance upgrade");
good luck with distinguishing the two situations in y2log some
months later ;-)
> + }
> +
> + return $[ "result" : result, "message" : message ];
> + }
> +
> + global void ProposeDownloadMode()
> + {
> + if (PackageInstallation::DownloadInAdvance() == nil)
> + {
> + map<string, any> dwspace = CheckDownloadSpace();
> +
> + PackageInstallation::SetDownloadInAdvance(dwspace["result"]:nil ==
> `ok);
> + y2milestone("Proposed download in advance mode: %1",
> PackageInstallation::DownloadInAdvance());
> + }
> + }
> +
> global map <string,any> MinimizeProductMap (map <string,any> product) {
> if (haskey (product, "license")) product["license"] = "...";
> if (haskey (product, "description")) product["description"] = "...";
> @@ -510,9 +581,14 @@
>
> ret = "<ul>\n" + ret + "</ul>\n";
>
> + ret = ret + "<ul><li>\n" + _("Download all packages before upgrade: ") +
> + sformat("<a href=\"%1\">%2</a>", download_mode_link,
> (PackageInstallation::DownloadInAdvance() ? _("Enabled") : _("Disabled")))
> + + "</li></ul>\n";
> +
> map <string, any> summary = $[
> "preformatted_proposal" : ret,
> - // help text
> + "links" : [ download_mode_link ],
> + // help text, TODO FIXME: replace the inner <p> by <b>
WTF? Is this a broken text unfixable because it is translated
already? OK, but this is the trunk.
> "help" : _("<p>To change the update settings, go to <p>Packages
> Proposal</p> section.</p>"),
> ];
>
>
> Modified: trunk/wagon/yast2-wagon.spec.in
> URL:
> http://svn.opensuse.org/viewcvs/yast/trunk/wagon/yast2-wagon.spec.in?rev=64343&r1=64342&r2=64343&view=diff
> ==============================================================================
> --- trunk/wagon/yast2-wagon.spec.in (original)
> +++ trunk/wagon/yast2-wagon.spec.in Tue Jun 14 14:00:22 2011
> @@ -10,7 +10,8 @@
> Requires: yast2-pkg-bindings >= 2.19.1
>
> # Called in proposal and in code
> -Requires: yast2-packager yast2-add-on
> +Requires: yast2-packager >= 2.21.2
> +Requires: yast2-add-on
>
> # Counting packages directly in packages proposal (BNC #573482)
> Requires: yast2-update >= 2.18.7
>
> --
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
--
Martin Vidner, YaST developer
http://en.opensuse.org/User:Mvidner
Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu
pgp6VJN7hiWaX.pgp
Description: PGP signature
