Author: ug Date: Fri May 30 16:22:30 2008 New Revision: 47966 URL: http://svn.opensuse.org/viewcvs/yast?rev=47966&view=rev Log: fix for cloning the software section (bnc#391770) Modified: trunk/autoinstallation/VERSION trunk/autoinstallation/package/autoyast2.changes trunk/autoinstallation/src/modules/AutoinstClone.ycp Modified: trunk/autoinstallation/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/VERSION?rev=47966&r1=47965&r2=47966&view=diff ============================================================================== --- trunk/autoinstallation/VERSION (original) +++ trunk/autoinstallation/VERSION Fri May 30 16:22:30 2008 @@ -1 +1 @@ -2.16.17 +2.16.18 Modified: trunk/autoinstallation/package/autoyast2.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/package/autoyast2.changes?rev=47966&r1=47965&r2=47966&view=diff ============================================================================== --- trunk/autoinstallation/package/autoyast2.changes (original) +++ trunk/autoinstallation/package/autoyast2.changes Fri May 30 16:22:30 2008 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Fri May 30 16:21:02 CEST 2008 - ug@suse.de + +- fix for cloning the software section + (bnc#391770) +- 2.16.18 + +------------------------------------------------------------------- Tue May 27 14:54:11 CEST 2008 - ug@suse.de - UI endless loop fixed Modified: trunk/autoinstallation/src/modules/AutoinstClone.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/autoinstallation/src/modules/AutoinstClone.ycp?rev=47966&r1=47965&r2=47966&view=diff ============================================================================== --- trunk/autoinstallation/src/modules/AutoinstClone.ycp (original) +++ trunk/autoinstallation/src/modules/AutoinstClone.ycp Fri May 30 16:22:30 2008 @@ -305,6 +305,39 @@ return drives; } + global define boolean isPatternFulfilled( string p ) { + list<map<string,any> > all_xpatterns = Pkg::ResolvableDependencies ("", `pattern, ""); + list<string> inst = Pkg::GetPackages(`installed, true); + boolean ret = true; + + foreach( map<string,any> dep, all_xpatterns, ``{ + if( ret == true && dep["name"]:"" == p ) { + foreach( map<string,string> dep2, dep["dependencies"]:[], ``{ + if( dep2["dep_kind"]:"" == "requires" ) { + if( dep2["res_kind"]:"" == "package" && !contains( inst, dep2["name"]:"" ) ) { + ret = false; + break; + } else if( dep2["res_kind"]:"" == "pattern" && !isPatternFulfilled( dep2["name"]:"" ) ) { + ret = false; + break; + } + } + }); + } + }); + return ret; + } + + global define list<string> getPatterns() { + list<string> ret = []; + list<map<string,any> > all_patterns = Pkg::ResolvableProperties ("", `pattern, ""); + + foreach( map<string,any> m, all_patterns, ``{ + if( isPatternFulfilled( m["name"]:"" ) ) + ret = add( ret, m["name"]:"" ); + }); + return ret; + } /** * Return list of software packages of calling client @@ -315,18 +348,20 @@ */ global define map<string, any > Software() { - boolean ret = Pkg::TargetInit("/", false); +// boolean ret = Pkg::TargetInit("/", false); + Pkg::TargetInitialize ("/"); + Pkg::TargetLoad(); + Pkg::SourceStartManager (true); list<string> inst = Pkg::GetPackages(`installed, true); list<map<string,any> > all_patterns = Pkg::ResolvableProperties ("", `pattern, ""); list<map<string,any> > all_xpatterns = Pkg::ResolvableDependencies ("", `pattern, ""); list<string> patterns = []; - foreach( map<string,any> m, all_patterns, ``{ - if( m["status"]:`nothing == `installed ) - patterns = add( patterns, m["name"]:"" ); - }); - + // get all fulfilled patterns + // way too many will be fulfilled + // we will clean that up later + patterns = getPatterns(); Pkg::TargetFinish (); @@ -337,14 +372,6 @@ Pkg::SourceStartManager(true); - - /* FIXME: if this would work, it would be the better solution - foreach(string p, patterns, ``{ - Pkg::ResolvableInstall( p, `pattern ); - }); - Pkg::PkgSolve(false); - */ - list<string> packages = Pkg::FilterPackages(false, false, true, true); Pkg::TargetFinish (); // Remove kernel packages @@ -352,14 +379,24 @@ list<string> removepackages = []; list<string> patternPackages = []; + list<string> new_p = []; foreach( string tmp_pattern, patterns, ``{ list<map<string,any> > xpattern = filter( map<string,any> p, all_xpatterns, ``( p["name"]:"" == tmp_pattern ) ); map<string,any> found = xpattern[0]:$[]; + boolean req = false; foreach( map<string,any> d, found["dependencies"]:[], ``{ - if( d["res_kind"]:"" == "package" && d["dep_kind"]:"" == "requires" ) + if( d["res_kind"]:"" == "package" && d["dep_kind"]:"" == "requires" ) { patternPackages = add(patternPackages, d["name"]:""); + req = true; + } }); + // workaround for our pattern design + if( req == true ) + new_p = add( new_p, tmp_pattern ); }); + patterns = new_p; + + map<string, any > software = $[]; if( size(patterns) > 0 ) { foreach(string p, inst, ``{ -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org