From a43aee1de0b95c7f482e5bf5aec66417985f863e Mon Sep 17 00:00:00 2001 From: Boris Ranto Date: Wed, 26 Oct 2016 15:26:46 +0200 Subject: [PATCH] kernel: various fixes - rename ARCH to DEB_ARCH to avoid overriding kernel ARCH variable in Makefile - rename SHA1 to GIT_COMMIT, we do not set SHA1 anywhere - generate the kernel config with a script - deb files are stored in ../, clean ../, clean-up first to upload only new ../*.deb files - rpm files are stored in ~/rpmbuild, clean-up first to upload only new rpm files - remove precise from default distros as we do not seem to have any huge precise machines lying around at the moment - add trusty to default distros Signed-off-by: Boris Ranto --- kernel/build/build_deb | 20 ++++++++++--------- kernel/build/build_rpm | 13 ++++++------ ...g-deb.basic => kernel-config-deb.basic.sh} | 4 ++++ ...g-rpm.basic => kernel-config-rpm.basic.sh} | 4 ++++ ...el-config.debug => kernel-config.debug.sh} | 4 ++++ kernel/build/setup | 6 ++++++ kernel/config/definitions/kernel.yml | 2 ++ 7 files changed, 37 insertions(+), 16 deletions(-) rename kernel/build/{kernel-config-deb.basic => kernel-config-deb.basic.sh} (99%) mode change 100644 => 100755 rename kernel/build/{kernel-config-rpm.basic => kernel-config-rpm.basic.sh} (99%) mode change 100644 => 100755 rename kernel/build/{kernel-config.debug => kernel-config.debug.sh} (99%) mode change 100644 => 100755 diff --git a/kernel/build/build_deb b/kernel/build/build_deb index 7ce35222..5cfbda03 100644 --- a/kernel/build/build_deb +++ b/kernel/build/build_deb @@ -35,7 +35,7 @@ chacra_ref="$BRANCH" [ "$RC" = true ] && chacra_ref="$BRANCH-rc" [ "$TEST" = true ] && chacra_ref="test" -ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH) +DEB_ARCH=$(dpkg-architecture -qDEB_BUILD_ARCH) DISTRO="" case $DIST in jessie|wheezy) @@ -67,8 +67,8 @@ gen_debian_version() { BPVER=`gen_debian_version $debian_version $DIST` -chacra_endpoint="kernel/${BRANCH}/${SHA1}/${DISTRO}/${DIST}" -chacra_check_url="${chacra_endpoint}/kernel_${BPVER}_${ARCH}.deb" +chacra_endpoint="kernel/${BRANCH}/${GIT_COMMIT}/${DISTRO}/${DIST}" +chacra_check_url="${chacra_endpoint}/kernel_${BPVER}_${DEB_ARCH}.deb" if [ "$THROWAWAY" = false ] ; then # this exists in scripts/build_utils.sh @@ -78,21 +78,23 @@ fi HOST=$(hostname --short) echo "Building on $(hostname)" echo " DIST=${DIST}" -echo " ARCH=${ARCH}" +echo " DEB_ARCH=${DEB_ARCH}" echo " WS=$WORKSPACE" echo " PWD=$(pwd)" echo "*****" env echo "*****" -# Clean the git repo -git clean -fxd +# Install build dependencies +sudo apt-get install -y bc # Prep the config -echo "Preparing the kernel config" -cp "$(dirname $0)/kernel-config-deb.basic" .config +echo "Updating the default debian kernel config" yes "" | make oldconfig # Update with defaults for new options +# Clean the upper level debs +rm -f ../*.deb + # Build the rpms echo "Building DEBs" make deb-pkg @@ -104,7 +106,7 @@ cd "$WORKSPACE" if [ "$THROWAWAY" = false ] ; then # push binaries to chacra - find ./ | egrep "*\.(changes|deb|dsc|gz)$" | egrep -v "(Packages|Sources|Contents)" | $VENV/chacractl binary ${chacra_flags} create ${chacra_endpoint}/${ARCH}/ + find ../*.deb | $VENV/chacractl binary ${chacra_flags} create ${chacra_endpoint}/${DEB_ARCH}/ # start repo creation $VENV/chacractl repo update ${chacra_endpoint} diff --git a/kernel/build/build_rpm b/kernel/build/build_rpm index cd247ddb..98751ea7 100644 --- a/kernel/build/build_rpm +++ b/kernel/build/build_rpm @@ -55,7 +55,7 @@ get_rpm_dist() { get_rpm_dist -chacra_endpoint="kernel/${BRANCH}/${SHA1}/${DISTRO}/${RELEASE}" +chacra_endpoint="kernel/${BRANCH}/${GIT_COMMIT}/${DISTRO}/${RELEASE}" chacra_check_url="${chacra_endpoint}/${ARCH}/kernel-${VERSION}-${RPM_RELEASE}.${DIST}.${ARCH}.rpm" if [ "$THROWAWAY" = false ] ; then @@ -73,14 +73,13 @@ echo "*****" env echo "*****" -# Clean the git repo -git clean -fxd - # Prep the config -echo "Preparing the kernel config" -cp "$(dirname $0)/kernel-config-rpm.basic" .config +echo "Updating the default kernel config for rpm-based distros" yes "" | make oldconfig # Update with defaults for new options +# Clean rpmbuild structure +rm -rf ~/rpmbuild/ + # Build the rpms echo "Building RPMs" make rpm-pkg @@ -92,7 +91,7 @@ cd "$WORKSPACE" if [ "$THROWAWAY" = false ] ; then # push binaries to chacra - find ./ | egrep '\.rpm$' | $VENV/chacractl binary ${chacra_flags} create ${chacra_endpoint}/$ARCH/ + find ~/rpmbuild/ | egrep '\.rpm$' | $VENV/chacractl binary ${chacra_flags} create ${chacra_endpoint}/$ARCH/ # start repo creation $VENV/chacractl repo update ${chacra_endpoint} diff --git a/kernel/build/kernel-config-deb.basic b/kernel/build/kernel-config-deb.basic.sh old mode 100644 new mode 100755 similarity index 99% rename from kernel/build/kernel-config-deb.basic rename to kernel/build/kernel-config-deb.basic.sh index 708b9a4d..9b7b703f --- a/kernel/build/kernel-config-deb.basic +++ b/kernel/build/kernel-config-deb.basic.sh @@ -1,3 +1,6 @@ +#! /usr/bin/env bash + +cat > .config << EOF # # Automatically generated file; DO NOT EDIT. # Linux/x86 3.19.0 Kernel Configuration @@ -4906,3 +4909,4 @@ CONFIG_FONT_SUPPORT=y CONFIG_FONT_8x16=y CONFIG_FONT_AUTOSELECT=y CONFIG_ARCH_HAS_SG_CHAIN=y +EOF diff --git a/kernel/build/kernel-config-rpm.basic b/kernel/build/kernel-config-rpm.basic.sh old mode 100644 new mode 100755 similarity index 99% rename from kernel/build/kernel-config-rpm.basic rename to kernel/build/kernel-config-rpm.basic.sh index 195c6da1..c5a75baa --- a/kernel/build/kernel-config-rpm.basic +++ b/kernel/build/kernel-config-rpm.basic.sh @@ -1,3 +1,6 @@ +#! /usr/bin/env bash + +cat > .config << EOF # # Automatically generated file; DO NOT EDIT. # Linux/x86 3.19.0 Kernel Configuration @@ -4519,3 +4522,4 @@ CONFIG_FONT_SUPPORT=y CONFIG_FONT_8x16=y CONFIG_FONT_AUTOSELECT=y CONFIG_ARCH_HAS_SG_CHAIN=y +EOF diff --git a/kernel/build/kernel-config.debug b/kernel/build/kernel-config.debug.sh old mode 100644 new mode 100755 similarity index 99% rename from kernel/build/kernel-config.debug rename to kernel/build/kernel-config.debug.sh index 3231eeea..f3b9821a --- a/kernel/build/kernel-config.debug +++ b/kernel/build/kernel-config.debug.sh @@ -1,3 +1,6 @@ +#! /usr/bin/env bash + +cat > debug.config << EOF # # Automatically generated make config: don't edit # Linux/x86_64 2.6.38 Kernel Configuration @@ -4976,3 +4979,4 @@ CONFIG_CHECK_SIGNATURE=y CONFIG_NLATTR=y CONFIG_LRU_CACHE=m CONFIG_AVERAGE=y +EOF diff --git a/kernel/build/setup b/kernel/build/setup index bccd321c..6aeeffc3 100644 --- a/kernel/build/setup +++ b/kernel/build/setup @@ -60,3 +60,9 @@ install_python_packages "pkgs[@]" chacra_url=`curl -f -u $SHAMAN_API_USER:$SHAMAN_API_KEY https://shaman.ceph.com/api/nodes/next/` # create the .chacractl config file using global variables make_chacractl_config $chacra_url + +# Make sure we execute at the top level directory +cd "$WORKSPACE" + +# Clean the git repo +git clean -fxd diff --git a/kernel/config/definitions/kernel.yml b/kernel/config/definitions/kernel.yml index 93bce197..d9e1ea6d 100644 --- a/kernel/config/definitions/kernel.yml +++ b/kernel/config/definitions/kernel.yml @@ -100,6 +100,7 @@ If this is checked, then the binaries will be built and pushed to chacra even if - ../../build/validate_deb - ../../../scripts/build_utils.sh - ../../build/setup + - ../../build/kernel-config-deb.basic.sh - ../../build/build_deb # rpm build scripts - shell: @@ -107,6 +108,7 @@ If this is checked, then the binaries will be built and pushed to chacra even if - ../../build/validate_rpm - ../../../scripts/build_utils.sh - ../../build/setup + - ../../build/kernel-config-rpm.basic.sh - ../../build/build_rpm wrappers: -- 2.39.5