From d745ca9eae6bdefe7ae3bfcc5777cde7682befd2 Mon Sep 17 00:00:00 2001 From: Daniel Reurich Date: Thu, 2 Jul 2015 18:20:10 +1200 Subject: [PATCH] limit git srch depth and width --- scripts/generate-git-snapshot | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/generate-git-snapshot b/scripts/generate-git-snapshot index 793f5bb..ce2dbd6 100755 --- a/scripts/generate-git-snapshot +++ b/scripts/generate-git-snapshot @@ -1,3 +1,4 @@ + #!/bin/bash set -x @@ -19,6 +20,7 @@ if [ ! -d "${SOURCE_DIRECTORY}" ] ; then exit 1 fi + if [ -z "${BUILD_NUMBER:-}" ] ; then echo "No BUILD_NUMBER defined, please run it in jenkins." >&2 exit 1 @@ -344,6 +346,26 @@ quilt_cleanup() { rm -rf .pc } +git_source_options() { + #Unless otherwise specified in the debian/source/options + # restrict git source archive depth and limit to only the branch we build. + GIT_DEPTH=20 + local file + local value + file="debian/source/options" + if [ -f ${file} ]; then + value=$(git config --file ${file} --get git-depth 2>&- || true) + if [ -n "${value:-}" ]; then + DBP_EXTRA_OPTS="${DBP_EXTRA_OPTS:-} --source-option=--git-depth=$GIT_DEPTH" + fi + value=$(git config --file ${file} --get git-ref 2>&- || true) + if ![ -n "${value:-}" ]; then + DBP_EXTRA_OPTS="${DBP_EXTRA_OPTS:-} --source-option=--git-ref=${BRANCH} + fi + fi +} + + source_format_opts() { if ! [ -f "debian/source/format" ] ; then echo '*** WARNING: Source format is not specified in debian/source/format! ***' @@ -359,6 +381,7 @@ source_format_opts() { ;; '3.0 (git)') echo "*** Source format detected as 3.0 (git) ***" + git_source_options() PRISTINE_TAR=false SKIP_QUILT_CLEANUP=true IGNORE_GIT_BUILDPACKAGE=true