Author: fehr Date: Wed Jan 30 14:30:38 2008 New Revision: 44009 URL: http://svn.opensuse.org/viewcvs/yast?rev=44009&view=rev Log: - do disk partitionig in separate setp before proposal screen - version 2.16.9 Added: trunk/storage/storage/src/inst_disk_proposal.ycp Removed: trunk/storage/storage/src/inst_part_proposal.ycp Modified: trunk/storage/VERSION trunk/storage/libstorage/src/Storage.cc trunk/storage/package/yast2-storage.changes trunk/storage/storage/src/include/auto_part_prepare.ycp trunk/storage/storage/src/include/do_proposal_flexible.ycp trunk/storage/storage/src/inst_target_part.ycp trunk/storage/storage/src/inst_target_selection.ycp trunk/storage/storage/src/modules/Storage.ycp trunk/storage/storage/src/proposal/partitions_proposal.ycp Modified: trunk/storage/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/VERSION?rev=44009&r1=44008&r2=44009&view=diff ============================================================================== --- trunk/storage/VERSION (original) +++ trunk/storage/VERSION Wed Jan 30 14:30:38 2008 @@ -1 +1 @@ -2.16.8 +2.16.9 Modified: trunk/storage/libstorage/src/Storage.cc URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Storage.cc?rev=44009&r1=44008&r2=44009&view=diff ============================================================================== --- trunk/storage/libstorage/src/Storage.cc (original) +++ trunk/storage/libstorage/src/Storage.cc Wed Jan 30 14:30:38 2008 @@ -6097,11 +6097,11 @@ return( ret ); } -struct equal_name +struct equal_co { - equal_name( const string& n ) : val(n) {}; - bool operator()(const Container* c) { return( c->name()==val ); } - const string& val; + equal_co( const Container* const co ) : c(co) {}; + bool operator()(const Container* co) { return( *co==*c ); } + const Container* const c; }; bool @@ -6136,7 +6136,7 @@ CCIter j; while( (ret||verbose_log) && i!=l->end() ) { - j = find_if( r->begin(), r->end(), equal_name( (*i)->name()) ); + j = find_if( r->begin(), r->end(), equal_co( *i ) ); if( j!=r->end() ) ret = (*i)->compareContainer( *j, verbose_log ) && ret; else @@ -6150,7 +6150,7 @@ i=r->begin(); while( (ret||verbose_log) && i!=r->end() ) { - j = find_if( l->begin(), l->end(), equal_name( (*i)->name()) ); + j = find_if( l->begin(), l->end(), equal_co( *i ) ); if( j==r->end() ) { ret = false; Modified: trunk/storage/package/yast2-storage.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/package/yast2-storage.changes?rev=44009&r1=44008&r2=44009&view=diff ============================================================================== --- trunk/storage/package/yast2-storage.changes (original) +++ trunk/storage/package/yast2-storage.changes Wed Jan 30 14:30:38 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Wed Jan 30 14:28:39 CET 2008 - fehr@suse.de + +- do disk partitionig in separate setp before proposal screen +- version 2.16.9 + +------------------------------------------------------------------- Thu Jan 17 12:17:53 CET 2008 - fehr@suse.de - fix handling of sun disk label (#353546) Modified: trunk/storage/storage/src/include/auto_part_prepare.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/auto_part_prepare.ycp?rev=44009&r1=44008&r2=44009&view=diff ============================================================================== --- trunk/storage/storage/src/include/auto_part_prepare.ycp (original) +++ trunk/storage/storage/src/include/auto_part_prepare.ycp Wed Jan 30 14:30:38 2008 @@ -108,6 +108,9 @@ integer last_end = 0; integer free_nr = 0; + if( target["label"]:"" == "sun" ) + last_end = 1; + // first the mid-disk holes partitions = flatten( maplist( map pentry, partitions, Modified: trunk/storage/storage/src/include/do_proposal_flexible.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/include/do_proposal_flexible.ycp?rev=44009&r1=44008&r2=44009&view=diff ============================================================================== --- trunk/storage/storage/src/include/do_proposal_flexible.ycp (original) +++ trunk/storage/storage/src/include/do_proposal_flexible.ycp Wed Jan 30 14:30:38 2008 @@ -1698,7 +1698,10 @@ end = disk["cyl_count"]:1-1; if( end > max_pos_cyl ) end = max_pos_cyl; - gap = (list<map>)union( gap, get_gaps( 0, end, plist, add_exist_linux )); + integer start = 0; + if( disk["label"]:"" == "sun" ) + start = 1; + gap = (list<map>)union( gap, get_gaps( start, end, plist, add_exist_linux )); integer av_size = 0; gap = maplist( map e, gap, ``{ Added: trunk/storage/storage/src/inst_disk_proposal.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/inst_disk_proposal.ycp?rev=44009&view=auto ============================================================================== --- trunk/storage/storage/src/inst_disk_proposal.ycp (added) +++ trunk/storage/storage/src/inst_disk_proposal.ycp Wed Jan 30 14:30:38 2008 @@ -0,0 +1,387 @@ +/* + ************************************************************* + * + * YaST2 SuSE Labs -o) + * -------------------- /\\ + * _\_v + * www.suse.de / www.suse.com + * ---------------------------------------------------------- + * + * Author: Michael Hager <mike@suse.de> + * + * Description: Create a proposal for partitioning + * + * + * + * + * + ************************************************************* + + $Id: inst_part_proposal.ycp 43636 2008-01-15 17:25:46Z fehr $ + +*/ + +{ + textdomain "storage"; + import "Arch"; + import "Wizard"; + import "Mode"; + import "Popup"; + import "Storage"; + + include "wizard/sequencer.ycp"; + include "partitioning/custom_part_check_generated.ycp"; + include "partitioning/do_proposal_flexible.ycp"; + +define void HandlePackages() + ``{ + Pkg::DoRemove( ["lvm2"] ); + list<string> pack = Storage::AddPackageList(); + if( size(pack)>0 ) + { + Pkg::DoProvide( pack ); + } + if( Stage::initial() ) + { + Storage::SaveUsedFs(); + } + } + +define boolean AskOverwriteChanges() + ``{ + boolean ret = true; + string target_is = Storage::GetPartMode(); + y2milestone( "AskOverwriteChanges target_is %1", target_is ); + if( target_is=="USE_DISK" || target_is=="CUSTOM" || + target_is=="PROP_MODIFY" ) + { + ret = Popup::YesNo( +_("Computing this proposal will overwrite manual changes +done so far. Continue with computing proposal?")); + } + y2milestone( "AskOverwriteChanges ret:%1", ret ); + return( ret ); + } + +define void execSubscreens( boolean detailed ) + ``{ + y2milestone( "execSubscreens detailed %1", detailed ); + map aliases = + $[ "disk" : + ``(WFM::CallFunction("inst_disk", [true, true])), + "target_sel" : + ``(WFM::CallFunction("inst_target_selection", [true, true])), + "target_part" : + ``(WFM::CallFunction("inst_target_part", [true, true])), + "resize_ui" : + ``(WFM::CallFunction("inst_resize_ui", [true, true])), + ]; + map seq = $[]; + seq["disk"] = $[ `abort : `abort, `cancel: `cancel, `next: `next ]; + if( Arch::s390() || Mode::autoinst() ) + { + Storage::SetPartMode("PROP_MODIFY"); + seq["ws_start"] = "disk"; + } + else + { + y2milestone( "ProposalActive %1 ProposalMode %2 PartMode %3", + Storage::GetPartProposalActive(), + Storage::GetPartProposalMode(), Storage::GetPartMode() ); + seq["target_sel"] = $[ `abort : `abort, `cancel: `cancel, + `next : "target_part" ]; + seq["target_part"] = $[ `abort : `abort, `cancel: `cancel, + `next : "disk" ]; + if( Arch::i386() ) + { + seq["resize_ui"] = $[ `abort : `abort, `cancel: `cancel, + `next : "disk" ]; + seq["target_part",`next] = "resize_ui"; + } + seq["disk"] = $[ `abort : `abort, `cancel: `cancel, `next : `next ]; + y2milestone( "execSubscreens GetPartMode %1", Storage::GetPartMode() ); + if( detailed && Storage::GetPartMode()!="CUSTOM" ) + seq["ws_start"] = "target_sel"; + else + seq["ws_start"] = "disk"; + if( Storage::CheckBackupState("disk")) + Storage::DisposeTargetBackup("disk"); + y2milestone( "execSubscreens sequence %1", seq ); + Wizard::OpenNextBackDialog(); + symbol result = WizardSequencer(aliases, seq); + Wizard::CloseDialog(); + HandlePackages(); + } + } + +map<string,map> targetMap = Storage::GetTargetMap(); + +if( Mode::test() && size(targetMap)==0 ) + { + y2warning("***** Demo mode active - using fake demo values *****"); + targetMap = (map<string,map>)SCR::Read(.target.yast2, "demo_target_map.ycp"); + Storage::SetTargetMap( targetMap ); + } + + +////////////////////////////////////////////////////// +// This module is only for i386 fdisk-label + +if( Arch::s390() ) + { + return Storage::GetExitKey(); + } + +string title = ""; +string modify_str = ""; +string detailed_str = ""; +string lvm_str = ""; +string evms_str = ""; +string part_str = ""; + +// Title for dialogue +title = _("Suggested Partitioning"); +// Radiobutton for partition dialog +modify_str = _("&Edit Partition Setup..."); +// Radiobutton for partition dialog +detailed_str = _("&Create Partition Setup..."); +// Radiobutton for partition dialog +part_str = _("&Partition Based"); +// Radiobutton for partition dialog +lvm_str = _("&LVM Based"); +// Radiobutton for partition dialog +evms_str = _("&EVMS Based"); + +string target_is = ""; + +string changes = ""; +if( Storage::GetPartProposalFirst() ) + { + map prop = get_inst_prop( Storage::GetTargetMap() ); + y2milestone( "prop ok:%1", prop["ok"]:false ); + if( prop["ok"]:false ) + { + map save = targetMap; + Storage::SetTargetMap( prop["target"]:$[] ); + targetMap = prop["target"]:$[]; + Storage::SetPartProposalMode( "accept" ); + changes = Storage::ChangeText(); + HandlePackages(); + target_is = "SUGGESTION"; + Storage::SetPartMode( target_is ); + Storage::SetPartProposalFirst( false ); + Storage::SetPartProposalActive( true ); + } + else + { + Storage::SetPartProposalMode( "impossible" ); + } + } +else + changes = Storage::ChangeText(); + +if( Storage::GetPartProposalMode() == "impossible" ) + { + changes = "<font color=red>"; + changes = changes + _("No automatic proposal possible. +Specify mount points manually in the 'Partitioner' dialog."); + changes = changes + "</font>"; + } + +y2milestone( "current proposal: %1", changes ); + +map cfg = Storage::GetControlCfg(); + +term rframe = + `HBox( + `HSpacing(3), + `MinWidth(20,`Left( `RadioButton( `id(`part), `opt(`notify), part_str, + !Storage::ProposalEvms() && + !Storage::ProposalLvm() ))), + `HSpacing(3), + `MinWidth(20,`Left( `RadioButton( `id(`lvm), `opt(`notify), lvm_str, + Storage::ProposalLvm() ))), + `HSpacing(3) + ); + +if( cfg["evms_config"]:false && false ) // No EVMS proposal for SLES10!! + { + boolean v = Storage::ProposalEvms() && !Storage::ProposalLvm(); + rframe = add( rframe, `HStretch() ); + rframe = add( rframe, + `MinWidth(20,`Left( `RadioButton( `id(`evms), evms_str, v ))) ); + rframe = add( rframe, `HSpacing(3) ); + } + +term bframe = + `HBox( + `PushButton( `id(`modify), modify_str ), + `HSpacing(5), + `PushButton( `id(`detailed), detailed_str ), + `HSpacing(5) + ); + + +// Frame description in suggested partition for mode accept modify .. +//bframe = `HCenter( `Frame( _("Partitioning"), `HVSquash( bframe ) )); + +term contents = + `VBox( + `VSpacing(0.5), + `HBox( + `HSpacing(2), + `VBox( + `MinHeight( 7, `RichText( `id("richtext"), changes )), + `VSpacing(1), + `RadioButtonGroup( `id("prop_mode"), rframe ), + `VSpacing(4), + bframe, + `VStretch() + ), + `HSpacing(2) + ), + `VSpacing(2) ); + + +// help on suggested partitioning +string help_text = _("<p> +Your hard disks have been checked. The partition setup +displayed is proposed for your hard drive.</p>"); + +// help text continued +// %1 is replaced by button text +help_text = help_text + sformat(_("<p> +To make only small adjustments to the proposed +setup (like e.g. changing filesystem types), choose +<b>%1</b> and do these modification in the expert +partioner dialog.</p> +"), deletechars(modify_str,"&")); + +// help text continued +help_text = help_text + sformat(_("<p> +If the suggestion does not fit your needs, create +your own partition setup starting with the partitions as +currently present on the disks. For this, select +<b>%1</b>. +This is also the option to choose for +advanced options like RAID and encryption.</p> +"), deletechars(detailed_str,"&")); + +if( cfg["evms_config"]:false && false ) // No EVMS proposal for SLES10!! + // help text continued + // %1 is replaced by button text + help_text = help_text + _("<p> +To create an LVM or EVMS based proposal, choose the corresponding button.</p> +"); +else + // help text continued + // %1 is replaced by button text + help_text = help_text + _("<p> +To create an LVM based proposal, choose the corresponding button.</p> +"); + + +symbol ret = nil; + +if( !Storage::GetTestsuite() ) + { + map enab = (map)WFM::Args(0); + Wizard::SetContents( title, contents, help_text, + enab["enable_back"]:false, enab["enable_next"]:false ); + if( Stage::initial () ) + Wizard::SetTitleIcon( "yast-partitioning" ); + + any r = nil; + + repeat + { + symbol old_mode = (symbol)UI::QueryWidget( `id("prop_mode"), + `CurrentButton ); + y2milestone( "old_mode %1", old_mode ); + Wizard::SetFocusToNextButton(); + ret = (symbol)Wizard::UserInput(); + y2milestone( "USERINPUT %1", ret ); + + if( ret == `abort && Popup::ReallyAbort(true) ) + return `abort; + + if( contains( [ `lvm, `evms, `part ], ret ) ) + { + if( AskOverwriteChanges() ) + { + target_is = "SUGGESTION"; + if( ret==`lvm ) + Storage::SetProposalLvm(true); + else if( ret==`evms ) + Storage::SetProposalEvms(true); + else + { + Storage::SetProposalLvm(false); + Storage::SetProposalEvms(false); + } + Storage::ResetOndiskTarget(); + Storage::AddMountPointsForWin(Storage::GetTargetMap()); + map prop = get_inst_prop( Storage::GetTargetMap()); + if( !prop["ok"]:false ) + { + Popup::Error( _("Impossible to create the requested proposal.") ); + Storage::SetPartProposalMode( "impossible" ); + } + else + { + targetMap = prop["target"]:$[]; + Storage::SetPartProposalMode( "accept" ); + Storage::SetPartProposalActive( true ); + } + Storage::SetPartMode( target_is ); + Storage::SetTargetMap( targetMap ); + changes = Storage::ChangeText(); + UI::ChangeWidget( `id("richtext"), `Value, changes ); + } + else + { + UI::ChangeWidget( `id("prop_mode"), `CurrentButton, old_mode ); + } + } + else if( ret==`modify || ret==`detailed ) + { + Storage::SetPartProposalFirst( false ); + Storage::SetPartProposalActive( false ); + if( ret==`modify ) + { + target_is = "PROP_MODIFY"; + Storage::SetPartProposalMode( "modify" ); + } + else + { + if( Storage::GetPartMode()!="CUSTOM" ) + { + target_is = "NORMAL"; + } + else + { + target_is = "CUSTOM"; + } + Storage::SetPartDisk( "" ); + Storage::SetPartProposalMode( "detailed" ); + } + Storage::SetPartMode( target_is ); + execSubscreens( ret==`detailed ); + changes = Storage::ChangeText(); + UI::ChangeWidget( `id("richtext"), `Value, changes ); + if( ret==`detailed ) + { + if( Storage::ProposalLvm() ) + UI::ChangeWidget( `id("prop_mode"), `CurrentButton, `lvm ); + else if( Storage::ProposalEvms() ) + UI::ChangeWidget( `id("prop_mode"), `CurrentButton, `evms ); + else + UI::ChangeWidget( `id("prop_mode"), `CurrentButton, `part ); + } + } + } until ( ret == `next || ret == `back || ret == `cancel ); + } +Storage::SaveExitKey( ret ); + +return ret; +} Modified: trunk/storage/storage/src/inst_target_part.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/inst_target_part.ycp?rev=44009&r1=44008&r2=44009&view=diff ============================================================================== --- trunk/storage/storage/src/inst_target_part.ycp (original) +++ trunk/storage/storage/src/inst_target_part.ycp Wed Jan 30 14:30:38 2008 @@ -419,7 +419,7 @@ Storage::SetProposalLvm(false); } ok = create_partitions( targetMap, target, partitions ); - Storage::SetProposalDefault(); + Storage::SetProposalDefault(true); if( !ok ) { reason = _("Too few partitions are marked for removal Modified: trunk/storage/storage/src/inst_target_selection.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/inst_target_selection.ycp?rev=44009&r1=44008&r2=44009&view=diff ============================================================================== --- trunk/storage/storage/src/inst_target_selection.ycp (original) +++ trunk/storage/storage/src/inst_target_selection.ycp Wed Jan 30 14:30:38 2008 @@ -32,8 +32,7 @@ y2milestone( "GetPartMode %1", Storage::GetPartMode() ); - if( Storage::GetPartMode() == "PROP_MODIFY" || - Storage::GetPartMode() == "SUGGESTION" ) + if( Storage::GetPartMode() == "PROP_MODIFY" ) return Storage::GetExitKey(); @@ -253,7 +252,8 @@ Storage::SetPartMode( "USE_DISK" ); y2milestone( "PartMode Disk old %1 name %2", Storage::GetPartDisk(), option ); - Storage::DisposeTargetBackup("disk"); + if( Storage::CheckBackupState("disk")) + Storage::DisposeTargetBackup("disk"); Storage::CreateTargetBackup("disk"); Storage::ResetOndiskTarget(); Storage::SetPartDisk( (string)option ); Modified: trunk/storage/storage/src/modules/Storage.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/modules/Storage.ycp?rev=44009&r1=44008&r2=44009&view=diff ============================================================================== --- trunk/storage/storage/src/modules/Storage.ycp (original) +++ trunk/storage/storage/src/modules/Storage.ycp Wed Jan 30 14:30:38 2008 @@ -6555,7 +6555,7 @@ input = filterchars(input, "0123456789kKmMgGtTbBoO."); - if( findfirstnotof( input, "0123456789.") != nil ) + if( size(input)>0 && findfirstnotof( input, "0123456789.") != nil ) { // check whether the last char is in "kKmM" or "bB" string last_char = substring( input, size(input)-1, 1); @@ -6600,6 +6600,10 @@ number = 0; } } + else if( size(input)==0 ) + { + number = 0; + } else { number = tointeger( input ); @@ -6653,24 +6657,27 @@ return( proposal_lvm ); } -global void SetProposalDefault() +global void SetProposalDefault( boolean home_only ) { SetProposalHome( cfg_xml["home"]:false ); - if( cfg_xml["prop_evms"]:false ) - { - SetProposalEvms(true); - } - else if( cfg_xml["prop_lvm"]:false ) - { - SetProposalLvm(true); - } - else + if( !home_only ) { - SetProposalLvm(false); - SetProposalEvms(false); + if( cfg_xml["prop_evms"]:false ) + { + SetProposalEvms(true); + } + else if( cfg_xml["prop_lvm"]:false ) + { + SetProposalLvm(true); + } + else + { + SetProposalLvm(false); + SetProposalEvms(false); + } } - y2milestone( "SetProposalDefault lvm:%1 evms:%2 home:%3", - proposal_lvm, proposal_evms, proposal_home ); + y2milestone( "SetProposalDefault ho:%4 lvm:%1 evms:%2 home:%3", + proposal_lvm, proposal_evms, proposal_home, home_only ); } global map GetControlCfg() @@ -6722,7 +6729,7 @@ bt = ProductFeatures::GetBooleanFeature( "partitioning", "evms_boot" ); cfg_xml["evms_boot"] = bt?true:false; - SetProposalDefault(); + SetProposalDefault(false); y2milestone( "GetControlCfg cfg_xml %1", cfg_xml ); } return( cfg_xml ); Modified: trunk/storage/storage/src/proposal/partitions_proposal.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/storage/storage/src/proposal/partitions_proposal.ycp?rev=44009&r1=44008&r2=44009&view=diff ============================================================================== --- trunk/storage/storage/src/proposal/partitions_proposal.ycp (original) +++ trunk/storage/storage/src/proposal/partitions_proposal.ycp Wed Jan 30 14:30:38 2008 @@ -106,9 +106,7 @@ "target_part" : ``(WFM::CallFunction("inst_target_part", [true, true])), "resize_ui" : - ``(WFM::CallFunction("inst_resize_ui", [true, true])), - "part_proposal" : - ``(WFM::CallFunction("inst_part_proposal", [true, true])) + ``(WFM::CallFunction("inst_resize_ui", [true, true])) ]; map seq = $[]; @@ -124,12 +122,12 @@ seq["disk"] = $[ `abort : `abort, `cancel: `cancel, `next: `next ]; - if( Arch::s390 ()) + if( Arch::s390() ) { Storage::SetPartMode("PROP_MODIFY"); seq["ws_start"] = "disk"; } - else if (Mode::autoinst ()) + else if( Mode::autoinst() ) { Storage::SetPartMode("PROP_MODIFY"); seq["ws_start"] = "disk"; @@ -154,9 +152,7 @@ if( Storage::GetPartProposalMode() != "impossible" && Storage::GetPartProposalActive() ) { - seq["part_proposal"] = $[ `abort : `abort, `cancel: `cancel, - `next : "target_sel" ]; - seq["ws_start"] = "part_proposal"; + seq["ws_start"] = "target_sel"; } else if( Storage::GetPartMode()=="USE_DISK" ) { -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org