Commit 1803ffd5 authored by Ophélie Gagnard's avatar Ophélie Gagnard

build-scripts/: Change some variable names, add a sed regex.

parent 3be77db2
......@@ -4,25 +4,29 @@
INITIAL_DIR="$(pwd)"/
# RELEASE INFORMATION
# DEBIAN_REVISION INFORMATION
# Modify the following variables accordingly
VERSION=1
SOFTWARE_VERSION=1
#RECIPE_VERSION=1
RELEASE=1
DEBIAN_REVISION=1
SOFTWARE_NAME=mca
COMPOUND_VERSION=${VERSION}-${RELEASE}
VERSION_NAME=${SOFTWARE_NAME}_${COMPOUND_VERSION}
# 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
# VersionNumber is SOFTWARE_VERSION, DebianRevisionNumber is DEBIAN_REVISION
# note: the architecture is added when building the package (here: in OBS)
COMPOUND_VERSION=${SOFTWARE_VERSION}-${DEBIAN_REVISION}
SOFTWARE_AND_VERSION=${SOFTWARE_NAME}_${COMPOUND_VERSION}
ARCHIVE_EXT=.tar.gz
# INSTALL INFORMATION
# TARGET_DIR is only used in the templates via sed regexps
TARGET_DIR=/opt/$VERSION_NAME
TARGET_DIR=/opt/$SOFTWARE_AND_VERSION
# OBS AND DISTRIBUTIONS INFORMATION
OBS_DIR=$INITIAL_DIR/home:oph.nxd/$SOFTWARE_NAME/
DIST_DIR=$INITIAL_DIR/distribution-specifics/$SOFTWARE_NAME/
TARBALL_DIR=$INITIAL_DIR/tarballs/$VERSION_NAME
TARBALL_DIR=$INITIAL_DIR/tarballs/$SOFTWARE_AND_VERSION
# BUILD INFORMATION
# Modify the following variables accordingly
......@@ -47,14 +51,18 @@ TEMPLATE_DIR=`realpath -m $TEMPLATE_DIR`
BUILD_DIR=`realpath -m $BUILD_DIR`
RUN_BUILDOUT_DIR=`realpath -m $RUN_BUILDOUT_DIR`
# Regular expressions for templates
## Regular expressions for templates
NAME_REGEX="s|%SOFTWARE_NAME%|$SOFTWARE_NAME|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"
# versions (supporting legact macros)
#OLD_VERSION_REGEX="s|\%RECIPE_VERSION\%|$RECIPE_VERSION|g;s|\%VERSION\%|$SOFTWARE_VERSION|g;s|\%DEBIAN_REVISION\%|$DEBIAN_REVISION|g;s|\%COMPOUND_VERSION\%|$COMPOUND_VERSION|g"
# versions (supporting new macros)
VERSION_REGEX="s|%RECIPE_VERSION%|$RECIPE_VERSION|g;s|%SOFTWARE_VERSION%|$SOFTWARE_VERSION|g;s|%DEBIAN_REVISION%|$DEBIAN_REVISION|g;s|%COMPOUND_VERSION%|$COMPOUND_VERSION|g"
# Note: %PATCHES_DIRECTORY% not supported yet
# 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"
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";"$PATH_REGEX #";"$OLD_DIR_REGEX
ALL_REGEX=$NAME_REGEX";"$VERSION_REGEX";"$DIR_REGEX";"$PATH_REGEX #";"$OLD_DIR_REGEX
......@@ -22,11 +22,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/${VERSION_NAME}${ARCHIVE_EXT} -C $INITIAL_DIR/tarballs/ $VERSION_NAME/
tar czf $TMP_DIR/${SOFTWARE_AND_VERSION}${ARCHIVE_EXT} -C $INITIAL_DIR/tarballs/ $SOFTWARE_AND_VERSION/
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/${VERSION_NAME}${ARCHIVE_EXT} $OBS_DIR
cp $TMP_DIR/${SOFTWARE_AND_VERSION}${ARCHIVE_EXT} $OBS_DIR
cp $TMP_DIR/debian.tar.gz $OBS_DIR
cp $TMP_DIR/*.dsc $OBS_DIR
......
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