Skip to content
Snippets Groups Projects
Commit 24c77d5d authored by alexandr.kravchenko's avatar alexandr.kravchenko
Browse files

fixed build scripts

parents b01ee0a6 27e595d5
No related branches found
No related tags found
2 merge requests!71Support 2649,!70Support 2649
......@@ -27,11 +27,11 @@ for platform in $PLATFORMS; do
#Check if chroots are present
echo $HOST_DISTR_VERSIONS
echo $HOST_ARCH_VERSIONS
[ -e prod_build/$platform/scripts/pre-build.sh ] && prod_build/$platform/scripts/pre-build.sh #For actions not in chroot (version update)
[ -e prod_build/$platform/scripts/pre-build.sh ] && prod_build/$platform/scripts/pre-build.sh $CHROOT_PREFIX #For actions not in chroot (version update)
for distr in $HOST_DISTR_VERSIONS; do
for arch in $HOST_ARCH_VERSIONS; do
if [ -e $CHROOTS_PATH/$CHROOT_PREFIX-$distr-$arch ]; then
schroot -c $CHROOT_PREFIX-$distr-$arch -- launcher.sh prod_build/$platform/scripts/$JOB.sh $PKG_TYPE || errcode=$?
schroot -c $CHROOT_PREFIX-$distr-$arch -- launcher.sh prod_build/$platform/scripts/$JOB.sh "$PKG_TYPE" || errcode=$?
# echo "schroot stub $PKG_TYPE"
else
echo "chroot $CHROOT_PREFIX-$distr-$arch not found. You should install it first"
......
VERSION_FILE=config.pri
VERSION_ENTRIES="VER_MAJ VER_MIN VER_PAT VER_CODE"
VERSION_FORMAT="VER_MAJ.VER_MIN-VER_PAT"
VERSION_FILE=CMakeLists.txt
VERSION_ENTRIES="CPACK_PACKAGE_VERSION_MAJOR CPACK_PACKAGE_VERSION_MINOR CPACK_PACKAGE_VERSION_PATCH"
VERSION_FORMAT="CPACK_PACKAGE_VERSION_MAJOR.CPACK_PACKAGE_VERSION_MINOR-CPACK_PACKAGE_VERSION_PATCH"
......@@ -5,7 +5,7 @@ extract_version_number() {
IFS=" "
local VERSION_STRING=$VERSION_FORMAT
for entry in $VERSION_ENTRIES; do
VERSION_STRING=$(echo $VERSION_STRING | sed "s/$entry/$( cat $VERSION_FILE | grep $entry | sed 's/ //g' | cut -d '=' -f2 )/") #Replacing templates with numbers
VERSION_STRING=$(echo $VERSION_STRING | sed "s/$entry/$( cat $VERSION_FILE | grep $entry | grep [0-9] | cut -d ' ' -f3 | cut -d ')' -f1 )/") #Replacing templates with numbers
done
echo -e "$VERSION_STRING"
......
HOST_DISTR_VERSIONS="stretch buster"
HOST_ARCH_VERSIONS="amd64 i386"
HOST_ARCH_VERSIONS="amd64"
PACKAGE_PATH=builds/deb/
#!/bin/bash
check_packages() {
IFS=" "
local PKG_DEPPIES=$(echo $PKG_DEPS | sed 's/\"//g')
for element in "$PKG_DEPPIES"; do
echo "[DEBUGGA] Checking if $element is installed"
if ! dpkg-query -s $element; then
echo "[WRN] Package $element is not installed. Starting installation"
return 1
fi
done
return 0
}
install_dependencies() {
echo "Checking out the dependencies"
if check_packages >> /dev/null; then
echo "[INF] All required packages are installed"
else
echo ""
local PKG_DEPPIES=$(echo $PKG_DEPS | sed 's/\"//g')
echo "[DEBUGGA] Attempting to install $PKG_DEPPIES"
if sudo apt-get install $PKG_DEPPIES -y ; then
echo ""
echo "[INF] Packages were installed successfully"
else
echo "[ERR] can\'t install required packages. Please, check your package manager"
echo "Aborting"
exit 1
fi
fi
return 0
}
PKG_DEPS=$1
install_dependencies
#for variable in $(cat ./prod_build/general/conf/brands | sed 's/\"//g'); do
# echo $variable
# export "$variable"
#done
......@@ -24,7 +24,9 @@
#fi
cmake -S . -B build && make -C build && cpack -B build
#cmake -S . -B build && make -C build && cpack -B build
pwd
mkdir -p build && cd build && cmake ../ && make -j3 && cpack && cd ..
### touch /etc/apt/sources.list.d/demlabs.list deb https://debian.pub.demlabs.net/ bionic main universe multiverse
......
......@@ -36,7 +36,7 @@ install_dependencies() {
echo ""
local PKG_DEPPIES=$(echo $PKG_DEPS | sed 's/\"//g')
echo "[DEBUGGA] Attempting to install $PKG_DEPPIES"
if sudo apt-get install $PKG_DEPPIES -y ; then
if sudo /usr/bin/apt-get install -y $PKG_DEPPIES ; then
echo ""
echo "[INF] Packages were installed successfully"
else
......@@ -71,13 +71,13 @@ install_dependencies() {
#. prod_build/general/install_dependencies
. prod_build/general/pre-build.sh #VERSIONS and git
export_variables "prod_build/general/conf/*"
export_variables "prod_build/linux/debian/conf/*"
install_dependencies
VERSION_STRING=$(echo $VERSION_FORMAT | sed "s/\"//g" ) #Removing quotes
VERSION_ENTRIES=$(echo $VERSION_ENTRIES | sed "s/\"//g" )
extract_version_number
last_version_string=$(cat prod_build/linux/debian/essentials/changelog | head -n 1 | cut -d '(' -f2 | cut -d ')' -f1)
[ -e prod_build/linux/debian/essentials/changelog ] && last_version_string=$(cat prod_build/linux/debian/essentials/changelog | head -n 1 | cut -d '(' -f2 | cut -d ')' -f1)
......@@ -96,23 +96,15 @@ last_version_string=$(cat prod_build/linux/debian/essentials/changelog | head -n
if [ $( gitlab-runner -v 2> /dev/null ; echo $? ) == 0 ]; then
echo "[WRN] on build platform. Version won't be changed" # okay, so this echo wont be outputted as the condition is not true
elif [ "$last_version_string" == "$VERSION_STRING" ]; then
echo "[INF] Version $last_version_string is equal to $VERSION_STRING. Nothing to change"
elif [ ! -e debian/changelog ]; then ### I guess this what's supposed to be added in order to solve the issue with the changelog?+
echo "[INF] Debian changelog does not exist. Nothing to be done there." #I supposed it should look somehow like that.
#makes sense
elif [ "$last_version_string" == "$VERSION_STRING" ]; then
echo "[INF] Version $last_version_string is equal to $VERSION_STRING. Nothing to change"
else
<<<<<<< HEAD
echo "[INF] $VERSION_STRING is greater than $last_version_string"
echo "[INF] editing the changelog"
text=$(extract_gitlog_text)
IFS=$'\n'
echo "VERSION_STRING = $VERSION_STRING"
=======
echo "[INF] editing the changelog"
text=$(extract_gitlog_text)
IFS=$'\n'
>>>>>>> 6ec3383544fc3bfd7cdfe65b19cdd5626dd0bb83
for textline in $text; do
dch -v $VERSION_STRING $textline
done
......@@ -125,11 +117,8 @@ else
controlfile_version=$(cat prod_build/linux/debian/essentials/control | grep "Standards" | cut -d ' ' -f2) #Add to control info.
sed -i "s/$controlfile_version/$VERSION_STRING/" prod_build/linux/debian/essentials/control
export UPDVER=1
<<<<<<< HEAD
fi
echo "workdir is $(pwd)"
IFS=" "
CHROOT_PREFIX=$1
for distr in $HOST_DISTR_VERSIONS; do #we need to install required dependencies under schroot.
......@@ -139,5 +128,4 @@ for distr in $HOST_DISTR_VERSIONS; do #we need to install required dependencies
done
done
=======
fi
## Maybe we do have the version required? Then we don't need to build it again. CHECK IT THERE!
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment