=== removed file 'atom_manip.pl' --- atom_manip.pl 2012-05-17 22:58:49 +0000 +++ atom_manip.pl 1970-01-01 00:00:00 +0000 @@ -1,15 +0,0 @@ -% vim: ft=prolog textwidth=80 tabstop=4 softtabstop=4 shiftwidth=4 expandtab - -:- module(atom_manip, [op(700, xfy, (=:)), (=:)/2]). - -=:(A, A) :- atom(A). - -=:(Variable, +(A, B)) :- - Aa =: A, - Ba =: B, - atomic_list_concat([Aa, Ba], '', Variable). - -=:(Variable, /(A, B)) :- - Aa =: A, - Ba =: B, - atomic_list_concat([Aa, Ba], '/', Variable). === modified file 'scripts/functions' --- scripts/functions 2012-05-17 22:58:49 +0000 +++ scripts/functions 2012-01-18 00:23:46 +0000 @@ -1,19 +1,7 @@ # vim: noet ts=4 sts=4 ft=zsh -PS4='+%B%* %F{cyan}%N%f:%F{yellow}%i%f>%b ' die() { echo DIE: "$@" exit 1 } -die_usage() { - echo ERROR: "$@" - echo usage: ${0:t} $USAGE - exit 2 -} -PROSYS_BASE=${PROSYS_BASE:-${${0:h}:h}} -PROSYS_CONF=${PROSYS_CONF:-${PROSYS_BASE}/conf} -PROSYS_BUILD=${PROSYS_BUILD:-${PROSYS_BASE}/build} -PROSYS_STAGES=${PROSYS_BUILD:-${PROSYS_STAGES}/stages} -PROSYS_TARGETS=${PROSYS_TARGETS:-${PROSYS_BASE}/targets} -PROSYS_DOWNLOADS=${PROSYS_DOWNLOADS:-${PROSYS_BASE}/downloads} === removed file 'scripts/get_gentoo_stage' --- scripts/get_gentoo_stage 2012-05-17 22:58:49 +0000 +++ scripts/get_gentoo_stage 1970-01-01 00:00:00 +0000 @@ -1,26 +0,0 @@ -#!/bin/zsh -# vim: noet ts=4 sts=4 -source ${0:h}/functions -USAGE="target_basename download_dir txt_uri" -[[ ${#@} != 3 ]] && die_usage -set -x - -target_basename=$1 -download_dir=$2 -txt_uri=$3 - -mkdir -p $download_dir || die -digest_uri=$( ${0:h}/resolve_txt_uri $txt_uri ) || die -downloaded=$( ${0:h}/download_stage $digest_uri $download_dir ) || exit $? -builddate=$( sed 's/.*-\([0-9]*\)\.tar.*/\1' <<<$downloaded ) -dst_dir=${target_basename}-${builddate} -echo $dst_dir -if [[ -d $dst_dir ]]; then - # already unpacked & prepared - [[ -f $dst_dir/root/prosys/stages_completed ]] && exit 0 -fi -mkdir -p $dst_dir/{root/prosys,usr/portage,var/portage/packages} || die -tar -xpf $downloaded -C $dst_dir || die -rsync -a --delete $PROSYS_BASE/overlay/ $dst_dir/var/portage/ccx-autobuild/ || die -rsync -a --delete $PROSYS_CONF/gentoo_scripts/ $dst_dir/root/prosys/ || die -rsync -a --delete $PROSYS_CONF/portage/ $dst_dir/etc/portage/ || die === modified file 'scripts/snapshot_stage' (properties changed: +x to -x) === modified file 'shell.pl' --- shell.pl 2012-05-17 22:58:49 +0000 +++ shell.pl 2012-05-17 18:49:59 +0000 @@ -57,9 +57,6 @@ check_returncode --> prepend(" || exit $?\n"). -cmd_tokens(verbatim(Verbatim)) --> - str_dcg(Verbatim). - cmd_tokens(Runnable) --> cmd_escape_runnable(Runnable), check_returncode. === modified file 'stagebuilder.pl' --- stagebuilder.pl 2012-05-17 22:58:49 +0000 +++ stagebuilder.pl 2012-05-17 01:48:06 +0000 @@ -10,9 +10,7 @@ :- use_module(generic). :- use_module(escape). -:- use_module(shell). :- use_module(dcg_stuff). -:- use_module(atom_manip). %%%%%%%%%%%% @@ -20,9 +18,6 @@ %%%%%%%%%%%% gentoo_mirror('ftp://ftp.linux.cz/pub/linux/gentoo/'). -stages_set_timezone('Europe/Prague'). -stages_set_locale('en_US.UTF-8'). - work_dir('/var/prosys'). site_conf_dir(Work +/+ conf ) :- work_dir(Work). downloads_dir(Work +/+ downloads) :- work_dir(Work). @@ -38,14 +33,14 @@ unpack_stage_tarball(Tarball) --> builddir #? Dir, - commands #+ [ [tar, '-xpf', Tarball, '-C', Dir] ]. + commands #+ [ run([tar, '-xpf', Tarball, '-C', Dir]) ]. create_stage_tarball(Tarball, AddOpts) --> builddir #? Dir, { script_dir(ScriptDir), append(AddOpts, ['-pC', Dir, '.'], Opts) }, - commands #+ [ run([ScriptDir +/+ tar_checksum, Tarball | Opts]) ]. + commands #+ [ run([ScriptDir +/+ tar_checksum, Tarball | Opts]) ], create_stage(Name) --> { stages_dir(Stages) }, @@ -385,19 +380,22 @@ }, commands #+ Commands. -reset_make_conf(CFLAGS, CXXFLAGS, CHOST) --> - commands #+ [ comment('create new make.conf') ], - into_build_dir( - echo('#Autogenerated make.conf by ProSys\n' +reset_make_conf(CXXFLAGS, CHOST) --> + commands #+ [ + comment('create new make.conf'), + echo_replace('#Autogenerated make.conf by ProSys\n' + 'CFLGAGS="' + CFLAGS + '"\n' + 'CXXFLAGS="' + CXXFLAGS + '"\n' - + 'CHOST="' + CHOST + '"\n' - ) >> 'etc/make.conf' - ). + + 'CHOST="' + CHOST + '"\n', + Make_conf) + ], + { dir_make_conf(Make_conf) }. append_site_make_conf --> - { site_conf_file('make.conf', Src) }, - into_build_dir([cat, Src] >> 'etc/make.conf'). + commands #+ [run_append([cat, Src], Dst)], + { site_conf_file('make.conf', Src), + dir_make_conf(Dst) + }. % % other auxiliary predicates @@ -411,11 +409,10 @@ ]. set_locale(Locale) --> - into_build_dir(echo('LC_ALL="'+Locale+'"') > 'etc/env.d/02locale'). -% build_dir #? Dir, -% commands #+ [ -% echo_replace('LC_ALL="' + Locale + '"', Dir +/+ 'etc/env.d/02locale') -% ]. + build_dir #? Dir, + commands #+ [ + echo_replace('LC_ALL="' + Locale + '"', Dir +/+ 'etc/env.d/02locale') + ]. create_chroot_script(Arch) --> build_dir #? Dir, @@ -424,24 +421,41 @@ ], { site_conf_dir(Conf) }. -into_build_dir(Runnable > File) --> - build_dir #? Dir, - commands #+ [ - Runnable > Dir+/+File - ]. - -into_build_dir(Runnable >> File) --> - build_dir #? Dir, - commands #+ [ - Runnable > Dir+/+File - ]. - get_portage_timestamp(variable(portage_timestamp)) --> { script_dir(Script) }, commands #+ [ run_outvar([Script +/+ portage_timestamp, '/usr/portage'], portage_timestamp) ]. + +% TODO make gentoo stage target from this +create_gentoo_builddir(Name, Dir) --> + {gentoo_stage(Name, ArchName, _)}, + download_gentoo_stage(Tarball, Name), + prepend([comment('prepare build directory') + ,run([mkdir, '-p' + ,Dir +/+ 'usr/portage' + ,Dir +/+ 'var/portage/ccache' + ,Dir +/+ 'var/portage/packages' + ]) + ]), + unpack_tarball(Tarball, Dir), + create_chroot_script(Dir, ArchName), + {work_dir(Work), site_conf_dir(Conf)}, + [run([rsync, '-a', Work +/+ 'overlay/' + , Dir +/+ 'var/portage/ccx-autobuild' + ]), + run([rsync, '-a', Conf +/+ 'gentoo_scripts/' + , Dir +/+ 'root/prosys/' + ]), + run([rsync, '-a', Conf +/+ 'portage/' + , Dir +/+ 'etc/portage/' + ]), + comment('configure local settings') + ], + set_timezone(Dir, 'Europe/Prague'), + set_locale(Dir, 'en_US.UTF-8'). + gentoo_create_pkgdir(Name, Dir) --> {package_dir(PkgDir)}, [comment('prepare binpkg directory'), @@ -714,72 +728,10 @@ % ]), % gentoo_build_stage4(Name, Dir). -% TODO make gentoo stage target from this -%create_gentoo_builddir(Name, Dir) --> -% {gentoo_stage(Name, ArchName, _)}, -% download_gentoo_stage(Tarball, Name), -% prepend([comment('prepare build directory') -% ,run([mkdir, '-p' -% ,Dir +/+ 'usr/portage' -% ,Dir +/+ 'var/portage/ccache' -% ,Dir +/+ 'var/portage/packages' -% ]) -% ]), -% unpack_tarball(Tarball, Dir), -% create_chroot_script(Dir, ArchName), -% {work_dir(Work), site_conf_dir(Conf)}, -% [run([rsync, '-a', Work +/+ 'overlay/' -% , Dir +/+ 'var/portage/ccx-autobuild' -% ]), -% run([rsync, '-a', Conf +/+ 'gentoo_scripts/' -% , Dir +/+ 'root/prosys/' -% ]), -% run([rsync, '-a', Conf +/+ 'portage/' -% , Dir +/+ 'etc/portage/' -% ]), -% comment('configure local settings') -% ], -% set_timezone(Dir, 'Europe/Prague'), -% set_locale(Dir, 'en_US.UTF-8'). - - -% gentoo stage tarballs -target(TargetName) --> - { gentoo_stage(StageName, Arch, Txt), - TargetName =: gentoo_stage3_ + StageName, - gentoo_mirror(Mirror), - script_dir(Scripts), work_dir(Work), downloads_dir(DownloadsDir) - }, - build_dir #= variable(build_dir), - commands #+ [ - build_dir = [Scripts+/+get_gentoo_stage, - Work+/+build+/+TargetName, - DownloadsDir+/+StageName, - Mirror +/+ releases +/+ Arch +/+ autobuilds +/+ Txt - ] - ], - create_chroot_script(Arch), - ( { stages_set_timezone(TimeZone) } - -> set_timezone(TimeZone) - ; { true } - ), - ( { stages_set_locale(Locale) } - -> set_locale(Locale) - ; { true } - ), - into_build_dir(echo(TargetName) >> 'root/prosys/stages_completed'). - -clone_stage --> - { script_dir(Scripts) }, - build_dir #? Src, - commands #+ [ - verbatim('if [[ -n "$1" ]]; then\n\t'), - [Scripts+/+snapshot_stage, Src, variable('1')], - verbatim('fi\n') - ]. % non-dcg variant of target, sets up parameters and calls dcg variant target(Name, Commands) :- + build_dir(BuildDir), list_to_assoc([ commands-[] ], AssocIn), phrase(target(Name), AssocIn, AssocOut), get_assoc(commands, AssocOut, Commands). @@ -807,4 +759,5 @@ print(Name), nl, cmds_print(Commands). -%main([Name]) :- main([Name, variable('1')]). +main([Name]) :- main([Name, variable('1')]). +