Commit 9a865fb6 authored by Ophélie Gagnard's avatar Ophélie Gagnard

obs/generic/: Generate the debian files automatically from templates.

templates/: Split into compilation templates and distribution files templates.

distribution-specifics/:
- Remove mca, lunzip and fluent-bit files: they should be generated the same way.
- Add examples files.

build-scripts/:
- Add some variables.
- Add a script for the distribution files.

Makefile:
- Add a stage for distribution files.
- Add a build target: no distrib files generation, no obs.

Warning: General targets tested with lunzip. Reversibility with clean_* untested.
parent 31c71fd2
all: no_obs obs all: build distrib_files obs
clean: clean_no_obs clean_obs clean: clean_build clean_distrib_files clean_obs
no_obs: build_tree template_stage bootstrap_buildout build: build_tree compilation_templates bootstrap_buildout
clean_no_obs: clean_build_tree clean_template_stage clean_bootstrap_buildout clean_build: clean_build_tree clean_compilation_templates clean_bootstrap_buildout
no-obs: build distrib_files
clean_no-obs: clean_build clean_distrib_files
build_tree: build_tree:
build-scripts/build_tree.sh build-scripts/build_tree.sh
clean_build_tree: clean_build_tree:
build-scripts/clean_build_tree.sh build-scripts/clean_build_tree.sh
template_stage: compilation_templates:
build-scripts/template_stage.sh build-scripts/compilation_templates.sh
clean_template_stage: clean_compilation_templates:
build-scripts/clean_template_stage.sh build-scripts/clean_compilation_templates.sh
bootstrap_buildout: bootstrap_buildout:
build-scripts/bootstrap_buildout.sh build-scripts/bootstrap_buildout.sh
clean_bootstrap_buildout: clean_bootstrap_buildout:
build-scripts/clean_bootstrap_buildout.sh build-scripts/clean_bootstrap_buildout.sh
distrib_files:
build-scripts/distrib_files.sh
clean_distrib_files:
build-scripts/clean_distrib_files.sh
obs: obs:
build-scripts/obs.sh build-scripts/obs.sh
clean_obs: clean_obs:
build-scripts/clean_obs.sh build-scripts/clean_obs.sh
.PHONY: all clean no_obs clean_no_obs build_tree clean_build_tree template_stage clean_template_stage bootstrap_buildout clean_bootstrap_buildout obs clean_obs .PHONY: all clean build clean_build build_tree clean_build_tree compilation_templates clean_compilation_templates bootstrap_buildout clean_bootstrap_buildout distrib_files clean_distrib_files obs clean_obs
...@@ -15,10 +15,10 @@ cd $INITIAL_DIR ...@@ -15,10 +15,10 @@ 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 $TEMPLATE_DIR/tmp/buildout_without_gcc.cfg buildout.cfg cp $COMPILATION_TEMPLATES_DIR/tmp/buildout_without_gcc.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)
# 3rd cmd: run buildout (which apparently modifies itself) # 3rd cmd: run buildout (which apparently modifies itself)
(python2.7 -S bootstrap-buildout.py --buildout-version 2.7.1+slapos016 --setuptools-version 44.1.1 --setuptools-to-dir eggs -f http://www.nexedi.org/static/packages/source/slapos.buildout/ && cp bin/buildout bin/backup.buildout && ./bin/buildout -v) (python2.7 -S bootstrap-buildout.py --buildout-version 2.7.1+slapos016 --setuptools-version 44.1.1 --setuptools-to-dir eggs -f http://www.nexedi.org/static/packages/source/slapos.buildout/ && cp bin/buildout bin/backup.buildout && ./bin/buildout -v)
#cp $TEMPLATE_DIR/tmp/buildout_with_gcc.cfg buildout.cfg #cp $COMPILATION_TEMPLATES_DIR/tmp/buildout_with_gcc.cfg buildout.cfg
...@@ -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 $TEMPLATE_DIR/tmp/ rm -rf $COMPILATION_TEMPLATES_DIR/tmp/
#!/bin/bash
set -e
source build-scripts/configuration_information.sh
cd $INITIAL_DIR
# Clean temporary directory for templates
rm -rf $DISTRIB_TEMPLATES_DIR/tmp/
rm -rf $DISTRIB_FILES_DIR
#!/bin/bash
set -e
source build-scripts/configuration_information.sh
cd $INITIAL_DIR
# Prepare the templates in $COMPILATION_TEMPLATES_DIR/tmp/
mkdir -p $COMPILATION_TEMPLATES_DIR/tmp/
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
sed $ALL_REGEX $COMPILATION_TEMPLATES_DIR/Makefile.in > $COMPILATION_TEMPLATES_DIR/tmp/Makefile
...@@ -9,7 +9,7 @@ INITIAL_DIR="$(pwd)"/ ...@@ -9,7 +9,7 @@ INITIAL_DIR="$(pwd)"/
SOFTWARE_VERSION=1 SOFTWARE_VERSION=1
#RECIPE_VERSION=1 #RECIPE_VERSION=1
DEBIAN_REVISION=1 DEBIAN_REVISION=1
SOFTWARE_NAME=mca SOFTWARE_NAME=example
# For the version format, see: https://www.debian.org/doc/manuals/debian-faq/pkg-basics.en.html#pkgname # For the version format, see: https://www.debian.org/doc/manuals/debian-faq/pkg-basics.en.html#pkgname
# here, in <foo>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb # here, in <foo>_<VersionNumber>-<DebianRevisionNumber>_<DebianArchitecture>.deb
...@@ -33,11 +33,13 @@ TARBALL_DIR=$INITIAL_DIR/tarballs/$SOFTWARE_AND_VERSION ...@@ -33,11 +33,13 @@ 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
TEMPLATE_DIR=$INITIAL_DIR/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
RUN_BUILDOUT_DIR=$BUILD_DIR/$TARGET_DIR RUN_BUILDOUT_DIR=$BUILD_DIR/$TARGET_DIR
DISTRIB_TEMPLATES_DIR=$INITIAL_DIR/templates/default-distribution-templates
DISTRIB_FILES_DIR=$INITIAL_DIR/distribution-specifics/$SOFTWARE_NAME
# Path normalization # Path normalization
...@@ -47,9 +49,11 @@ OBS_DIR=`realpath -m $OBS_DIR` ...@@ -47,9 +49,11 @@ OBS_DIR=`realpath -m $OBS_DIR`
DIST_DIR=`realpath -m $DIST_DIR` DIST_DIR=`realpath -m $DIST_DIR`
TARBALL_DIR=`realpath -m $TARBALL_DIR` TARBALL_DIR=`realpath -m $TARBALL_DIR`
SR_PATH=`realpath -m $SR_PATH` SR_PATH=`realpath -m $SR_PATH`
TEMPLATE_DIR=`realpath -m $TEMPLATE_DIR` COMPILATION_TEMPLATES_DIR=`realpath -m $COMPILATION_TEMPLATES_DIR`
BUILD_DIR=`realpath -m $BUILD_DIR` BUILD_DIR=`realpath -m $BUILD_DIR`
RUN_BUILDOUT_DIR=`realpath -m $RUN_BUILDOUT_DIR` RUN_BUILDOUT_DIR=`realpath -m $RUN_BUILDOUT_DIR`
DISTRIB_TEMPLATES_DIR=`realpath -m $DISTRIB_TEMPLATES_DIR`
DISTRIB_FILES_DIR=`realpath -m $DISTRIB_FILES_DIR`
## Regular expressions for templates ## Regular expressions for templates
NAME_REGEX="s|%SOFTWARE_NAME%|$SOFTWARE_NAME|g" NAME_REGEX="s|%SOFTWARE_NAME%|$SOFTWARE_NAME|g"
......
#!/bin/bash
set -e
source build-scripts/configuration_information.sh
cd $INITIAL_DIR
# Prepare the templates in $DISTRIB_TEMPLATES_DIR/tmp/
mkdir -p $DISTRIB_TEMPLATES_DIR/tmp/debian/
sed $ALL_REGEX $DISTRIB_TEMPLATES_DIR/default.dsc.in > $DISTRIB_TEMPLATES_DIR/tmp/$SOFTWARE_AND_VERSION.dsc
# debian directory
sed $ALL_REGEX $DISTRIB_TEMPLATES_DIR/debian_default/changelog.in > $DISTRIB_TEMPLATES_DIR/tmp/debian/changelog
sed $ALL_REGEX $DISTRIB_TEMPLATES_DIR/debian_default/control.in > $DISTRIB_TEMPLATES_DIR/tmp/debian/control
sed $ALL_REGEX $DISTRIB_TEMPLATES_DIR/debian_default/dirs.in > $DISTRIB_TEMPLATES_DIR/tmp/debian/dirs
cp -r $DISTRIB_TEMPLATES_DIR/debian_default/{compat,copyright,rules,source} $DISTRIB_TEMPLATES_DIR/tmp/debian/
# TODO: do it with "find" instead?
#find $DISTRIB_TEMPLATES_DIR/debian_defaults/ -type f -name * -exec sed $ALL_REGEX {} + > $DISTRIB_TEMPLATES_DIR/tmp/debian/
mkdir -p $INITIAL_DIR/distribution-specifics/$SOFTWARE_NAME/
cp -r $DISTRIB_TEMPLATES_DIR/tmp/* $DISTRIB_FILES_DIR/
...@@ -9,7 +9,7 @@ TMP_DIR=`realpath -m $TMP_DIR` ...@@ -9,7 +9,7 @@ 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 $TEMPLATE_DIR/tmp/Makefile $TARBALL_DIR/Makefile cp $COMPILATION_TEMPLATES_DIR/tmp/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/cache_creation_build_directory
# restore bin/buildout # restore bin/buildout
......
#!/bin/bash
set -e
source build-scripts/configuration_information.sh
cd $INITIAL_DIR
# Prepare the templates in $TEMPLATE_DIR/tmp/
mkdir -p $TEMPLATE_DIR/tmp/
sed $ALL_REGEX $TEMPLATE_DIR/buildout_with_gcc.cfg.in > $TEMPLATE_DIR/tmp/buildout_with_gcc.cfg
sed $ALL_REGEX $TEMPLATE_DIR/buildout_without_gcc.cfg.in > $TEMPLATE_DIR/tmp/buildout_without_gcc.cfg
sed $ALL_REGEX $TEMPLATE_DIR/Makefile.in > $TEMPLATE_DIR/tmp/Makefile
lunzip (1-1) UNRELEASED; urgency=medium example (1-1) UNRELEASED; urgency=medium
* Initial release. (Closes: #XXXXXX) * Initial release. (Closes: #XXXXXX)
......
Source: mca Source: example
Maintainer: Francois Gagnard <francois.gagnard@nexedi.com> Maintainer: Francois Gagnard <francois.gagnard@nexedi.com>
Section: net Section: net
Priority: optional Priority: optional
...@@ -21,4 +21,4 @@ Depends: ${misc:Depends}, ...@@ -21,4 +21,4 @@ Depends: ${misc:Depends},
# devperm manager plugin wants to use lsblk # devperm manager plugin wants to use lsblk
util-linux util-linux
Conflicts: Conflicts:
Description: mca packaging test Description: example packaging test
/opt/example/bin/
/opt/example/lib/
/opt/example/etc/
Format: 3.0 (native) Format: 3.0 (native)
Source: mca Source: example
Architecture: any Architecture: any
Version: 1 Version: 1
Build-Depends: debhelper (>= 4.1.16), chrpath, po-debconf, wget, python (>= 2.7) Build-Depends: debhelper (>= 4.1.16), chrpath, po-debconf, wget, python (>= 2.7)
/opt/fluent-bit_1-1/bin/
/opt/fluent-bit_1-1/lib/
/opt/fluent-bit_1-1/etc/
/opt/lunzip_1-1/bin/
/opt/lunzip_1-1/lib/
/opt/lunzip_1-1/etc/
/opt/mca_1-1/bin/
/opt/mca_1-1/lib/
/opt/mca_1-1/etc/
fluent-bit (1-1) UNRELEASED; urgency=medium %SOFTWARE_NAME% (%COMPOUND_VERSION%) UNRELEASED; urgency=medium
* Initial release. (Closes: #XXXXXX) * Initial release. (Closes: #XXXXXX)
......
Source: fluent-bit Source: %SOFTWARE_NAME%
Maintainer: Francois Gagnard <francois.gagnard@nexedi.com> Maintainer: Francois Gagnard <francois.gagnard@nexedi.com>
Section: net Section: net
Priority: optional Priority: optional
Build-Depends: debhelper, Build-Depends: debhelper,
chrpath, chrpath,
python python
Homepage: https://slapos.nexedi.com
Package: fluent-bit Package: mca
Architecture: any Architecture: any
Depends: ${misc:Depends}, Depends: ${misc:Depends},
${shlibs:Depends}, ${shlibs:Depends},
...@@ -19,9 +18,7 @@ Depends: ${misc:Depends}, ...@@ -19,9 +18,7 @@ Depends: ${misc:Depends},
g++ | c++-compiler, g++ | c++-compiler,
make, make,
patch, patch,
# slapos node collect
lm-sensors,
# devperm manager plugin wants to use lsblk # devperm manager plugin wants to use lsblk
util-linux util-linux
Conflicts: Conflicts:
Description: fluent-bit packaging test Description: %SOFTWARE_NAME% packaging test
/opt/%SOFTWARE_NAME%/bin/
/opt/%SOFTWARE_NAME%/lib/
/opt/%SOFTWARE_NAME%/etc/
Format: 3.0 (native) Format: 3.0 (native)
Source: fluent-bit Source: %SOFTWARE_NAME%
Architecture: any Architecture: any
Version: 1 Version: %SOFTWARE_VERSION%
Build-Depends: debhelper (>= 4.1.16), chrpath, po-debconf, wget, python (>= 2.7), python-dev, libssl-dev Build-Depends: debhelper (>= 4.1.16), chrpath, po-debconf, wget, python (>= 2.7)
mca (1-1) UNRELEASED; urgency=medium example (1-1) UNRELEASED; urgency=medium
* Initial release. (Closes: #XXXXXX) * Initial release. (Closes: #XXXXXX)
......
Source: lunzip Source: example
Maintainer: Francois Gagnard <francois.gagnard@nexedi.com> Maintainer: Francois Gagnard <francois.gagnard@nexedi.com>
Section: net Section: net
Priority: optional Priority: optional
Build-Depends: debhelper, Build-Depends: debhelper,
chrpath, chrpath,
python python
Homepage: https://slapos.nexedi.com
Package: lunzip Package: mca
Architecture: any Architecture: any
Depends: ${misc:Depends}, Depends: ${misc:Depends},
${shlibs:Depends}, ${shlibs:Depends},
...@@ -19,9 +18,7 @@ Depends: ${misc:Depends}, ...@@ -19,9 +18,7 @@ Depends: ${misc:Depends},
g++ | c++-compiler, g++ | c++-compiler,
make, make,
patch, patch,
# slapos node collect
lm-sensors,
# devperm manager plugin wants to use lsblk # devperm manager plugin wants to use lsblk
util-linux util-linux
Conflicts: Conflicts:
Description: lunzip packaging test Description: example packaging test
/opt/example/bin/
/opt/example/lib/
/opt/example/etc/
Format: 3.0 (native) Format: 3.0 (native)
Source: lunzip Source: example
Architecture: any Architecture: any
Version: 1 Version: 1
Build-Depends: debhelper (>= 4.1.16), chrpath, po-debconf, wget, python (>= 2.7), python-dev, libssl-dev Build-Depends: debhelper (>= 4.1.16), chrpath, po-debconf, wget, python (>= 2.7)
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