Commit 7704862b authored by Ophélie Gagnard's avatar Ophélie Gagnard

obs/generic/: Reorganize and improve the build scripts.

build-scripts/:
- configuration_information.sh:
    - Automatically detect the osc user. Deduce the osc project.
    - Improve space handling in the variables name.
- Reorganize slightly and clean. Add " " around variables.
- Do nothing after running buildout. It allows to work on other projects during the compilation time. Create a new stage.
- Rename the scripts. Add and rename some variables.
- Restore the buildout files retrieving using git clones (rather than copying a model in the current filesystem).

templates/compilation-templates/: Change a macro according to a new variable name.

Makefile: Update.
- Supports both numbered and unnumbered names.
- Update for renaming and stage addition.
- Add an after_build target and fix some details.
parent 53005eef
all: build distrib_files obs all: build after_build
clean: clean_build clean_distrib_files clean_obs clean: clean_build clean_after_build
build: build_tree compilation_templates bootstrap_buildout build: build_tree compilation_templates bootstrap_and_compile
clean_build: clean_build_tree clean_compilation_templates clean_bootstrap_buildout clean_build: clean_build_tree clean_compilation_templates clean_bootstrap_and_compile
no-obs: build distrib_files after_build: backup_tarball distrib_files obs
clean_no-obs: clean_build clean_distrib_files clean_after_build: clean_backup_tarball clean_distrib_files clean_obs
build_tree: no-obs: build backup_tarball distrib_files
build-scripts/build_tree.sh clean_no-obs: clean_build clean_backup_tarball clean_distrib_files
build_tree: 10build_tree
10build_tree:
build-scripts/10build_tree.sh
clean_build_tree: clean_build_tree:
build-scripts/clean_build_tree.sh build-scripts/clean_10build_tree.sh
compilation_templates: compilation_templates: 20compilation_templates
build-scripts/compilation_templates.sh 20compilation_templates:
build-scripts/20compilation_templates.sh
clean_compilation_templates: clean_compilation_templates:
build-scripts/clean_compilation_templates.sh build-scripts/clean_20compilation_templates.sh
bootstrap_buildout: bootstrap_and_compile: 30bootstrap_and_compile
build-scripts/bootstrap_buildout.sh 30bootstrap_and_compile:
clean_bootstrap_buildout: build-scripts/30bootstrap_and_compile.sh
build-scripts/clean_bootstrap_buildout.sh clean_bootstrap_and_compile:
build-scripts/clean_30bootstrap_and_compile.sh
distrib_files:
build-scripts/distrib_files.sh backup_tarball: 40backup_tarball
40backup_tarball:
build-scripts/40backup_tarball.sh
clean_backup_tarball:
build-scripts/clean_40backup_tarball.sh
distrib_files: 50distrib_files
50distrib_files:
build-scripts/50distrib_files.sh
clean_distrib_files: clean_distrib_files:
build-scripts/clean_distrib_files.sh build-scripts/clean_50distrib_files.sh
obs: obs: 60obs
build-scripts/obs.sh 60obs:
build-scripts/60obs.sh
clean_obs: clean_obs:
build-scripts/clean_obs.sh build-scripts/clean_60obs.sh
.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 .PHONY: all clean no-obs clean_no-obs build clean_build after_build clean_after_build 10build_tree build_tree clean_build_tree 20compilation_templates compilation_templates clean_compilation_templates 30bootstrap_and_compile bootstrap_and_compile clean_bootstrap_buildout 40backup_tarball backup_tarball clean_backup_tarball 50distrib_files distrib_files clean_distrib_files 60obs obs clean_obs
...@@ -4,56 +4,62 @@ ...@@ -4,56 +4,62 @@
INITIAL_DIR="$(pwd)"/ INITIAL_DIR="$(pwd)"/
# DEBIAN_REVISION INFORMATION ### DEBIAN_REVISION INFORMATION ###
# Modify the following variables accordingly # Modify the following variables accordingly
SOFTWARE_VERSION=1 SOFTWARE_VERSION=1
#RECIPE_VERSION=1 #RECIPE_VERSION=1
DEBIAN_REVISION=1 DEBIAN_REVISION=1
SOFTWARE_NAME=example SOFTWARE_NAME=dep--mca--static
# 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
# VersionNumber is SOFTWARE_VERSION, DebianRevisionNumber is DEBIAN_REVISION # VersionNumber is SOFTWARE_VERSION, DebianRevisionNumber is DEBIAN_REVISION
# note: the architecture is added when building the package (here: in OBS) # note: the architecture is added when building the package (here: in OBS)
COMPOUND_VERSION=${SOFTWARE_VERSION}-${DEBIAN_REVISION} COMPOUND_VERSION="${SOFTWARE_VERSION}-${DEBIAN_REVISION}"
SOFTWARE_AND_VERSION=${SOFTWARE_NAME}_${COMPOUND_VERSION} SOFTWARE_AND_VERSION="${SOFTWARE_NAME}_${COMPOUND_VERSION}"
ARCHIVE_EXT=.tar.gz ARCHIVE_EXT=.tar.gz
# INSTALL INFORMATION ### INSTALL INFORMATION ###
# TARGET_DIR is only used in the templates via sed regexps # TARGET_DIR is only used in the templates via sed regexps
TARGET_DIR=/opt/$SOFTWARE_AND_VERSION TARGET_DIR=/opt/"$SOFTWARE_AND_VERSION"
# OBS AND DISTRIBUTIONS INFORMATION ### OBS AND DISTRIBUTIONS INFORMATION ###
OBS_DIR=$INITIAL_DIR/home:oph.nxd/$SOFTWARE_NAME/ # get the user from osc configuration file
DIST_DIR=$INITIAL_DIR/distribution-specifics/$SOFTWARE_NAME/ OBS_USER="$(cat ~/.config/osc/oscrc | grep user= | cut -d'=' -f2)"
TARBALL_DIR=$INITIAL_DIR/tarballs/$SOFTWARE_AND_VERSION OBS_PROJECT="home:$OBS_USER"
OBS_DIR="$INITIAL_DIR/$OBS_PROJECT/$SOFTWARE_NAME/"
DIST_DIR="$INITIAL_DIR/distribution-specifics/$SOFTWARE_NAME/"
TARBALL_DIR="$INITIAL_DIR/tarballs/$SOFTWARE_AND_VERSION"
# BUILD INFORMATION ### BUILD INFORMATION ###
# Modify the following variables accordingly # Modify the following variables accordingly
#SR_PATH=$TARBALL_DIR/software_release/component/$SOFTWARE_NAME/buildout.cfg # this is the directory with the buildout files, it can be anything but it usually is a slapos repository
SR_PATH=$TARBALL_DIR/software_release/software/$SOFTWARE_NAME/software.cfg BUILDOUT_DIR="$TARBALL_DIR/slapos_repository/"
# this can also be a component rather than a software, replace "software" with "component" and "buildout" to use a component instead
BUILDOUT_ENTRY_POINT="$BUILDOUT_DIR/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
RUN_BUILDOUT_DIR=$BUILD_DIR/$TARGET_DIR RUN_BUILDOUT_DIR="$BUILD_DIR/$TARGET_DIR"
DISTRIB_TEMPLATES_DIR=$INITIAL_DIR/templates/distribution-templates DISTRIB_TEMPLATES_DIR="$INITIAL_DIR/templates/distribution-templates"
DISTRIB_FILES_DIR=$INITIAL_DIR/distribution-specifics/$SOFTWARE_NAME DISTRIB_FILES_DIR="$INITIAL_DIR/distribution-specifics/$SOFTWARE_NAME"
# Path normalization ## Path normalization
INITIAL_DIR=`realpath -m $INITIAL_DIR` INITIAL_DIR=$(realpath -m "$INITIAL_DIR")
TARGET_DIR=`realpath -m $TARGET_DIR` TARGET_DIR=$(realpath -m "$TARGET_DIR")
OBS_DIR=`realpath -m $OBS_DIR` 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` BUILDOUT_DIR=$(realpath -m "$BUILDOUT_DIR")
COMPILATION_TEMPLATES_DIR=`realpath -m $COMPILATION_TEMPLATES_DIR` BUILDOUT_ENTRY_POINT=$(realpath -m "$BUILDOUT_ENTRY_POINT")
BUILD_DIR=`realpath -m $BUILD_DIR` COMPILATION_TEMPLATES_DIR=$(realpath -m "$COMPILATION_TEMPLATES_DIR")
RUN_BUILDOUT_DIR=`realpath -m $RUN_BUILDOUT_DIR` BUILD_DIR=$(realpath -m "$BUILD_DIR")
DISTRIB_TEMPLATES_DIR=`realpath -m $DISTRIB_TEMPLATES_DIR` RUN_BUILDOUT_DIR=$(realpath -m "$RUN_BUILDOUT_DIR")
DISTRIB_FILES_DIR=`realpath -m $DISTRIB_FILES_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;s|%SOFTWARE_AND_VERSION%|$SOFTWARE_AND_VERSION|g" NAME_REGEX="s|%SOFTWARE_NAME%|$SOFTWARE_NAME|g;s|%SOFTWARE_AND_VERSION%|$SOFTWARE_AND_VERSION|g"
...@@ -65,7 +71,7 @@ VERSION_REGEX="s|%RECIPE_VERSION%|$RECIPE_VERSION|g;s|%SOFTWARE_VERSION%|$SOFTWA ...@@ -65,7 +71,7 @@ VERSION_REGEX="s|%RECIPE_VERSION%|$RECIPE_VERSION|g;s|%SOFTWARE_VERSION%|$SOFTWA
# Note: %PATCHES_DIRECTORY% not supported yet # Note: %PATCHES_DIRECTORY% not supported yet
# directories (supporting new macros) # 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" 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" PATH_REGEX="s|%BUILDOUT_ENTRY_POINT%|$BUILDOUT_ENTRY_POINT|g"
# directories (supporting legacy macros, not used anymore) # 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" #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) # concatenate all regex using ; (quoted, not to end the command)
......
#!/bin/bash
set -e
source build-scripts/00env.sh
cd "$INITIAL_DIR"
### Retrieve the buildout directory.
# Note: This is usually a slapos git repository but it can be otherwise.
# There needs to be at least one buildout file to point to (the entry point) which can extend other build files. See the buildout documentation if this is unclear.
mkdir -p "$TARBALL_DIR"
git clone https://lab.nexedi.com/Ophelie/slapos "$BUILDOUT_DIR"
cd "$BUILDOUT_DIR"
git checkout metadata-collect-agent
# example with a local copy of the buildout directory:
#cp -r /home/test/other-projects/model/mca.my-slapos "$BUILDOUT_DIR"
cd "$INITIAL_DIR"
### Peparing the build directories
mkdir -p "$RUN_BUILDOUT_DIR"/{eggs,extends-cache,download-cache/dist}
#!/bin/bash
set -e
source build-scripts/00env.sh
cd "$INITIAL_DIR"
# Prepare the templates in $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME
mkdir -p "$COMPILATION_TEMPLATES_DIR"/tmp/"$SOFTWARE_NAME"
# if a custom directory exist for compilation templates, choose it
# 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
#!/bin/bash
set -e
source build-scripts/00env.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 $RUN_BUILDOUT_DIR/bin/buildout (bootstraping) and run it (actual compilation).
# Note: it creates a lot of things in $RUN_BUILDOUT_DIR/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 "$COMPILATION_TEMPLATES_DIR"/tmp/"$SOFTWARE_NAME"/local_buildout.cfg buildout.cfg
## next line explained
# 1st cmd: bootstrap buildout (creates bin/buildout)
# 2nd cmd: backup $RUN_BUILDOUT_DIR/bin/buildout (to be restored for OBS)
# 3rd cmd: run buildout (which modifies itself via rebootstrapping when compiling python)
(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)
#!/bin/bash
set -e
source build-scripts/00env.sh
cd "$INITIAL_DIR"
### Fix the go/ directory.
# For some reason the user does not have the "write" permission on some directories within $RUN_BUILDOUT_DIR/go/. As it is
# needed on a directory to delete a file in it, the if block adds the permissions to every
# directories in go/.
# This is performed before copying the directory tree elsewhere so that every copy is fixed.
# It also allows the cleaning script to delete the result of the current script.
if [ -d "$RUN_BUILDOUT_DIR"/go ]; then
find "$RUN_BUILDOUT_DIR"/go -name "*" -type d -exec chmod u+xw {} +
fi
cd "$INITIAL_DIR"
### Backup $TARBALL_DIR for debugging or other purpose
# add "backup." before the directory name pointed to by $TARBALL_DIR
BACKUP_DIR="$TARBALL_DIR"/../backup."$SOFTWARE_AND_VERSION"
BACKUP_DIR=$(realpath -m "$BACKUP_DIR")
# Delete the potential previous backup and backup the newly created build tree instead.
rm -rf "$BACKUP_DIR"
cp -r "$TARBALL_DIR" "$BACKUP_DIR"
#!/bin/bash #!/bin/bash
set -e set -e
source build-scripts/configuration_information.sh source build-scripts/00env.sh
cd $INITIAL_DIR cd "$INITIAL_DIR"
# Prepare the templates in $DISTRIB_TEMPLATES_DIR/tmp/ # Prepare the templates in $DISTRIB_TEMPLATES_DIR/tmp/
TMP_TARGET=$DISTRIB_TEMPLATES_DIR/tmp/$SOFTWARE_NAME/ TMP_TARGET="$DISTRIB_TEMPLATES_DIR"/tmp/"$SOFTWARE_NAME"/
mkdir -p $TMP_TARGET mkdir -p "$TMP_TARGET"
sed $ALL_REGEX $DISTRIB_TEMPLATES_DIR/default.dsc.in > $TMP_TARGET/$SOFTWARE_AND_VERSION.dsc sed "$ALL_REGEX" "$DISTRIB_TEMPLATES_DIR"/default.dsc.in > "$TMP_TARGET"/"$SOFTWARE_AND_VERSION".dsc
# debian directory # debian directory
mkdir -p $TMP_TARGET/debian/ mkdir -p "$TMP_TARGET"/debian/
sed $ALL_REGEX $DISTRIB_TEMPLATES_DIR/debian_default/changelog.in > $TMP_TARGET/debian/changelog sed "$ALL_REGEX" "$DISTRIB_TEMPLATES_DIR"/debian_default/changelog.in > "$TMP_TARGET"/debian/changelog
sed $ALL_REGEX $DISTRIB_TEMPLATES_DIR/debian_default/control.in > $TMP_TARGET/debian/control sed "$ALL_REGEX" "$DISTRIB_TEMPLATES_DIR"/debian_default/control.in > "$TMP_TARGET"/debian/control
sed $ALL_REGEX $DISTRIB_TEMPLATES_DIR/debian_default/dirs.in > $TMP_TARGET/debian/dirs sed "$ALL_REGEX" "$DISTRIB_TEMPLATES_DIR"/debian_default/dirs.in > "$TMP_TARGET"/debian/dirs
cp -r $DISTRIB_TEMPLATES_DIR/debian_default/{compat,copyright,rules,source} $TMP_TARGET/debian/ cp -r "$DISTRIB_TEMPLATES_DIR"/debian_default/{compat,copyright,rules,source} "$TMP_TARGET"/debian/
# TODO: do it with "find" instead? # TODO: do it with "find" instead?
#find $DISTRIB_TEMPLATES_DIR/debian_defaults/ -type f -name * -exec sed $ALL_REGEX {} + > $TMP_TARGET/debian/ #find "$DISTRIB_TEMPLATES_DIR"/debian_defaults/ -type f -name * -exec sed "$ALL_REGEX" {} + > "$TMP_TARGET"/debian/
# If a directory for the current software does not already exist in distrubion-specifics: # If a directory for the current software does not already exist in distrubion-specifics:
# create it and copy the product of the templates in it, # create it and copy the product of the templates in it,
# otherwise do nothing. # otherwise do nothing.
# The files created form the templates are still available in $TMP_TARGET # The files created form the templates are still available in $TMP_TARGET
if [ ! -d $DISTRIB_FILES_DIR ]; then if [ ! -d "$DISTRIB_FILES_DIR" ]; then
mkdir -p $DISTRIB_FILES_DIR mkdir -p "$DISTRIB_FILES_DIR"
cp -r $TMP_TARGET/* $DISTRIB_FILES_DIR/ cp -r "$TMP_TARGET"/* "$DISTRIB_FILES_DIR"/
# A file is created so that the cleaning script can reverse the action of the current script. # A file is created so that the cleaning script can reverse the action of the current script.
echo -e "This file's only purpose is to tell the cleaning script to delete this directory.\nThere should not be such file in a manually crafted directory.\n" >> $DISTRIB_FILES_DIR/.toclean-stamp echo -e "This file's only purpose is to tell the cleaning script to delete this directory.\nThere should not be such file in a manually crafted directory.\n" >> "$DISTRIB_FILES_DIR"/.toclean-stamp
fi fi
#!/bin/bash #!/bin/bash
set -e set -e
source build-scripts/configuration_information.sh source build-scripts/00env.sh
# temporary directory for the files needed by OBS # temporary directory for the files needed by OBS
TMP_TARGET=$INITIAL_DIR/obs-tmp/$SOFTWARE_NAME TMP_TARGET="$INITIAL_DIR"/obs-tmp/"$SOFTWARE_NAME"
TMP_TARGET=`realpath -m $TMP_TARGET` TMP_TARGET=$(realpath -m "$TMP_TARGET")
echo TMP_TARGET = $TMP_TARGET echo TMP_TARGET = "$TMP_TARGET"
# copy the generated Makefile at the root of the tarball # copy the generated Makefile at the root of the tarball
cp $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME/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/local_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
# clean the parts directory # clean the parts directory
rm -rf $RUN_BUILDOUT_DIR/{.installed.cfg,parts/} rm -rf "$RUN_BUILDOUT_DIR"/{.installed.cfg,parts/}
## prepare the files for OBS ## prepare the files for OBS
mkdir -p $TMP_TARGET mkdir -p "$TMP_TARGET"
# -C option allows to give tar an absolute path without archiving the directory from / (i.e. home/user/[...]) # -C option allows to give tar an absolute path without archiving the directory from / (i.e. home/user/[...])
tar czf $TMP_TARGET/${SOFTWARE_AND_VERSION}${ARCHIVE_EXT} -C $INITIAL_DIR/tarballs/ $SOFTWARE_AND_VERSION/ tar czf "$TMP_TARGET"/"${SOFTWARE_AND_VERSION}""${ARCHIVE_EXT}" -C "$INITIAL_DIR"/tarballs/ "$SOFTWARE_AND_VERSION"/
tar czf $TMP_TARGET/debian.tar.gz -C $DIST_DIR/ debian/ tar czf "$TMP_TARGET"/debian.tar.gz -C "$DIST_DIR"/ debian/
cp $DIST_DIR/*.dsc $TMP_TARGET/ cp "$DIST_DIR"/*.dsc "$TMP_TARGET"/
# move the files for OBS # move the files for OBS
cp $TMP_TARGET/${SOFTWARE_AND_VERSION}${ARCHIVE_EXT} $OBS_DIR cp "$TMP_TARGET"/"${SOFTWARE_AND_VERSION}""${ARCHIVE_EXT}" "$OBS_DIR"
cp $TMP_TARGET/debian.tar.gz $OBS_DIR cp "$TMP_TARGET"/debian.tar.gz "$OBS_DIR"
cp $TMP_TARGET/*.dsc $OBS_DIR cp "$TMP_TARGET"/*.dsc "$OBS_DIR"
cd $OBS_DIR cd "$OBS_DIR"
osc add *.dsc *.tar.gz
osc commit osc commit
#!/bin/bash
set -e
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 $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME/local_buildout.cfg buildout.cfg
## next line explained
# 1st cmd: bootstrap buildout (creates bin/buildout)
# 2nd cmd: backup bin/buildout (to be restored for OBS)
# 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)
#cp $COMPILATION_TEMPLATES_DIR/tmp/buildout_with_gcc.cfg buildout.cfg
cd $INITIAL_DIR
# Fix the go/ directory.
# For some reason the user does not have the "write" permission on some directories of go/. As it is
# needed on a directory to delete a file in it, the if block adds the permissions to every
# directories in go/.
# This is performed before copying the directory tree elsewhere so that every copy is fixed.
# It also allows the cleaning script to delete the result of the current script.
if [ -d $RUN_BUILDOUT_DIR/go ]; then
find $RUN_BUILDOUT_DIR/go -name "*" -type d -exec chmod u+xw {} +
fi
cd $INITIAL_DIR
# Backup $TARBALL_DIR for debugging or other purpose
# add "backup." before the directory name pointed to by $TARBALL_DIR
BACKUP_DIR=$TARBALL_DIR/../backup.$SOFTWARE_AND_VERSION
BACKUP_DIR=`realpath -m $BACKUP_DIR`
# Delete the potential previous backup and backup the newly created build tree instead.
rm -rf $BACKUP_DIR
cp -r $TARBALL_DIR $BACKUP_DIR
#!/bin/bash
set -e
source build-scripts/configuration_information.sh
cd $INITIAL_DIR
mkdir -p $TARBALL_DIR
# Re-downloading the software release to pack
#cp -r /home/test/other-projects/model/1wip_simplify-fluentbit_my-slapos .
cp -r /home/test/other-projects/model/mca.my-slapos $TARBALL_DIR/software_release
#cp -r /home/test/other-projects/new_slapos.package/sid.fluentbit.my-slapos $TARBALL_DIR
#mv $TARBALL_DIR/mca.my-slapos $TARBALL_DIR/software_release
cd $INITIAL_DIR
# Peparing the build directories
mkdir -p $RUN_BUILDOUT_DIR/{eggs,extends-cache,download-cache/dist}
#!/bin/bash #!/bin/bash
set -e set -e
source build-scripts/configuration_information.sh source build-scripts/00env.sh
cd $INITIAL_DIR cd "$INITIAL_DIR"
# For some reason the user does not have the "write" permission on some directories of go/. As it is # For some reason the user does not have the "write" permission on some directories of go/. As it is
# needed on a directory to delete a file in it, the if block add the permissions to every # needed on a directory to delete a file in it, the if block add the permissions to every
# directories in go/. # directories in go/.
if [ -d $RUN_BUILDOUT_DIR/go ]; then if [ -d "$RUN_BUILDOUT_DIR"/go ]; then
find $RUN_BUILDOUT_DIR/go -name "*" -type d -exec chmod u+xw {} + find "$RUN_BUILDOUT_DIR"/go -name "*" -type d -exec chmod u+xw {} +
fi fi
rm -rf $TARBALL_DIR rm -rf "$TARBALL_DIR"
exit # TODO: separate the tree building from the software release retrieving exit # TODO: separate the tree building from the software release retrieving
cd $INITIAL_DIR cd "$INITIAL_DIR"
# Clean the software release to pack # Clean the software release to pack
rm -rf $TARBALL_DIR/software_release rm -rf "$TARBALL_DIR"/software_release
cd $INITIAL_DIR cd "$INITIAL_DIR"
# Clean the build tree # Clean the build tree
rm -rf $RUN_BUILDOUT_DIR/{eggs,extends-cache,download-cache} rm -rf "$RUN_BUILDOUT_DIR"/{eggs,extends-cache,download-cache}
#!/bin/bash #!/bin/bash
set -e set -e
source build-scripts/configuration_information.sh source build-scripts/00env.sh
cd $INITIAL_DIR cd "$INITIAL_DIR"
# Clean temporary directory for templates # Clean temporary directory for templates
rm -rf $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME rm -rf "$COMPILATION_TEMPLATES_DIR"/tmp/"$SOFTWARE_NAME"
#!/bin/bash #!/bin/bash
set -e set -e
source build-scripts/configuration_information.sh source build-scripts/00env.sh
cd $INITIAL_DIR cd "$INITIAL_DIR"
# Remove the products of the script bootstrap_buildout.sh # Remove the products of the script bootstrap_buildout.sh
# remove the bootstrap script and associated files # remove the bootstrap script and associated files
rm -f $RUN_BUILDOUT_DIR/{bootstrap.py,bootstrap-buildout.py,buildout.cfg} rm -f "$RUN_BUILDOUT_DIR"/{bootstrap.py,bootstrap-buildout.py,buildout.cfg}
# remove the material created by the bootstrap script # remove the material created by the bootstrap script
rm -rf $RUN_BUILDOUT_DIR/{bin/,egg/} rm -rf "$RUN_BUILDOUT_DIR"/{bin/,egg/}
# remove the material created by buildout itself # remove the material created by buildout itself
rm -rf $RUN_BUILDOUT_DIR/go/ rm -rf "$RUN_BUILDOUT_DIR"/go/
#!/bin/bash
set -e
source build-scripts/00env.sh
cd "$INITIAL_DIR"
# Nothing is done here, as 04backup_tarball.sh only modifies permissions in "$RUN_BUILDOUT_DIR"/go/ and backs up the "$TARBALL_DIR" (one do not want to delete the backup if it's not to create a new one).
#!/bin/bash #!/bin/bash
set -e set -e
source build-scripts/configuration_information.sh source build-scripts/00env.sh
cd $INITIAL_DIR cd "$INITIAL_DIR"
# Clean the temporary directory of distribution files for $SOFTWARE_NAME # Clean the temporary directory of distribution files for "$SOFTWARE_NAME"
rm -rf $DISTRIB_TEMPLATES_DIR/tmp/$SOFTWARE_NAME rm -rf "$DISTRIB_TEMPLATES_DIR"/tmp/"$SOFTWARE_NAME"
# Only delete the directory is the file .toclean-stam is present in it. It should only be created # Only delete the directory is the file .toclean-stam is present in it. It should only be created
# when the directory is automatically generated so that the cleaning script can reverse the action. # when the directory is automatically generated so that the cleaning script can reverse the action.
if [ -e $DISTRIB_FILES_DIR/.toclean-stamp ]; then if [ -e "$DISTRIB_FILES_DIR"/.toclean-stamp ]; then
rm -rf $DISTRIB_FILES_DIR rm -rf "$DISTRIB_FILES_DIR"
fi fi
#!/bin/bash
set -e
source build-scripts/00env.sh
# reverse the action of obsoleting the potentially altered buildout and restoring the backed up one
if [ ! -e "$RUN_BUILDOUT_DIR"/bin/backup.buildout ]; then
if [ -e "$RUN_BUILDOUT_DIR"/bin/buildout ]; then
cp "$RUN_BUILDOUT_DIR"/bin/buildout "$RUN_BUILDOUT_DIR"/bin/backup.buildout
fi
fi
if [ -e "$RUN_BUILDOUT_DIR"/bin/old.buildout ]; then
mv "$RUN_BUILDOUT_DIR"/bin/old.buildout "$RUN_BUILDOUT_DIR"/bin/buildout
fi
TMP_TARGET="$INITIAL_DIR"/obs-tmp/"$SOFTWARE_NAME"
TMP_TARGET=$(realpath -m "$TMP_TARGET")
rm -rf "$TMP_TARGET"
#!/bin/bash
set -e
source build-scripts/configuration_information.sh
# reverse the action of obsoleting the potentially altered buildout and restoring the backed up one
if [ ! -e $RUN_BUILDOUT_DIR/bin/backup.buildout ]; then
if [ -e $RUN_BUILDOUT_DIR/bin/buildout ]; then
cp $RUN_BUILDOUT_DIR/bin/buildout $RUN_BUILDOUT_DIR/bin/backup.buildout
fi
fi
if [ -e $RUN_BUILDOUT_DIR/bin/old.buildout ]; then
mv $RUN_BUILDOUT_DIR/bin/old.buildout $RUN_BUILDOUT_DIR/bin/buildout
fi
TMP_TARGET=$INITIAL_DIR/obs-tmp/$SOFTWARE_NAME
TMP_TARGET=`realpath -m $TMP_TARGET`
rm -rf $TMP_TARGET
#!/bin/bash
set -e
source build-scripts/configuration_information.sh
cd $INITIAL_DIR
# Prepare the templates in $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME
mkdir -p $COMPILATION_TEMPLATES_DIR/tmp/$SOFTWARE_NAME
# if a custom directory exist for compilation templates, choose it
# 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
...@@ -3,7 +3,7 @@ rootdir = %TARGET_DIR% ...@@ -3,7 +3,7 @@ rootdir = %TARGET_DIR%
destdir = %BUILD_DIR% destdir = %BUILD_DIR%
builddir = %RUN_BUILDOUT_DIR% builddir = %RUN_BUILDOUT_DIR%
extends = extends =
%SR_PATH% %BUILDOUT_ENTRY_POINT%
versions = versions versions = versions
extends-cache = extends-cache extends-cache = extends-cache
download-cache = download-cache download-cache = download-cache
......
...@@ -3,7 +3,7 @@ rootdir = %TARGET_DIR% ...@@ -3,7 +3,7 @@ rootdir = %TARGET_DIR%
destdir = %BUILD_DIR% destdir = %BUILD_DIR%
builddir = %RUN_BUILDOUT_DIR% builddir = %RUN_BUILDOUT_DIR%
extends = extends =
%SR_PATH% %BUILDOUT_ENTRY_POINT%
versions = versions versions = versions
extends-cache = extends-cache extends-cache = extends-cache
download-cache = download-cache download-cache = download-cache
......
...@@ -3,7 +3,7 @@ rootdir = %TARGET_DIR% ...@@ -3,7 +3,7 @@ rootdir = %TARGET_DIR%
destdir = %BUILD_DIR% destdir = %BUILD_DIR%
builddir = %RUN_BUILDOUT_DIR% builddir = %RUN_BUILDOUT_DIR%
extends = extends =
%SR_PATH% %BUILDOUT_ENTRY_POINT%
versions = versions versions = versions
extends-cache = extends-cache extends-cache = extends-cache
download-cache = download-cache download-cache = download-cache
......
...@@ -3,7 +3,7 @@ rootdir = %TARGET_DIR% ...@@ -3,7 +3,7 @@ rootdir = %TARGET_DIR%
destdir = %BUILD_DIR% destdir = %BUILD_DIR%
builddir = %RUN_BUILDOUT_DIR% builddir = %RUN_BUILDOUT_DIR%
extends = extends =
%SR_PATH% %BUILDOUT_ENTRY_POINT%
versions = versions versions = versions
extends-cache = extends-cache extends-cache = extends-cache
download-cache = download-cache download-cache = download-cache
......
...@@ -3,7 +3,7 @@ rootdir = %TARGET_DIR% ...@@ -3,7 +3,7 @@ rootdir = %TARGET_DIR%
destdir = %BUILD_DIR% destdir = %BUILD_DIR%
builddir = %RUN_BUILDOUT_DIR% builddir = %RUN_BUILDOUT_DIR%
extends = extends =
%SR_PATH% %BUILDOUT_ENTRY_POINT%
versions = versions versions = versions
extends-cache = extends-cache extends-cache = extends-cache
download-cache = download-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