=== modified file 'stagebuilder.prolog' --- stagebuilder.prolog 2011-11-16 21:43:52 +0000 +++ stagebuilder.prolog 2011-11-16 18:12:20 +0000 @@ -361,13 +361,12 @@ format_package_use(Packages, JoinedUse) :- aggregate_package_use(Packages, UseEnabled, UseDisabled), - ord_intersection(UseEnabled, UseDisabled, Intersection), - ( ord_empty(Intersection) -> true - ; throw(conflicting_use(Intersection)) - ), - maplist(disabled_use, UseDisabled, UseDisabledMinus), - append(UseEnabled, UseDisabledMinus, MergedUse), - join(' ', MergedUse, JoinedUse). + ( ord_intersection(UseEnabled, UseDisabled, Intersection) + -> throw(conflicting_use(Intersection)) + ; maplist(disabled_use, UseDisabled, UseDisabledMinus), + append(UseEnabled, UseDisabledMinus, MergedUse), + join(' ', MergedUse, JoinedUse) + ). % package settings handling @@ -402,19 +401,8 @@ aggregate_package_echo([ ], Assoc, Assoc). aggregate_package_echo([echo_append(String, File)|Rest], Assoc, Result) :- ( get_assoc(File, Assoc, Prev) - -> put_assoc(File, Assoc, String + '\n' + Prev, NewAssoc) - ; put_assoc(File, Assoc, String, NewAssoc) - ), + -> put_assoc(File, Assoc, String aggregate_package_echo([Rest], NewAssoc, Result). - -package_echo_dir(Dir, File-String, echo_append(String, Dir +/+ File)). - -gentoo_package_echos(Packages, Dir, Commands) :- - aggregate_package_echo(Packages, Assoc), - assoc_to_list(Assoc, Pairs), - maplist(package_echo_dir(Dir), Pairs, Commands). - - %echo_package_dir(Dir, echo_append(String, Dir +/+ Tail), Echo) :- % echo_package(Echo, Tail, String). % @@ -457,16 +445,16 @@ % ; RKs = [Key|Ks], RVs = [[Value]] % ). -%echo_package_dir_agg([ ], Files, Strings, Files, Strings). -%echo_package_dir_agg([Echo|Rest], Files, Strings, AggFiles, AggStrings) :- -% echo_package(Echo, File, String), -% dict_append(File, String, AggFiles, AggStrings, NewFiles, NewStrings), -% echo_package_dir_agg(Rest, Files, Strings, NewFiles, NewStrings). -% -% -%echo_packages(Echos, Dirs, Commands) :- -% echo_package_dir_agg(Echos, Files, Strings, [], []), -% +echo_package_dir_agg([ ], Files, Strings, Files, Strings). +echo_package_dir_agg([Echo|Rest], Files, Strings, AggFiles, AggStrings) :- + echo_package(Echo, File, String), + dict_append(File, String, AggFiles, AggStrings, NewFiles, NewStrings), + echo_package_dir_agg(Rest, Files, Strings, NewFiles, NewStrings). + + +echo_packages(Echos, Dirs, Commands) :- + echo_package_dir_agg(Echos, Files, Strings, [], []), + % echo_packages(Commands, Echos, Dir) :- % maplist(echo_package_dir(Dir), Commands, Echos). @@ -478,10 +466,11 @@ configure_gentoo_packages(Dir, Packages) --> [echo_append('USE="' + JoinedUse + '"', Make_conf)], { format_package_use(Packages, JoinedUse), - gentoo_package_echos(Packages, Dir, Commands), - dir_make_conf(Dir, Make_conf) + maplist(echo_package_dir(Dir), Commands, Echos) }, - prepend(Commands). + prepend(Commands), + { dir_make_conf(Dir, Make_conf) + }. reset_make_conf(Dir, CFLAGS, CXXFLAGS, CHOST) --> [echo_replace('#Autogenerated make.conf by ProSys\n'