Commit 0573dbae authored by Ophélie Gagnard's avatar Ophélie Gagnard

Allow to use custom compilation template files.

parent a3e424de
...@@ -15,7 +15,7 @@ cd $INITIAL_DIR ...@@ -15,7 +15,7 @@ cd $INITIAL_DIR
mkdir -p $RUN_BUILDOUT_DIR mkdir -p $RUN_BUILDOUT_DIR
cd $RUN_BUILDOUT_DIR cd $RUN_BUILDOUT_DIR
# should be with gcc here and without in OBS # should be with gcc here and without in OBS
cp $COMPILATION_TEMPLATES_DIR/tmp/buildout_without_gcc.cfg buildout.cfg cp $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME/local_buildout.cfg buildout.cfg
## next line explained ## next line explained
# 1st cmd: bootstrap buildout (creates bin/buildout) # 1st cmd: bootstrap buildout (creates bin/buildout)
# 2nd cmd: backup bin/buildout (to be restored for OBS) # 2nd cmd: backup bin/buildout (to be restored for OBS)
......
...@@ -5,4 +5,4 @@ source build-scripts/configuration_information.sh ...@@ -5,4 +5,4 @@ source build-scripts/configuration_information.sh
cd $INITIAL_DIR cd $INITIAL_DIR
# Clean temporary directory for templates # Clean temporary directory for templates
rm -rf $COMPILATION_TEMPLATES_DIR/tmp/ rm -rf $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME
...@@ -4,8 +4,15 @@ set -e ...@@ -4,8 +4,15 @@ set -e
source build-scripts/configuration_information.sh source build-scripts/configuration_information.sh
cd $INITIAL_DIR cd $INITIAL_DIR
# Prepare the templates in $COMPILATION_TEMPLATES_DIR/tmp/ # Prepare the templates in $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME
mkdir -p $COMPILATION_TEMPLATES_DIR/tmp/ mkdir -p $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME
sed $ALL_REGEX $COMPILATION_TEMPLATES_DIR/buildout_with_gcc.cfg.in > $COMPILATION_TEMPLATES_DIR/tmp/buildout_with_gcc.cfg
sed $ALL_REGEX $COMPILATION_TEMPLATES_DIR/buildout_without_gcc.cfg.in > $COMPILATION_TEMPLATES_DIR/tmp/buildout_without_gcc.cfg # if a custom directory exist for compilation templates, choose it
sed $ALL_REGEX $COMPILATION_TEMPLATES_DIR/Makefile.in > $COMPILATION_TEMPLATES_DIR/tmp/Makefile # otherwise, default to .../_generic
ACTUAL_TEMPLATES_DIR=$COMPILATION_TEMPLATES_DIR/$SOFTWARE_NAME
if [ ! -d $ACTUAL_TEMPLATES_DIR ]; then
ACTUAL_TEMPLATES_DIR=$COMPILATION_TEMPLATES_DIR/_generic
fi
sed $ALL_REGEX $ACTUAL_TEMPLATES_DIR/local_buildout.cfg.in > $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME/local_buildout.cfg
sed $ALL_REGEX $ACTUAL_TEMPLATES_DIR/Makefile.in > $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME/Makefile
...@@ -33,7 +33,7 @@ TARBALL_DIR=$INITIAL_DIR/tarballs/$SOFTWARE_AND_VERSION ...@@ -33,7 +33,7 @@ TARBALL_DIR=$INITIAL_DIR/tarballs/$SOFTWARE_AND_VERSION
#SR_PATH=$TARBALL_DIR/software_release/component/$SOFTWARE_NAME/buildout.cfg #SR_PATH=$TARBALL_DIR/software_release/component/$SOFTWARE_NAME/buildout.cfg
SR_PATH=$TARBALL_DIR/software_release/software/$SOFTWARE_NAME/software.cfg SR_PATH=$TARBALL_DIR/software_release/software/$SOFTWARE_NAME/software.cfg
COMPILATION_TEMPLATES_DIR=$INITIAL_DIR/templates/compilation-templates COMPILATION_TEMPLATES_DIR=$INITIAL_DIR/templates/compilation-templates/
# BUILD_DIR was formerly BUILD_ROOT_DIRECTORY # BUILD_DIR was formerly BUILD_ROOT_DIRECTORY
BUILD_DIR=$TARBALL_DIR/build/ BUILD_DIR=$TARBALL_DIR/build/
# RUN_BUILDOUT_DIR is where the parts/ directory will be ; formerly BUILD_DIRECTORY # RUN_BUILDOUT_DIR is where the parts/ directory will be ; formerly BUILD_DIRECTORY
......
...@@ -9,9 +9,9 @@ TMP_DIR=`realpath -m $TMP_DIR` ...@@ -9,9 +9,9 @@ TMP_DIR=`realpath -m $TMP_DIR`
echo TMP_DIR = $TMP_DIR echo TMP_DIR = $TMP_DIR
# copy the Makefile at the root of the tarball # copy the Makefile at the root of the tarball
cp $COMPILATION_TEMPLATES_DIR/tmp/Makefile $TARBALL_DIR/Makefile cp $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME/Makefile $TARBALL_DIR/Makefile
# save the local TARBALL_DIR to replace it with the TARBALL_DIR of OBS' VM # save the local TARBALL_DIR to replace it with the TARBALL_DIR of OBS' VM
echo $TARBALL_DIR > $TARBALL_DIR/cache_creation_build_directory echo $TARBALL_DIR > $TARBALL_DIR/local_build_directory
# restore bin/buildout # restore bin/buildout
# note: when installing python, buildout "rebootstrap" itself to use the installed python: it would fail on OBS' VM # note: when installing python, buildout "rebootstrap" itself to use the installed python: it would fail on OBS' VM
mv $RUN_BUILDOUT_DIR/bin/backup.buildout $RUN_BUILDOUT_DIR/bin/buildout mv $RUN_BUILDOUT_DIR/bin/backup.buildout $RUN_BUILDOUT_DIR/bin/buildout
......
...@@ -13,7 +13,7 @@ INSTALL_DIR = $(DESTDIR)$(TARGET_DIR) ...@@ -13,7 +13,7 @@ INSTALL_DIR = $(DESTDIR)$(TARGET_DIR)
RUN_BUILDOUT_DIR = $(BUILD_DIR)$(TARGET_DIR) RUN_BUILDOUT_DIR = $(BUILD_DIR)$(TARGET_DIR)
#PATCHES_DIR := $(shell pwd)/patches #PATCHES_DIR := $(shell pwd)/patches
# get the path of the BUILD_DIR of the first build (performed to prepare the cache for OBS) # get the path of the BUILD_DIR of the first build (performed to prepare the cache for OBS)
OLD_TARBALL_DIR := $(shell cat cache_creation_build_directory) OLD_TARBALL_DIR := $(shell cat local_build_directory)
#Use to get path of buildout correct #Use to get path of buildout correct
#ORIGINAL_DIRECTORY := $(shell cat ./original_directory) #ORIGINAL_DIRECTORY := $(shell cat ./original_directory)
......
...@@ -4,10 +4,6 @@ destdir = %BUILD_DIR% ...@@ -4,10 +4,6 @@ destdir = %BUILD_DIR%
builddir = %RUN_BUILDOUT_DIR% builddir = %RUN_BUILDOUT_DIR%
extends = extends =
%SR_PATH% %SR_PATH%
# %BUILD_DIR%/../software_release/software/fluent-bit/software.cfg
# %TARBALL_DIR%/software_release/software/fluent-bit/software.cfg
# %TARBALL_DIR%/software_release/component/fluent-bit/buildout.cfg
# %BUILD_DIR%/../software_release/component/fluent-bit/buildout.cfg
versions = versions versions = versions
extends-cache = extends-cache extends-cache = extends-cache
download-cache = download-cache download-cache = download-cache
......
PY = $(PYTHON)
#INSTALL_DIR = $(DESTDIR)/opt/test
#TARGET_DIR = /opt/slapos
# This templates are replaced by build-scripts/template_stage.sh
# according to the values and regular expressions defined in
# build-scripts/configuration_information.sh
# The variable TARGET_DIR is pretty useless atm
TARGET_DIR = %TARGET_DIR%
TARBALL_DIR = $(shell pwd)
BUILD_DIR = $(TARBALL_DIR)/build
INSTALL_DIR = $(DESTDIR)$(TARGET_DIR)
RUN_BUILDOUT_DIR = $(BUILD_DIR)$(TARGET_DIR)
#PATCHES_DIR := $(shell pwd)/patches
# get the path of the BUILD_DIR of the first build (performed to prepare the cache for OBS)
OLD_TARBALL_DIR := $(shell cat local_build_directory)
#Use to get path of buildout correct
#ORIGINAL_DIRECTORY := $(shell cat ./original_directory)
all: build
build: build-stamp
build-stamp:
@echo "Fixing buildout path to $(TARBALL_DIR) rather than $(OLD_TARBALL_DIR) for buildout"
################################################################################
# grep -rIl '$(OLD_DIRECTORY)' $(BUILD_DIR) 2> /dev/null | \
# xargs sed -i 's#$(OLD_DIRECTORY)#$(BUILD_DIR)#g' || \
# echo "No path to fix."
################################################################################
ls -l $(RUN_BUILDOUT_DIR) # DEBUG
ls -l $(RUN_BUILDOUT_DIR)/bin/ # DEBUG
cd $(RUN_BUILDOUT_DIR); sed -i 's#$(OLD_TARBALL_DIR)#$(TARBALL_DIR)#g' buildout.cfg bin/*
echo RUN_BUILDOUT_DIR = $(RUN_BUILDOUT_DIR) \; PY = $(PY)
cd $(RUN_BUILDOUT_DIR) && \
$(PY) ./bin/buildout -v
@touch build-stamp
clean:
# TODO: implement a proper cleaning
#rm -rf $(BUILD_DIR)
rm -f *-stamp
install: all
#cd slapos; make install
mkdir -p $(INSTALL_DIR)/bin
mkdir -p $(INSTALL_DIR)/share/
#cp `find $(RUN_BUILDOUT_DIR) | grep -e "^$(RUN_BUILDOUT_DIR)/[^/][^/]*/bin/*` $(DESTDIR)/usr/bin/
-cp -r $(RUN_BUILDOUT_DIR)/parts/fluent-bit/bin/* $(INSTALL_DIR)/bin/
-cp -r $(RUN_BUILDOUT_DIR)/parts/fluent-bit/share/* $(INSTALL_DIR)/share/
ls -Rl $(INSTALL_DIR)/bin/ # DEBUG
.PHONY: build all clean install
...@@ -4,18 +4,10 @@ destdir = %BUILD_DIR% ...@@ -4,18 +4,10 @@ destdir = %BUILD_DIR%
builddir = %RUN_BUILDOUT_DIR% builddir = %RUN_BUILDOUT_DIR%
extends = extends =
%SR_PATH% %SR_PATH%
# %BUILD_DIR%/../software_release/software/fluent-bit/software.cfg
# %TARBALL_DIR%/software_release/software/fluent-bit/software.cfg
# %TARBALL_DIR%/software_release/component/fluent-bit/buildout.cfg
# %BUILD_DIR%/../software_release/component/fluent-bit/buildout.cfg
versions = versions versions = versions
extends-cache = extends-cache extends-cache = extends-cache
download-cache = download-cache download-cache = download-cache
[gcc]
# force usage of gcc from slapos to have it in the cache
max_version = 0
[versions] [versions]
setuptools = 44.1.1 setuptools = 44.1.1
# Use SlapOS patched zc.buildout # Use SlapOS patched zc.buildout
......
PY = $(PYTHON)
#INSTALL_DIR = $(DESTDIR)/opt/test
#TARGET_DIR = /opt/slapos
# This templates are replaced by build-scripts/template_stage.sh
# according to the values and regular expressions defined in
# build-scripts/configuration_information.sh
# The variable TARGET_DIR is pretty useless atm
TARGET_DIR = %TARGET_DIR%
TARBALL_DIR = $(shell pwd)
BUILD_DIR = $(TARBALL_DIR)/build
INSTALL_DIR = $(DESTDIR)$(TARGET_DIR)
RUN_BUILDOUT_DIR = $(BUILD_DIR)$(TARGET_DIR)
#PATCHES_DIR := $(shell pwd)/patches
# get the path of the BUILD_DIR of the first build (performed to prepare the cache for OBS)
OLD_TARBALL_DIR := $(shell cat local_build_directory)
#Use to get path of buildout correct
#ORIGINAL_DIRECTORY := $(shell cat ./original_directory)
all: build
build: build-stamp
build-stamp:
@echo "Fixing buildout path to $(TARBALL_DIR) rather than $(OLD_TARBALL_DIR) for buildout"
################################################################################
# grep -rIl '$(OLD_DIRECTORY)' $(BUILD_DIR) 2> /dev/null | \
# xargs sed -i 's#$(OLD_DIRECTORY)#$(BUILD_DIR)#g' || \
# echo "No path to fix."
################################################################################
ls -l $(RUN_BUILDOUT_DIR) # DEBUG
ls -l $(RUN_BUILDOUT_DIR)/bin/ # DEBUG
cd $(RUN_BUILDOUT_DIR); sed -i 's#$(OLD_TARBALL_DIR)#$(TARBALL_DIR)#g' buildout.cfg bin/*
echo RUN_BUILDOUT_DIR = $(RUN_BUILDOUT_DIR) \; PY = $(PY)
cd $(RUN_BUILDOUT_DIR) && \
$(PY) ./bin/buildout -v
@touch build-stamp
clean:
# TODO: implement a proper cleaning
#rm -rf $(BUILD_DIR)
rm -f *-stamp
install: all
#cd slapos; make install
mkdir -p $(INSTALL_DIR)/bin
mkdir -p $(INSTALL_DIR)/etc/
mkdir -p $(INSTALL_DIR)/lib/
mkdir -p $(INSTALL_DIR)/share/
#cp `find $(RUN_BUILDOUT_DIR) | grep -e "^$(RUN_BUILDOUT_DIR)/[^/][^/]*/bin/*` $(DESTDIR)/usr/bin/
-cp -r $(RUN_BUILDOUT_DIR)/parts/mca/bin/* $(INSTALL_DIR)/bin/
-cp -r $(RUN_BUILDOUT_DIR)/parts/mca/etc/* $(INSTALL_DIR)/etc/
-cp -r $(RUN_BUILDOUT_DIR)/parts/{mca,openssl}/lib/* $(INSTALL_DIR)/lib/
-cp -r $(RUN_BUILDOUT_DIR)/parts/{mca,openssl}/share/* $(INSTALL_DIR)/share/
ls -Rl $(INSTALL_DIR)/bin/ # DEBUG
.PHONY: build all clean install
[buildout]
rootdir = %TARGET_DIR%
destdir = %BUILD_DIR%
builddir = %RUN_BUILDOUT_DIR%
extends =
%SR_PATH%
versions = versions
extends-cache = extends-cache
download-cache = download-cache
[versions]
setuptools = 44.1.1
# Use SlapOS patched zc.buildout
zc.buildout = 2.7.1+slapos016
# Use SlapOS patched zc.recipe.egg (zc.recipe.egg 2.x is for Buildout 2)
zc.recipe.egg = 2.0.3+slapos003
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