diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a51c33f70e6505d7dafe2077abeddcc8bd205f1f..1d1e93039904d7d74c7905f5fd495d285d86dc8c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,4 +10,4 @@ kelvin-node-schedule: stage: build tags: - kelvin-node - script: ~/production/integration/gitlab-CI/build_all_handler.sh cellframe-node && ~/production/integration/reprepro/publish.sh debian.pub.demlabs.net stretch main && ~/production/integration/gitlab-CI/travis_test.sh + script: ~/production/integration/gitlab-CI/build_all_handler.sh cellframe-node diff --git a/libdap-chain-common b/libdap-chain-common index a831b434bc840cebb1cc6cf1a913bf606286c28d..dde4bb6403957dcbd2e0a983b36661ad303f5756 160000 --- a/libdap-chain-common +++ b/libdap-chain-common @@ -1 +1 @@ -Subproject commit a831b434bc840cebb1cc6cf1a913bf606286c28d +Subproject commit dde4bb6403957dcbd2e0a983b36661ad303f5756 diff --git a/libdap-chain-net-srv b/libdap-chain-net-srv index 05cd2947d6e3547e3e111b53befeff4b043cb16a..c28d683b226c8d39cd898609eb15a4049e74cf4e 160000 --- a/libdap-chain-net-srv +++ b/libdap-chain-net-srv @@ -1 +1 @@ -Subproject commit 05cd2947d6e3547e3e111b53befeff4b043cb16a +Subproject commit c28d683b226c8d39cd898609eb15a4049e74cf4e diff --git a/libdap-chain-net-srv-vpn b/libdap-chain-net-srv-vpn index e0f74dbc745a65bb040a41e99460b21b14406a1d..db5a7df2164c4e5a09a15464b8446e8ccb0cb97f 160000 --- a/libdap-chain-net-srv-vpn +++ b/libdap-chain-net-srv-vpn @@ -1 +1 @@ -Subproject commit e0f74dbc745a65bb040a41e99460b21b14406a1d +Subproject commit db5a7df2164c4e5a09a15464b8446e8ccb0cb97f diff --git a/libdap-crypto b/libdap-crypto index 1688d69223b19de929eed4f8dc61332aaec8dd46..1dfccbe81c132d06b8d54d76b65c3e25969f444d 160000 --- a/libdap-crypto +++ b/libdap-crypto @@ -1 +1 @@ -Subproject commit 1688d69223b19de929eed4f8dc61332aaec8dd46 +Subproject commit 1dfccbe81c132d06b8d54d76b65c3e25969f444d diff --git a/libdap-stream-ch-chain-net-srv b/libdap-stream-ch-chain-net-srv index 51c01481f87f3ffc1fdad3054292bf910d2c5f31..001b68d44aa11bbeb28b473e1ba41364497a6d6a 160000 --- a/libdap-stream-ch-chain-net-srv +++ b/libdap-stream-ch-chain-net-srv @@ -1 +1 @@ -Subproject commit 51c01481f87f3ffc1fdad3054292bf910d2c5f31 +Subproject commit 001b68d44aa11bbeb28b473e1ba41364497a6d6a diff --git a/prod_build/general/chroot_wrap.sh b/prod_build/general/chroot_wrap.sh index f1f33df6af12acb5cd483908e7bd6fab2876eec0..991f4d827f536b5eb65b5778188bc0c9ada89f25 100755 --- a/prod_build/general/chroot_wrap.sh +++ b/prod_build/general/chroot_wrap.sh @@ -1,46 +1,49 @@ #!/bin/bash -export_variables() { - -IFS=$'\n' -for variable in $(cat prod_build/$platform/conf/*); do - [ -z $1 ] && export $(echo "$variable" | sed 's/\"//g') || export -n $(echo $variable | cut -d '=' -f1) -done - -} - +PLATFORM_CANDIDATES=$2 CHROOT_PREFIX="builder" CHROOTS_PATH=$1 -PLATFORMS=$2 +PLATFORMS="" PKG_FORMAT=$3 SRC_PATH=$4 JOB=$5 cd $SRC_PATH +echo "workdir is $(pwd)" +. prod_build/general/pre-build.sh +export_variables "./prod_build/general/conf/*" + +IFS=' ' +echo "$PLATFORM_CANDIDATES" +echo $IMPLEMENTED +for platform in $PLATFORM_CANDIDATES; do + [[ $(echo $IMPLEMENTED | grep $platform) != "" ]] && PLATFORMS="$PLATFORMS$platform " || echo "Platform $platform is not implemented in this project yet. Sorry" +done echo "Platforms are $PLATFORMS" - for platform in $PLATFORMS; do - export_variables + echo "Working with $platform now" + export_variables "./prod_build/$platform/conf/*" IFS=' ' PKG_TYPE=$(echo $PKG_FORMAT | cut -d ' ' -f1) #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 $CHROOT_PREFIX #For actions not in chroot (version update) + [ -e prod_build/$platform/scripts/pre-build.sh ] && prod_build/$platform/scripts/pre-build.sh $CHROOT_PREFIX || exit $? #For actions before build not in chroot and in chroot (version update, install missing dependencies(under schroot)) 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" fi done done + echo "workdir before postinstall is $(pwd)" [ -e prod_build/$platform/scripts/post-build.sh ] && prod_build/$platform/scripts/post-build.sh #For post-build actions not in chroot (global publish) PKG_FORMAT=$(echo $PKG_FORMAT | cut -d ' ' -f2-) -# export_variables clean + unexport_variables "./prod_build/$platform/conf/*" done #[ $(mount | grep "/run/schroot/mount") ] && sudo umount -l /run/schroot/mount && sudo rm -r /run/schroot/mount/* #Removing mountpoint odds. diff --git a/prod_build/general/conf/status b/prod_build/general/conf/status new file mode 100644 index 0000000000000000000000000000000000000000..ec51dbab4d9aec34b4975de26716109730b30df6 --- /dev/null +++ b/prod_build/general/conf/status @@ -0,0 +1 @@ +IMPLEMENTED="linux/debian" diff --git a/prod_build/linux/debian/conf/publish b/prod_build/linux/debian/conf/publish index 61b38fc197a89dcaf0cfec02be0b88837adc9c0d..4aaf32d32f0676667bed864bcd83452c3ecadef8 100644 --- a/prod_build/linux/debian/conf/publish +++ b/prod_build/linux/debian/conf/publish @@ -1,3 +1,8 @@ -HOST_DISTR_VERSIONS="stretch buster" +HOST_DISTR_VERSIONS="buster" HOST_ARCH_VERSIONS="amd64" PACKAGE_PATH=builds/deb/ +REPO_DIR_SRC=/var/tmp/repository +DISTR_CODENAME="buster" +REPO_ADDR=debian.pub.demlabs.net +REPO_DIR=/var/www/html/debian.pub.demlabs.net +DISTR_COMPONENT=main diff --git a/prod_build/linux/debian/scripts/deploy.sh b/prod_build/linux/debian/scripts/deploy.sh index b3b3caac64f5624f63cd01212fdcee6de868fb17..8a4a7c14d193cfb15126bd9ef3ff1aa5bc1a21cb 100755 --- a/prod_build/linux/debian/scripts/deploy.sh +++ b/prod_build/linux/debian/scripts/deploy.sh @@ -1,18 +1,51 @@ #!/bin/bash +repack() { + +DEBNAME=$1 +echo "Renaming control on $DEBNAME" +mkdir tmp && cd tmp +ar p ../$DEBNAME control.tar.gz | tar -xz +VERSION=$(cat control | grep Version | cut -d ':' -f2) +echo "Version is $VERSION" +sed -i "s/$VERSION/${VERSION}-$DISTR_CODENAME/" control +tar czf control.tar.gz *[!z] +ar r ../$DEBNAME control.tar.gz +cd .. +rm -rf tmp + +} + echo "Deploying to $PACKAGE_PATH" echo $wd -PKGFILES=($(ls build/*.deb)) -mv build/*.deb $wd/$PACKAGE_PATH || echo "[ERR] Something went wrong in publishing the package. Now aborting." -if [ ! -z $UPDVER ]; then +cd build +PKGFILES=($(ls *.deb)) +cd .. +mv build/*.deb $wd/$PACKAGE_PATH/ || echo "[ERR] Something went wrong in publishing the package. Now aborting." + +NOTONBUILDSERVER=0 +gitlab-runner -v 2&>> /dev/null || NOTONBUILDSERVER=$? +if [[ $NOTONBUILDSERVER == 0 ]]; then + mkdir -p $REPO_DIR_SRC + cd $REPO_DIR_SRC for pkgfile in $PKGFILES; do - ln -sf $wd/$PACKAGE_PATH/$pkgfile $wd/$PACKAGE_PATH/$pkgfile-latest + cp -v $wd/$PACKAGE_PATH/$pkgfile $REPO_DIR_SRC + for variant in $HOST_DISTR_VERSIONS; do + ls $pkgfile | grep $variant && DISTR_CODENAME=$variant #Since we add a postfix into every debpackage done, we'll extract it that way. + done + repack $pkgfile done - export -n "UPDVER" + cd $REPO_DIR + echo "Attempting to add packages into $DISTR_VARIANT section to $DISTR_CODENAME" + sudo reprepro -C "$DISTR_COMPONENT" --ask-passphrase includedeb "$DISTR_CODENAME" $REPO_DIR_SRC/*.deb + #Update into reprepro: + #Need to create latest symlink to the project. fi - + export -n "UPDVER" +rm -r $REPO_DIR_SRC +cd $wd #symlink name-actual to the latest version. #build/deb/versions - for all files #build/deb/${PROJECT}-latest - for symlinks. diff --git a/prod_build/linux/debian/scripts/pre-build.sh b/prod_build/linux/debian/scripts/pre-build.sh index 27dae1c146e17145935306d03a914ed61d6de982..de77908127cd25d1417536ccdf22b3b3235c5e89 100755 --- a/prod_build/linux/debian/scripts/pre-build.sh +++ b/prod_build/linux/debian/scripts/pre-build.sh @@ -93,7 +93,9 @@ extract_version_number ### This is a solution. We modify the changelog only if there are updates and not on build servers. And of course if it's not cmake-based build project. ### let's keep those comments here for a while -if [ $( gitlab-runner -v 2> /dev/null ; echo $? ) == 0 ]; then +NOTONBUILDSERVER=0 +gitlab-runner -v 2&>>/dev/null || NOTONBUILDSERVER=$? +if [ $NOTONBUILDSERVER == 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 [ ! -e debian/changelog ]; then ### I guess this what's supposed to be added in order to solve the issue with the changelog?+ @@ -124,8 +126,10 @@ CHROOT_PREFIX=$1 for distr in $HOST_DISTR_VERSIONS; do #we need to install required dependencies under schroot. for arch in $HOST_ARCH_VERSIONS; do echo "$CHROOT_PREFIX-$distr-$arch" - schroot -c $CHROOT_PREFIX-$distr-$arch -- prod_build/linux/debian/scripts/chroot/pre-build.sh "$PKG_DEPS" + schroot -c $CHROOT_PREFIX-$distr-$arch -- prod_build/linux/debian/scripts/chroot/pre-build.sh "$PKG_DEPS" || errcode=$? + [[ $errcode != 0 ]] && echo "Problems with $CHROOT_PREFIX-$distr-$arch occured. You had installed it, right?" done done +exit 0 ## Maybe we do have the version required? Then we don't need to build it again. CHECK IT THERE!