From d7f382d0e0747ccb183e11bba36c13005014a506 Mon Sep 17 00:00:00 2001 From: Willy Sudiarto Raharjo Date: Sun, 26 Jun 2016 00:40:42 +0700 Subject: [PATCH] Add option for source checking (default: OFF). Signed-off-by: Willy Sudiarto Raharjo --- mate-build-base.sh | 19 ++++++++++++------- mate-build-deps.sh | 19 ++++++++++++------- mate-build-extra.sh | 19 ++++++++++++------- testing/mate-build-testing.sh | 19 ++++++++++++------- 4 files changed, 48 insertions(+), 28 deletions(-) diff --git a/mate-build-base.sh b/mate-build-base.sh index 0674722..ccd834c 100755 --- a/mate-build-base.sh +++ b/mate-build-base.sh @@ -37,6 +37,9 @@ OUTPUT=${OUTPUT:-/tmp} # This is the original directory where you started this script MSBROOT=$(pwd) +# Check for duplicate sources (default: OFF) +CHECKDUPLICATE=0 + # Loop for all base packages for dir in \ base/mate-common \ @@ -76,13 +79,15 @@ for dir in \ # Get the build build=$(cat ${package}.SlackBuild | grep "BUILD:" | cut -d "-" -f2 | rev | cut -c 2- | rev) - # Check for duplicate sources - sourcefile="$(ls -l $MSBROOT/$dir/${package}-*.tar.?z* 2>/dev/null | wc -l)" - if [ $sourcefile -gt 1 ]; then - echo "You have following duplicate sources:" - ls $MSBROOT/$dir/${package}-*.tar.?z* | cut -d " " -f1 - echo "Please delete sources other than ${package}-$version to avoid problems" - exit 1 + if [ $CHECKDUPLICATE -eq 1 ]; then + # Check for duplicate sources + sourcefile="$(ls -l $MSBROOT/$dir/${package}-*.tar.?z* 2>/dev/null | wc -l)" + if [ $sourcefile -gt 1 ]; then + echo "You have following duplicate sources:" + ls $MSBROOT/$dir/${package}-*.tar.?z* | cut -d " " -f1 + echo "Please delete sources other than ${package}-$version to avoid problems" + exit 1 + fi fi # The real build starts here diff --git a/mate-build-deps.sh b/mate-build-deps.sh index cc3ca2a..8fde357 100755 --- a/mate-build-deps.sh +++ b/mate-build-deps.sh @@ -36,6 +36,9 @@ OUTPUT=${OUTPUT:-/tmp} # This is the original directory where you started this script MSBROOT=$(pwd) +# Check for duplicate sources (default: OFF) +CHECKDUPLICATE=0 + # Loop for all dependency packages for dir in \ deps/zenity \ @@ -68,13 +71,15 @@ for dir in \ # Get the build build=$(cat ${package}.SlackBuild | grep "BUILD:" | cut -d "-" -f2 | rev | cut -c 2- | rev) - # Check for duplicate sources - sourcefile="$(ls -l $MSBROOT/$dir/${package}-*.tar.?z* 2>/dev/null | wc -l)" - if [ $sourcefile -gt 1 ]; then - echo "You have following duplicate sources:" - ls $MSBROOT/$dir/${package}-*.tar.?z* | cut -d " " -f1 - echo "Please delete sources other than ${package}-$version to avoid problems" - exit 1 + if [ $CHECKDUPLICATE -eq 1 ]; then + # Check for duplicate sources + sourcefile="$(ls -l $MSBROOT/$dir/${package}-*.tar.?z* 2>/dev/null | wc -l)" + if [ $sourcefile -gt 1 ]; then + echo "You have following duplicate sources:" + ls $MSBROOT/$dir/${package}-*.tar.?z* | cut -d " " -f1 + echo "Please delete sources other than ${package}-$version to avoid problems" + exit 1 + fi fi # The real build starts here diff --git a/mate-build-extra.sh b/mate-build-extra.sh index a72f154..1f6ce11 100755 --- a/mate-build-extra.sh +++ b/mate-build-extra.sh @@ -37,6 +37,9 @@ OUTPUT=${OUTPUT:-/tmp} # This is the original directory where you started this script MSBROOT=$(pwd) +# Check for duplicate sources (default: OFF) +CHECKDUPLICATE=0 + # Loop for all extra packages for dir in \ extra/galculator \ @@ -62,13 +65,15 @@ for dir in \ # Get the build build=$(cat ${package}.SlackBuild | grep "BUILD:" | cut -d "-" -f2 | rev | cut -c 2- | rev) - # Check for duplicate sources - sourcefile="$(ls -l $MSBROOT/$dir/${package}-*.tar.?z* 2>/dev/null | wc -l)" - if [ $sourcefile -gt 1 ]; then - echo "You have following duplicate sources:" - ls $MSBROOT/$dir/${package}-*.tar.?z* | cut -d " " -f1 - echo "Please delete sources other than ${package}-$version to avoid problems" - exit 1 + if [ $CHECKDUPLICATE -eq 1 ]; then + # Check for duplicate sources + sourcefile="$(ls -l $MSBROOT/$dir/${package}-*.tar.?z* 2>/dev/null | wc -l)" + if [ $sourcefile -gt 1 ]; then + echo "You have following duplicate sources:" + ls $MSBROOT/$dir/${package}-*.tar.?z* | cut -d " " -f1 + echo "Please delete sources other than ${package}-$version to avoid problems" + exit 1 + fi fi # The real build starts here diff --git a/testing/mate-build-testing.sh b/testing/mate-build-testing.sh index faca7cb..08541c1 100644 --- a/testing/mate-build-testing.sh +++ b/testing/mate-build-testing.sh @@ -36,6 +36,9 @@ TMP=${TMP:-/tmp} # This is the original directory where you started this script MSBROOT=$(pwd) +# Check for duplicate sources (default: OFF) +CHECKDUPLICATE=0 + # Loop for all packages for dir in \ yelp \ @@ -58,13 +61,15 @@ for dir in \ # Get the build build=$(cat ${package}.SlackBuild | grep "BUILD:" | cut -d "-" -f2 | rev | cut -c 2- | rev) - # Check for duplicate sources - sourcefile="$(ls -l $MSBROOT/$dir/${package}-*.tar.?z* | wc -l)" - if [ $sourcefile -gt 1 ]; then - echo "You have following duplicate sources:" - ls $MSBROOT/$dir/${package}-*.tar.?z* | cut -d " " -f1 - echo "Please delete sources other than ${package}-$version to avoid problems" - exit 1 + if [ $CHECKDUPLICATE -eq 1 ]; then + # Check for duplicate sources + sourcefile="$(ls -l $MSBROOT/$dir/${package}-*.tar.?z* | wc -l)" + if [ $sourcefile -gt 1 ]; then + echo "You have following duplicate sources:" + ls $MSBROOT/$dir/${package}-*.tar.?z* | cut -d " " -f1 + echo "Please delete sources other than ${package}-$version to avoid problems" + exit 1 + fi fi # The real build starts here