Commit 8e498af3 authored by Tomáš Peterka's avatar Tomáš Peterka Committed by Tomáš Peterka

[nayuos] Refactor build script as hinted by XXX comments

parent 182e5044
...@@ -96,7 +96,7 @@ context = ...@@ -96,7 +96,7 @@ context =
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = {{ scripts_dir }}/cros_full_build.in template = {{ scripts_dir }}/cros_full_build.in
rendered = ${directory:run}/cros_full_build rendered = ${directory:run}/cros_full_build
md5sum = d015e62f327dc8b81ba4c5ea2b2f863e md5sum = 2bb9dd83260ea96dd6a6602f6faa9794
mode = 0700 mode = 0700
context = context =
key bash_path bin:bash key bash_path bin:bash
......
...@@ -35,6 +35,32 @@ function increase_revision_number() { ...@@ -35,6 +35,32 @@ function increase_revision_number() {
fi 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 ######################## ######################## Download of sources using the "repo" command ########################
DL_LOG="{{ instance_log_dir }}/cros_sources_dl.log" DL_LOG="{{ instance_log_dir }}/cros_sources_dl.log"
BRANCH="{{ branch }}" BRANCH="{{ branch }}"
...@@ -95,38 +121,24 @@ done ...@@ -95,38 +121,24 @@ done
install -m 770 "{{ scripts_dir }}/test_nayuos_image" "{{ cros_location }}/{{ branch }}/src/scripts/test_nayuos_image" install -m 770 "{{ scripts_dir }}/test_nayuos_image" "{{ cros_location }}/{{ branch }}/src/scripts/test_nayuos_image"
### packages management ### ### 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 # make virtual ebuild responsible for installing all packages dependent on NayuOS own packages
for package in {{ nayu_dev_rootfs_packages }} ; do insert_packages_into_ebuild \
echo $package ${CHROMIUM_OVERLAY}/virtual/target-chromium-os-dev/target-chromium-os-dev-1.ebuild \
if [[ $( grep "${package}" "${VIRTUAL_CHROMEOS_DEV_ROOTFS_EBUILD}" ) ]] ; then {{ nayu_dev_packages }}
echo "no need to change ${VIRTUAL_CHROMEOS_DEV_ROOTFS_EBUILD} file to add ${package}..." >> "${BUILD_LOG}"
else # insert policies into /etc/chromium/policies/recommended with NayuOS customizations
printf "\n\nRDEPEND=\"\${RDEPEND}\n ${package}\"\n">> ${VIRTUAL_CHROMEOS_DEV_ROOTFS_EBUILD} insert_packages_into_ebuild \
fi ${CHROMIUM_OVERLAY}/chromeos-base/chromeos-dev-root/chromeos-dev-root-0.0.1.ebuild \
done {{ 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 # 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 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/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 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/openssh-server-init/
increase_revision_number ${CHROMIUM_OVERLAY}/chromeos-base/chromeos-sshd-init/ increase_revision_number ${CHROMIUM_OVERLAY}/chromeos-base/chromeos-sshd-init/
......
...@@ -8,17 +8,20 @@ parts += ...@@ -8,17 +8,20 @@ parts +=
slapos-cookbook slapos-cookbook
template-instance template-instance
versions = versions
[versions] [versions]
slapos.recipe.template = 3.0 slapos.recipe.template = 3.0
[template-instance] [template-instance]
# create the instance.cfg file in the buildout directory # create the instance.cfg file in the buildout directory
# (use jinja for templating) # (use jinja for templating)
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/instance.cfg template = ${:_profile_base_location_}/instance.cfg
rendered = ${buildout:directory}/instance.cfg rendered = ${buildout:directory}/instance.cfg
md5sum = f4f1dcd506661a81a5c7e9f5123663a9
mode = 0644 mode = 0644
md5sum = 085560ea84a5a7f633de0ef63a6ba7aa
scripts_dir = ${:_profile_base_location_}/scripts scripts_dir = ${:_profile_base_location_}/scripts
logo_dir = ${:_profile_base_location_}/logo logo_dir = ${:_profile_base_location_}/logo
curl_path = ${curl:location}/bin curl_path = ${curl:location}/bin
...@@ -29,4 +32,5 @@ context = ...@@ -29,4 +32,5 @@ context =
key curl_path :curl_path key curl_path :curl_path
key git_path :git_path key git_path :git_path
key eggs_directory buildout:eggs-directory key eggs_directory buildout:eggs-directory
key develop_eggs_directory buildout:develop-eggs-directory key develop_eggs_directory buildout:develop-eggs-directory
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment