=== modified file 'stagebuilder.prolog' --- stagebuilder.prolog 2011-10-21 16:00:17 +0000 +++ stagebuilder.prolog 2011-10-19 08:44:52 +0000 @@ -49,12 +49,8 @@ not_in(_, []). not_in(A, [B|R]) :- A =\= B, not_in(A, R). -str(X, S) :- - is_list(X) -> X = S; - atom(X) -> name(X, S). - -escape(U, E) :- - str(U, US), +escape(U, E) :- + (atom(U) -> name(U, US); US = U), (( member(UC, US), member(UC, " \n\t()[]{}&;$#!?*=<>\"`"), @@ -65,31 +61,17 @@ ), name(E, ES). -escape(variable(Name), E) :- - concat(["${", Name, "}"], ES), - name(E, ES). - -escape(A+B, E) :- concat([A, B], S), escape(S, E). - -escape(A+B, E) :- - escape(A, AE), - escape(B, BE), - concat([AE, BE], ES), - name(E, ES). - unpack_tarball(Tarball, Dir, [run([tar, '-xpf', Tarball, '-C', Dir])]). -http_glob(Uri, [run_outvar([http_glob, Uri], uri)], variable(uri)). +http_glob(Uri, [run_outvar([http_glob, Uri], uri)], '$uri'). -digest_download(Uri, - [run_outvar([digest_download, Uri], downloaded)], - variable(downloaded)). +digest_download(Uri, [run_outvar([digest_download, Uri], downloaded)], '$downloaded'). download_gentoo_stage(Mirror, Arch, Subarch, Subdir, Commands, File) :- - http_glob( - Mirror + "/releases/" + Arch + "/current-stage3/" + - Subdir +"stage3-" + Subarch + "-*.DIGESTS.asc", - GlobCommands, Uri), + concat([Mirror, "/releases/", Arch, "/current-stage3/", + Subdir, "stage3-", Subarch, "-*.DIGESTS.asc"], MatchUriString), + name(MatchUri, MatchUriString), + http_glob(MatchUri, GlobCommands, Uri), digest_download(Uri, DownloadCommands, File), append(GlobCommands, DownloadCommands, Commands). @@ -168,23 +150,25 @@ append(UseES, UseDS, MergedUse), join(" ", MergedUse, JoinedUse), dir_make_conf(Dir, Make_conf), - Commands = [ echo_append("USE=\"" + JoinedUse + "\"", Make_conf) | C1 ]. + concatn(["USE=\"", JoinedUse, "\""], Use), + Commands = [ echo_append(Use, Make_conf) | C1 ]. -reset_make_conf(Dir, CFLAGS, CXXFLAGS, CHOST, [echo_replace( - "#Autogenerated make.conf by ProSys\n" + - "CFLGAGS=\"" + CFLAGS + "\"\n" + - "CXXFLAGS=\"" + CXXFLAGS + "\"\n" + - "CHOST=\"" + CHOST + "\"\n", - Make_conf )]) :- dir_make_conf(Dir, Make_conf). +reset_make_conf(Dir, CFLAGS, CXXFLAGS, CHOST, [echo_replace(Text, Make_conf)]) :- + dir_make_conf(Dir, Make_conf), + concatn([ + "Autogenerated make.conf by ProSys\n", + "CFLGAGS=\"", CFLAGS, "\"\n", + "CXXFLAGS=\"", CXXFLAGS, "\"\n", + "CHOST=\"", CHOST, "\"\n" + ], Text). append_site_make_conf(Dir, [run_append([cat, Src], Dst)]) :- site_conf_file("make.conf", Src), dir_make_conf(Dir, Dst). -create_chroot_script(Dir, Arch, [run([ - cp, '-Lp', '--', Conf + '/chroot.sh-' + Arch, Dst - ])]) :- +create_chroot_script(Dir, Arch, [run([cp, '-Lp', '--', Src, Dst])]) :- site_conf_dir(Conf), + concatn([Conf, "/chroot.sh-", Arch], Src), path_joinn([Dir, "chroot.sh"], Dst). create_gentoo_builddir(Name, Dir, Commands) :-