Commit 8e498af3 by Tomáš Peterka Committed by Tomáš Peterka

[nayuos] Refactor build script as hinted by XXX comments

1 parent 182e5044
......@@ -96,7 +96,7 @@ context =
recipe = slapos.recipe.template:jinja2
template = {{ scripts_dir }}/cros_full_build.in
rendered = ${directory:run}/cros_full_build
md5sum = d015e62f327dc8b81ba4c5ea2b2f863e
md5sum = 2bb9dd83260ea96dd6a6602f6faa9794
mode = 0700
context =
key bash_path bin:bash
......
......@@ -35,6 +35,32 @@ function increase_revision_number() {
fi
}
function insert_packages_into_ebuild() {
# Insert packages (in form of "category/package") into RDEPEND part of ebuild.
# Optionally increasing version of given ebuild.
EBUILD=$1
changed=0
shift
while [ ! -z "$1" ]
do
package=$1
if [[ $( grep "${package}" "${EBUILD}" ) ]] ; then
echo "no need to change ${EBUILD} file to add ${package}..." >> "${BUILD_LOG}"
else
printf "\n\nRDEPEND=\"\${RDEPEND}\n ${package}\"\n">> ${EBUILD}
changed=1
fi
shift
done;
if [ $changed -eq 1 ]
then
# if we inserted at least one package then increase the version to be sure
# it gets selected in case of more overlays with the same package
increase_revision_number $(dirname $EBUILD)
fi
}
######################## Download of sources using the "repo" command ########################
DL_LOG="{{ instance_log_dir }}/cros_sources_dl.log"
BRANCH="{{ branch }}"
......@@ -95,38 +121,24 @@ done
install -m 770 "{{ scripts_dir }}/test_nayuos_image" "{{ cros_location }}/{{ branch }}/src/scripts/test_nayuos_image"
### packages management ###
VIRTUAL_CHROMEOS_OS_DEV_EBUILD=${CHROMIUM_OVERLAY}/virtual/target-chromium-os-dev/target-chromium-os-dev-1.ebuild
VIRTUAL_CHROMEOS_DEV_ROOTFS_EBUILD=${CHROMIUM_OVERLAY}/chromeos-base/chromeos-dev-root/chromeos-dev-root-0.0.1.ebuild
# change the virtual ebuild responsible for installing all packages to add the ones
# needed for NayuOS
for package in {{ nayu_dev_packages }} ; do
echo $package
if [[ $( grep "${package}" "${VIRTUAL_CHROMEOS_OS_DEV_EBUILD}" ) ]] ; then
echo "no need to change ${VIRTUAL_CHROMEOS_OS_DEV_EBUILD} file to add ${package}..." >> "${BUILD_LOG}"
else
printf "\n\nRDEPEND=\"\${RDEPEND}\n ${package}\"\n">> ${VIRTUAL_CHROMEOS_OS_DEV_EBUILD}
fi
done
# XXX: create a function for this
for package in {{ nayu_dev_rootfs_packages }} ; do
echo $package
if [[ $( grep "${package}" "${VIRTUAL_CHROMEOS_DEV_ROOTFS_EBUILD}" ) ]] ; then
echo "no need to change ${VIRTUAL_CHROMEOS_DEV_ROOTFS_EBUILD} file to add ${package}..." >> "${BUILD_LOG}"
else
printf "\n\nRDEPEND=\"\${RDEPEND}\n ${package}\"\n">> ${VIRTUAL_CHROMEOS_DEV_ROOTFS_EBUILD}
fi
done
# make virtual ebuild responsible for installing all packages dependent on NayuOS own packages
insert_packages_into_ebuild \
${CHROMIUM_OVERLAY}/virtual/target-chromium-os-dev/target-chromium-os-dev-1.ebuild \
{{ nayu_dev_packages }}
# insert policies into /etc/chromium/policies/recommended with NayuOS customizations
insert_packages_into_ebuild \
${CHROMIUM_OVERLAY}/chromeos-base/chromeos-dev-root/chromeos-dev-root-0.0.1.ebuild \
{{ nayu_dev_rootfs_packages }}
increase_revision_number ${CHROMIUM_OVERLAY}/virtual/target-chromium-os-dev
increase_revision_number ${CHROMIUM_OVERLAY}/chromeos-base/chromeos-dev-root
# do not install the Upstart init script that starts ssh daemon at boot time
rm ${CHROMIUM_OVERLAY}/chromeos-base/chromeos-sshd-init/files/openssh-server.conf
# strip away the src_install part because it only sets up booting scripts
sed -i -n '/src_install/q;p' ${CHROMIUM_OVERLAY}/chromeos-base/openssh-server-init/openssh-server-init-0.0.1.ebuild
sed -i -n '/src_install/q;p' ${CHROMIUM_OVERLAY}/chromeos-base/chromeos-sshd-init/chromeos-sshd-init-0.0.1.ebuild
# increase version in case of other overlays with the same packages
increase_revision_number ${CHROMIUM_OVERLAY}/chromeos-base/openssh-server-init/
increase_revision_number ${CHROMIUM_OVERLAY}/chromeos-base/chromeos-sshd-init/
......
......@@ -8,17 +8,20 @@ parts +=
slapos-cookbook
template-instance
versions = versions
[versions]
slapos.recipe.template = 3.0
[template-instance]
# create the instance.cfg file in the buildout directory
# (use jinja for templating)
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg
rendered = ${buildout:directory}/instance.cfg
md5sum = f4f1dcd506661a81a5c7e9f5123663a9
mode = 0644
md5sum = 085560ea84a5a7f633de0ef63a6ba7aa
scripts_dir = ${:_profile_base_location_}/scripts
logo_dir = ${:_profile_base_location_}/logo
curl_path = ${curl:location}/bin
......@@ -29,4 +32,5 @@ context =
key curl_path :curl_path
key git_path :git_path
key eggs_directory buildout:eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory
\ No newline at end of file
key develop_eggs_directory buildout:develop-eggs-directory
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!