diff --git a/prod_build/general/chroot_wrap.sh b/prod_build/general/chroot_wrap.sh index de0fbcfad44264c4de77fbb11570110e9cc877db..de2e889bd1834255df8f18efea397a68f5ab3931 100755 --- a/prod_build/general/chroot_wrap.sh +++ b/prod_build/general/chroot_wrap.sh @@ -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" diff --git a/prod_build/general/conf/version_info b/prod_build/general/conf/version_info index 288cd5c8353e7f97d2afb4e5eb15779621861c7a..d33ee15a16d60350c7cf60dd9136afcd3ad4ebca 100644 --- a/prod_build/general/conf/version_info +++ b/prod_build/general/conf/version_info @@ -1,3 +1,3 @@ -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" diff --git a/prod_build/general/pre-build.sh b/prod_build/general/pre-build.sh index 75f661b5a5074c1ca268d3aab7f600566041c670..94a871b8627bd682c19030caeb3aa1e7bd190382 100755 --- a/prod_build/general/pre-build.sh +++ b/prod_build/general/pre-build.sh @@ -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" diff --git a/prod_build/linux/debian/conf/publish b/prod_build/linux/debian/conf/publish index 570c8d1bb80faf7ea0e148d1c067d764865d7e8c..61b38fc197a89dcaf0cfec02be0b88837adc9c0d 100644 --- a/prod_build/linux/debian/conf/publish +++ b/prod_build/linux/debian/conf/publish @@ -1,3 +1,3 @@ HOST_DISTR_VERSIONS="stretch buster" -HOST_ARCH_VERSIONS="amd64 i386" +HOST_ARCH_VERSIONS="amd64" PACKAGE_PATH=builds/deb/ diff --git a/prod_build/linux/debian/scripts/chroot/post-build.sh b/prod_build/linux/debian/scripts/chroot/post-build.sh new file mode 100755 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/prod_build/linux/debian/scripts/chroot/pre-build.sh b/prod_build/linux/debian/scripts/chroot/pre-build.sh new file mode 100755 index 0000000000000000000000000000000000000000..3b371430f385649b4056cbdd82133590376084da --- /dev/null +++ b/prod_build/linux/debian/scripts/chroot/pre-build.sh @@ -0,0 +1,45 @@ +#!/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 diff --git a/prod_build/linux/debian/scripts/compile_and_pack.sh b/prod_build/linux/debian/scripts/compile_and_pack.sh index 5b67901becfc019afaafe4b033c016ef73fd2031..e01aa41b66143151714e98ef0faf85a956586fb0 100755 --- a/prod_build/linux/debian/scripts/compile_and_pack.sh +++ b/prod_build/linux/debian/scripts/compile_and_pack.sh @@ -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 diff --git a/prod_build/linux/debian/scripts/pre-build.sh b/prod_build/linux/debian/scripts/pre-build.sh index 720335745dcb68ba8afd7415775c00457747a463..27dae1c146e17145935306d03a914ed61d6de982 100755 --- a/prod_build/linux/debian/scripts/pre-build.sh +++ b/prod_build/linux/debian/scripts/pre-build.sh @@ -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!