From 846eb90e7dd62ad89decf33a41715a8cce76d433 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Tue, 20 Mar 2018 22:09:20 +0100 Subject: core: add option "test-patches" in script build-debian.sh --- tools/build-debian.sh | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) (limited to 'tools/build-debian.sh') diff --git a/tools/build-debian.sh b/tools/build-debian.sh index 32e084642..589dba471 100755 --- a/tools/build-debian.sh +++ b/tools/build-debian.sh @@ -33,6 +33,9 @@ # 1. version devel, devel-2, stable, stable-2, 1.9, 1.9-2 # 2. distro type/name debian/sid, ubuntu/artful, raspbian/stretch # +# The script can also just check that all Debian/Ubuntu patches apply fine +# with a single argument: "test-patches". +# # Examples: # # …/build-debian.sh devel debian/sid @@ -40,6 +43,8 @@ # …/build-debian.sh 1.9 ubuntu/artful # …/build-debian.sh 1.9-2 ubuntu/zesty # +# …/build-debian.sh test-patches +# # Environment variables that can be used: # # PACKAGER_NAME Name of packager (for debian/changelog) @@ -62,11 +67,14 @@ usage () cat <<-EOF Syntax: $0 devel|stable| distro + $0 test-patches - version version to build: stable, devel or specific version - (debian package revision is allowed after name (default is 1), - for example: devel-2, stable-2, 1.9-2) - distro the distro type/name (debian/sid, ubuntu/artful, raspbian/stretch, ...) + version version to build: stable, devel or specific version + (debian package revision is allowed after name (default is 1), + for example: devel-2, stable-2, 1.9-2) + distro the distro type/name (debian/sid, ubuntu/artful, raspbian/stretch, ...) + + test-patches test that all Debian/Ubuntu patches apply fine (with git apply --check) IMPORTANT: the current OS must match the distro, and the WeeChat sources must be checkouted in the appropriate version (this script @@ -78,6 +86,7 @@ Examples: $0 stable debian/stretch $0 1.9 ubuntu/artful $0 1.9-2 ubuntu/zesty + $0 test-patches EOF exit ${RC} @@ -95,6 +104,20 @@ error_usage () usage 1 } +test_patches () +{ + set +e + RET_CODE=0 + for file in ${ROOT_DIR}/tools/debian/patches/*.patch; do + echo "=== Testing patch ${file} ===" + git apply --check "${file}" + if [ $? -ne 0 ]; then + RET_CODE=1 + fi + done + exit ${RET_CODE} +} + # ================================== START ================================== # package name/email @@ -118,6 +141,10 @@ cd "${ROOT_DIR}" if [ $# -eq 0 ]; then usage 0 fi +if [ "$1" = "test-patches" ]; then + test_patches + exit 0 +fi if [ $# -lt 2 ]; then error_usage "missing arguments" fi -- cgit v1.2.3