=== modified file 'stagebuilder.prolog' --- stagebuilder.prolog 2011-11-17 20:56:59 +0000 +++ stagebuilder.prolog 2011-11-17 10:56:17 +0000 @@ -175,10 +175,6 @@ maplist(escape, List, Escaped0), concat([Var, "=$("], Pre), concat([[Pre], Escaped0, [")"]], Escaped). -cmd_tokens(run_outarray(List, Var) , Escaped) :- - maplist(escape, List, Escaped0), - concat([Var, "=( $("], Pre), - concat([[Pre], Escaped0, [") )"]], Escaped). cmd_tokens( echo_append(String, File), Escaped) :- cmd_tokens( run_append([echo, String], File), Escaped). cmd_tokens(echo_replace(String, File), Escaped) :- @@ -201,8 +197,7 @@ str_join("\n", Lines, String), name(Name,String), nl, - write(Name), - nl. + write(Name). print_solution(Solution) :- str_join('\n', Solution, String), name(Text, String), @@ -420,9 +415,64 @@ assoc_to_list(Assoc, Pairs), maplist(package_echo_dir(Dir), Pairs, Commands). -% -% altering make.conf -% + +%echo_package_dir(Dir, echo_append(String, Dir +/+ Tail), Echo) :- +% echo_package(Echo, Tail, String). +% +%extract_package_echos([], [], []). +%extract_package_echos([gentoo_package(_Name, Echos, _UE, _UD)|PkgRest] +% ,AllFiles +% ,AllStrings +% ):- +% maplist(echo_package, Echos, Files, Strings), +% extract_package_echos(PkgRest, RecFiles, RecStrings), +% append(Files, RecFiles, AllFiles), +% append(Strings, RecStrings, AllStrings). +% +%joined_echos([ ],_Keys,_Values, [ ]). +%joined_echos([Key|UniqueKeys], Keys, Values, [Echo|EchosRest]) :- +% select_rows(Key, Keys, Values, Selected), +% join('\n', Selected, Joined), +% Echo = echo. +% +%aggregate_package_echos(Packages, Echos) :- +% extract_package_echos(Packages, Files, Strings), +% sort(Files, UniqueFiles), + + +%dict_append_aux(Key +% ,AppendValue +% ,[CurrentKey|Keys] +% ,[CurrentValue|Values] +% ,[ResultValue|Results] +% ) :- +% ( Key = CurrentKey +% -> ResultValue = AppendValue + '\n' + CurrentValue +% ; ResultValue = CurrentValue +% ), +% dict_append_aux(Key, AppendValue, Keys, Values, Results). +% +%dict_append(Key, Value, Ks, Vs, RKs, RVs) :- +% ( member(Key, Keys) +% -> dict_append_aux(Key, Value, Vs, RVs), RKs = Ks +% ; 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_packages(Commands, Echos, Dir) :- +% maplist(echo_package_dir(Dir), Commands, Echos). +% disabled_uses(Uses, DisabledUses) :- +% maplist(disabled_use, Uses, DisabledUses). dir_make_conf(Dir, Dir +/+ 'etc/make.conf'). @@ -449,22 +499,12 @@ dir_make_conf(Dir, Dst) }. -% -% other auxiliary predicates -% - create_chroot_script(Dir, Arch) --> [run([cp, '-Lp', '--', Conf + '/chroot.sh-' + Arch , Dir +/+ 'chroot.sh' ])], {site_conf_dir(Conf)}. -get_portage_timestamp(Dir, variable(portage_timestamp)) --> - {script_dir(Script)}, - [run_outvar([Script +/+ portage_timestamp, Dir +/+ 'usr/portage'], - portage_timestamp - )]. - create_gentoo_builddir(Name, Dir) --> {gentoo_stage(Name, ArchName, _)}, download_gentoo_stage(Tarball, Name), @@ -475,20 +515,11 @@ , Dir +/+ 'var/portage/ccx-autobuild' ])]. -gentoo_build_stage3(Name, Dir) --> - get_portage_timestamp(Dir, PortageVer), - [chroot(Dir, ['/root/prosys/rebuild_stage3.sh'])], - create_stage(Name + '_stage3-p' + PortageVer, Dir). gentoo_build_stage4(Name, Dir) --> - get_portage_timestamp(Dir, PortageVer), [chroot(Dir, ['/root/prosys/rebuild_stage3.sh'])], - create_stage(Name + '_stage3-p' + PortageVer, Dir), + create_stage(Name + '_stage3', Dir), [chroot(Dir, ['emerge -uDN $( cat /root/prosys/world )'])], - create_stage(Name + '_stage4-p' + PortageVer, Dir). - -% -% targets -% + create_stage(Name + '_stage4', Dir). target(Commands, Name, Dir) :- phrase(target(Name, Dir), Commands). @@ -502,7 +533,7 @@ append_site_make_conf(Dir), configure_gentoo_packages(Dir, [portage22, nopy3k, mc, vim]), [chroot(Dir, ['/root/prosys/rebuild_stage3.sh'])], - gentoo_build_stage3(i686_hardened, Dir). + create_stage(i686_hardened_stage3, Dir). target(amd64_hardened_vshost, Dir) --> create_gentoo_builddir(amd64_hardened, Dir),