build.sh: Improve support for building for testing

pull/18/head
Jesus Alvarez 11 years ago
parent c19acf2dcb
commit 95e4da35e9
  1. 46
      build.sh

@ -10,6 +10,7 @@
# Defaults, don't edit these.
AZB_PKG_LIST="spl-utils spl zfs-utils zfs"
AZB_UPDATE_PKGBUILDS=""
AZB_UPDATE_TEST_PKGBUILDS=""
AZB_BUILD=0
AZB_CHROOT_UPDATE=""
AZB_SIGN=""
@ -41,6 +42,7 @@ usage() {
echo " make Build all packages."
echo " test Build test packages."
echo " update Update all PKGBUILDs using conf.sh variables."
echo " update-test Update all PKGBUILDs using the testing conf.sh variables."
echo " sign GPG detach sign all compiled packages (default)."
echo
echo "Examples:"
@ -49,7 +51,7 @@ usage() {
echo " build.sh -C :: Remove all compiled packages"
echo " build.sh update :: Update PKGBUILDS only"
echo " build.sh update make -u :: Update PKGBUILDs, update the chroot, and make all of the packages"
echo " build.sh update test -u :: Update PKGBUILDs (use testing versions), update the chroot, and make all of the packages"
echo " build.sh update-test test -u :: Update PKGBUILDs (use testing versions), update the chroot, and make all of the packages"
}
sed_escape_input_string() {
@ -66,11 +68,10 @@ build_sources() {
}
sign_packages() {
if [[ $AZB_BUILD ]]; then
FILES=$(find $PWD -iname "*${AZB_ZOL_VERSION}_${AZB_LINUX_VERSION}-${AZB_PKGREL}*.pkg.tar.xz")
elif [[ $AZB_BUILD_TEST ]]; then
FILES=$(find $PWD -iname "*${AZB_ZOL_VERSION}_${AZB_LINUX_TEST_VERSION}-${AZB_PKGREL}*.pkg.tar.xz")
fi
FILES1=$(find $PWD -iname "*${AZB_LINUX_FULL_VERSION}*.pkg.tar.xz")
FILES2=$(find $PWD -iname "*${AZB_LINUX_TEST_FULL_VERSION}*.pkg.tar.xz")
FILES=$FILES1$FILES2
debug "Found FILES: ${FILES}"
msg "Signing the packages with GPG"
for F in $FILES; do
msg2 "Signing $F"
@ -79,9 +80,9 @@ sign_packages() {
}
update_pkgbuilds() {
AZB_CURRENT_PKGVER=$(grep "pkgver=" zfs/PKGBUILD | cut -d= -f2 | cut -d_ -f1)
AZB_CURRENT_PKGVER=$(grep "pkgver=" zfs/PKGBUILD | cut -d= -f2)
AZB_CURRENT_PKGREL=$(grep "pkgrel=" zfs/PKGBUILD | cut -d= -f2)
AZB_CURRENT_ZOLVER=$(sed_escape_input_string $AZB_CURRENT_PKGVER)
AZB_CURRENT_ZOLVER=$(sed_escape_input_string $(echo $AZB_CURRENT_PKGVER | cut -d_ -f1))
AZB_CURRENT_SPL_DEPVER=$(grep "spl=" zfs/PKGBUILD | cut -d\" -f2 | cut -d= -f2)
AZB_CURRENT_X32_LINUX_VERSION=$(grep "LINUX_VERSION_X32=" zfs/PKGBUILD | cut -d\" -f2)
AZB_CURRENT_X64_LINUX_VERSION=$(grep "LINUX_VERSION_X64=" zfs/PKGBUILD | cut -d\" -f2)
@ -96,39 +97,39 @@ update_pkgbuilds() {
# Change the top level AZB_PKGREL
run_cmd "find . -iname \"PKGBUILD\" -print | xargs sed -i \"s/pkgrel=$AZB_CURRENT_PKGREL/pkgrel=$AZB_PKGREL/g\""
if [[ $AZB_BUILD ]]; then
if [[ $AZB_UPDATE_PKGBUILDS ]]; then
# Change the spl version number in zfs/PKGBUILD
run_cmd "sed -i \"s/$AZB_CURRENT_SPL_DEPVER/$AZB_LINUX_FULL_VERSION/g\" zfs/PKGBUILD"
run_cmd "sed -i \"s/spl=$AZB_CURRENT_SPL_DEPVER/spl=$AZB_LINUX_FULL_VERSION/g\" zfs/PKGBUILD"
# Change LINUX_VERSION_XXX
run_cmd "find . -iname \"PKGBUILD\" -print | xargs sed -i \
\"s/LINUX_VERSION_X32=\\\"$AZB_CURRENT_X32_LINUX_VERSION\\\"/LINUX_VERSION_X32=\\\"$AZB_LINUX_X32_VERSION_FULL\\\"/g\""
\"s/LINUX_VERSION_X32=\\\"$AZB_CURRENT_X32_LINUX_VERSION\\\"/LINUX_VERSION_X32=\\\"$AZB_LINUX_X32_VERSION\\\"/g\""
run_cmd "find . -iname \"PKGBUILD\" -print | xargs sed -i \
\"s/LINUX_VERSION_X64=\\\"$AZB_CURRENT_X64_LINUX_VERSION\\\"/LINUX_VERSION_X64=\\\"$AZB_LINUX_X64_VERSION_FULL\\\"/g\""
\"s/LINUX_VERSION_X64=\\\"$AZB_CURRENT_X64_LINUX_VERSION\\\"/LINUX_VERSION_X64=\\\"$AZB_LINUX_X64_VERSION\\\"/g\""
# Replace the ZFS version
run_cmd "find . -iname \"PKGBUILD\" -print | xargs sed -i \"s/$AZB_CURRENT_ZOLVER/$AZB_ZOL_VERSION/g\""
# Replace the linux version in the top level PKGVER
run_cmd "find . -iname \"PKGBUILD\" -print | xargs sed -i \"s/_$AZB_CURRENT_PKGVER/_$AZB_LINUX_VERSION/g\""
run_cmd "find . -iname \"PKGBUILD\" -print | xargs sed -i \"s/pkgver=$AZB_CURRENT_PKGVER/pkgver=$AZB_LINUX_PKG_VERSION/g\""
elif [[ $AZB_BUILD_TEST ]]; then
elif [[ $AZB_UPDATE_TEST_PKGBUILDS ]]; then
# Change the spl version number in zfs/PKGBUILD
run_cmd "sed -i \"s/$AZB_CURRENT_SPL_DEPVER/$AZB_LINUX_TEST_FULL_VERSION/g\" zfs/PKGBUILD"
run_cmd "sed -i \"s/spl=$AZB_CURRENT_SPL_DEPVER/spl=$AZB_LINUX_TEST_FULL_VERSION/g\" zfs/PKGBUILD"
# Change LINUX_VERSION_XXX
run_cmd "find . -iname \"PKGBUILD\" -print | xargs sed -i \
\"s/LINUX_VERSION_X32=\\\"$AZB_CURRENT_X32_LINUX_VERSION\\\"/LINUX_VERSION_X32=\\\"$AZB_LINUX_TEST_X32_VERSION_FULL\\\"/g\""
\"s/LINUX_VERSION_X32=\\\"$AZB_CURRENT_X32_LINUX_VERSION\\\"/LINUX_VERSION_X32=\\\"$AZB_LINUX_TEST_X32_VERSION\\\"/g\""
run_cmd "find . -iname \"PKGBUILD\" -print | xargs sed -i \
\"s/LINUX_VERSION_X64=\\\"$AZB_CURRENT_X64_LINUX_VERSION\\\"/LINUX_VERSION_X64=\\\"$AZB_LINUX_TEST_X64_VERSION_FULL\\\"/g\""
\"s/LINUX_VERSION_X64=\\\"$AZB_CURRENT_X64_LINUX_VERSION\\\"/LINUX_VERSION_X64=\\\"$AZB_LINUX_TEST_X64_VERSION\\\"/g\""
# Replace the ZFS version
run_cmd "find . -iname \"PKGBUILD\" -print | xargs sed -i \"s/$AZB_CURRENT_ZOLVER/$AZB_ZOL_VERSION/g\""
# Replace the linux version in the top level PKGVER
run_cmd "find . -iname \"PKGBUILD\" -print | xargs sed -i \"s/_$AZB_CURRENT_PKGVER/_$AZB_LINUX_TEST_VERSION/g\""
run_cmd "find . -iname \"PKGBUILD\" -print | xargs sed -i \"s/pkgver=$AZB_CURRENT_PKGVER/pkgver=$AZB_LINUX_TEST_PKG_VERSION/g\""
fi
@ -151,6 +152,8 @@ for (( a = 0; a < $#; a++ )); do
AZB_BUILD_TEST=1
elif [[ ${ARGS[$a]} == "update" ]]; then
AZB_UPDATE_PKGBUILDS=1
elif [[ ${ARGS[$a]} == "update-test" ]]; then
AZB_UPDATE_TEST_PKGBUILDS=1
elif [[ ${ARGS[$a]} == "sign" ]]; then
AZB_SIGN=1
elif [[ ${ARGS[$a]} == "-h" ]]; then
@ -169,7 +172,7 @@ done
msg "build.sh started..."
if [[ $AZB_UPDATE_PKGBUILDS == 1 ]]; then
if [[ $AZB_UPDATE_PKGBUILDS == 1 || $AZB_UPDATE_TEST_PKGBUILDS == 1 ]]; then
update_pkgbuilds
fi
@ -186,15 +189,16 @@ if [[ $AZB_BUILD_TEST == 1 ]]; then
for PKG in $AZB_PKG_LIST; do
msg "Building $PKG..."
run_cmd "cd \"$PWD/$PKG\""
run_cmd "sudo ccm32 t"
# run_cmd "sudo ccm32 t"
run_cmd "sudo ccm32 s"
run_cmd "sudo ccm64 t"
# run_cmd "sudo ccm64 t"
run_cmd "sudo ccm64 s"
run_cmd "cd - > /dev/null"
done
build_sources
sign_packages
fi
if [[ $AZB_BUILD == 1 ]]; then
if [ -n "$AZB_CHROOT_UPDATE" ]; then
msg "Updating the i686 and x86_64 clean chroots..."

Loading…
Cancel
Save