Commit e40efa8b authored by Ophélie Gagnard's avatar Ophélie Gagnard

Improve variables (slight refactoring).

templates/*: Improve the templates system: It is no longer needed to modify the templates to build another SR.
templates/Makefile.in: Improve the target management.
build-scripts/*: Add new variables and improve the genericization.
parent ce584340
......@@ -5,12 +5,14 @@ source build-scripts/configuration_information.sh
cd $INITIAL_DIR
# Download the bootstrap script
mkdir -p $RUN_BUILDOUT_DIR
cd $RUN_BUILDOUT_DIR
wget https://bootstrap.pypa.io/bootstrap-buildout.py
cd $INITIAL_DIR
# Create a build/bin/buildout (bootstraping) and run it (actual compilation).
# Note: it creates a lot of things in build/eggs/ and uses software_release/ at some point
mkdir -p $RUN_BUILDOUT_DIR
cd $RUN_BUILDOUT_DIR
# should be with gcc here and without in OBS
cp $TEMPLATE_DIR/tmp/buildout_without_gcc.cfg buildout.cfg
......
......@@ -4,16 +4,13 @@ set -e
source build-scripts/configuration_information.sh
cd $INITIAL_DIR
rm -rf tarballs/$SOFTWARE/
rm -rf $TARBALL_DIR
exit # TODO: separate the tree building from the software release retrieving
cd $INITIAL_DIR
# Clean the software release to pack
if [[ -d tarballs/$SOFTWARE/ ]]; then
cd tarballs/$SOFTWARE/
rm -rf software_release
else echo tarballs/$SOFTWARE/ does not exist.
rm -rf $TARBALL_DIR/software_release
cd $INITIAL_DIR
# Clean the build tree
......
......@@ -3,23 +3,30 @@
####################################################
INITIAL_DIR="$(pwd)"/
# Modify the following variables accordingly
# RELEASE INFORMATION
VERSION=1
RECIPE_VERSION=1
# Modify the following variables accordingly
VERSION=0
#RECIPE_VERSION=1
RELEASE=1
SOFTWARE=fluent-bit
SOFTWARE_NAME=fluent-bit
COMPOUND_VERSION=${VERSION}-${RELEASE}
VERSION_NAME=${SOFTWARE_NAME}_${COMPOUND_VERSION}
ARCHIVE_EXT=.tar.gz
# INSTALL INFORMATION
TARGET_DIR=/opt/${SOFTWARE}_software_release
TARGET_DIR=/opt/$VERSION_NAME # only used for the templates
# OBS AND DISTRIBUTIONS INFORMATION
OBS_DIR=$INITIAL_DIR/home:oph.nxd/$SOFTWARE/
DIST_DIR=$INITIAL_DIR/distribution-specifics/$SOFTWARE/
TARBALL_DIR=$INITIAL_DIR/tarballs/$SOFTWARE/
OBS_DIR=$INITIAL_DIR/home:oph.nxd/$SOFTWARE_NAME/
DIST_DIR=$INITIAL_DIR/distribution-specifics/$SOFTWARE_NAME/
TARBALL_DIR=$INITIAL_DIR/tarballs/$VERSION_NAME
# BUILD INFORMATION
# Modify the following variables accordingly
SR_PATH=$TARBALL_DIR/software_release/component/lunzip/buildout.cfg
TEMPLATE_DIR=$INITIAL_DIR/templates
BUILD_DIR=$TARBALL_DIR/build/ # former BUILD_ROOT_DIRECTORY
# this is where the parts/ directory will be
......@@ -37,11 +44,13 @@ BUILD_DIR=`realpath -m $BUILD_DIR`
RUN_BUILDOUT_DIR=`realpath -m $RUN_BUILDOUT_DIR`
# Regular expressions for templates
VERSION_REGEX="s/\%RECIPE_VERSION\%/$RECIPE_VERSION/g;s/\%VERSION\%/$VERSION/g;s/\%RELEASE\%/$RELEASE/g"
# versions (not used at the moment)
VERSION_REGEX="s|\%RECIPE_VERSION\%|$RECIPE_VERSION|g;s|\%VERSION\%|$VERSION|g;s|\%RELEASE\%|$RELEASE|g;s|\%COMPOUND_VERSION\%|$COMPOUND_VERSION|g"
# Note: %PATCHES_DIRECTORY% not supported yet
# supporting new macros
DIR_REGEX="s|\%TARGET_DIR\%|$TARGET_DIR|g;s|\%BUILD_DIR\%|$BUILD_DIR|g;s|\%RUN_BUILDOUT_DIR\%|$RUN_BUILDOUT_DIR|g"
# supporting legacy macros
OLD_DIR_REGEX="s|\%TARGET_DIRECTORY\%|$TARGET_DIR|g;s|\%BUILD_ROOT_DIRECTORY\%|$BUILD_DIR|g;s|\%BUILD_DIRECTORY\%|$RUN_BUILDOUT_DIR|g"
# directories (supporting new macros)
DIR_REGEX="s|\%TARGET_DIR\%|$TARGET_DIR|g;s|\%BUILD_DIR\%|$BUILD_DIR#g;s|\%RUN_BUILDOUT_DIR\%|$RUN_BUILDOUT_DIR|g"
PATH_REGEX="s|\%SR_PATH\%|$SR_PATH|g"
# directories (supporting legacy macros, not used anymore)
#OLD_DIR_REGEX="s|\%TARGET_DIRECTORY\%|$TARGET_DIR|g;s|\%BUILD_ROOT_DIRECTORY\%|$BUILD_DIR|g;s|\%BUILD_DIRECTORY\%|$RUN_BUILDOUT_DIR|g"
# concatenate all regex using ; (quoted, not to end the command)
ALL_REGEX=$VERSION_REGEX";"$DIR_REGEX";"$OLD_DIR_REGEX
ALL_REGEX=$VERSION_REGEX";"$DIR_REGEX";"$SR_PATH #";"$OLD_DIR_REGEX
......@@ -9,9 +9,9 @@ TMP_DIR=`realpath -m $TMP_DIR`
echo TMP_DIR = $TMP_DIR
# copy the Makefile at the root of the tarball
cp $TEMPLATE_DIR/tmp/Makefile tarballs/$SOFTWARE/Makefile
#cp $TEMPLATE_DIR/tmp/Makefile $TARBALL_DIR/Makefile
# save the local BUILD_DIR to replace it with the BUILD_DIR of OBS' VM
echo $BUILD_DIR > tarballs/$SOFTWARE/cache_creation_build_directory
echo $BUILD_DIR > $TARBALL_DIR/cache_creation_build_directory
# clean the parts directory
rm -rf $RUN_BUILDOUT_DIR/{.installed.cfg,parts/}
......@@ -19,11 +19,11 @@ rm -rf $RUN_BUILDOUT_DIR/{.installed.cfg,parts/}
## prepare the files for OBS
mkdir -p $TMP_DIR
# -C option allows to give tar an absolute path without archiving the directory from / (i.e. home/user/[...])
tar czf $TMP_DIR/$SOFTWARE.tar.gz -C tarballs/ $SOFTWARE/
tar czf $TMP_DIR/${VERSION_NAME}${ARCHIVE_EXT} -C $INITIAL_DIR/tarballs/ $VERSION_NAME/
tar czf $TMP_DIR/debian.tar.gz -C $DIST_DIR/ debian/
cp $DIST_DIR/*.dsc $TMP_DIR/
# move the files for OBS
cp $TMP_DIR/$SOFTWARE.tar.gz $OBS_DIR
cp $TMP_DIR/${VERSION_NAME}${ARCHIVE_EXT} $OBS_DIR
cp $TMP_DIR/debian.tar.gz $OBS_DIR
cp $TMP_DIR/*.dsc $OBS_DIR
......
VERSION = 1
RECIPE_VERSION = 1
PY = $(PYTHON)
#INSTALL_DIRECTORY = $(DESTDIR)/opt/test
#TARGET_DIRECTORY = /opt/slapos
#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
TARGET_DIRECTORY = %TARGET_DIR%
TARGET_DIR = %TARGET_DIR% # this variable is pretty useless atm
BUILD_DIR = $(shell pwd)/build
RUN_BUILDOUT_DIR = $(BUILD_DIR)$(TARGET_DIRECTORY)
#PATCHES_DIRECTORY := $(shell pwd)/patches
INSTALL_DIR = $(BUILD_DIR)$(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_BUILD_DIR := $(shell cat cache_creation_build_directory)
......@@ -42,18 +40,16 @@ clean:
install: all
#cd slapos; make install
mkdir -p $(DESTDIR)/usr/bin/
mkdir -p $(DESTDIR)/usr/sbin/
mkdir -p $(DESTDIR)/usr/etc/
mkdir -p $(DESTDIR)/usr/lib/
mkdir -p $(DESTDIR)/usr/share/
mkdir -p $(DESTDIR)/opt
mkdir -p $(INSTALL_DIR)/bin
mkdir -p $(INSTALL_DIR)/sbin/
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/*/bin/* $(DESTDIR)/usr/bin/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/sbin/* $(DESTDIR)/usr/sbin/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/etc/* $(DESTDIR)/usr/etc/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/lib/* $(DESTDIR)/usr/lib/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/share/* $(DESTDIR)/usr/share/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/opt/* $(DESTDIR)/opt
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/bin/* $(INSTALL_DIR)/bin/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/sbin/* $(INSTALL_DIR)/sbin/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/etc/* $(INSTALL_DIR)/etc/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/lib/* $(INSTALL_DIR)/lib/
-cp -r $(RUN_BUILDOUT_DIR)/parts/*/share/* $(INSTALL_DIR)/share/
.PHONY: build all clean install
[buildout]
rootdir = %TARGET_DIR%
destdir = %BUILD_DIR%
builddir = %PARTS_DIR%
destdir = %BUILD_DIR%
builddir = %RUN_BUILDOUT_DIR%
extends =
%SR_PATH%
# %BUILD_DIR%/../software_release/software/fluent-bit/software.cfg
%BUILD_DIR%/../software_release/component/fluent-bit/buildout.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
extends-cache = extends-cache
download-cache = download-cache
......
[buildout]
rootdir = %TARGET_DIR%
destdir = %BUILD_DIR%
builddir = %PARTS_DIRY%
builddir = %RUN_BUILDOUT_DIR%
extends =
%SR_PATH%
# %BUILD_DIR%/../software_release/software/fluent-bit/software.cfg
%BUILD_DIR%/../software_release/component/fluent-bit/buildout.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
extends-cache = extends-cache
download-cache = download-cache
......
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