From e042be058117570abc25d89cf201b571213daa2a Mon Sep 17 00:00:00 2001 From: Ondrej Mosnacek Date: Oct 12 2020 06:38:28 +0000 Subject: make-rhat-patches: Use shallow clone The selinux-policy repos are quite big - use --depth=1 to fetch only the latest commit of the requested branch, to save network traffic and time. A possible downside of this is that one can no longer pass a commit ID via REPO_SELINUX_POLICY_*BRANCH, but that's unlikely to be useful in practice. Signed-off-by: Ondrej Mosnacek --- diff --git a/make-rhat-patches.sh b/make-rhat-patches.sh index b680491..870915a 100755 --- a/make-rhat-patches.sh +++ b/make-rhat-patches.sh @@ -23,14 +23,15 @@ git checkout $DISTGIT_BRANCH -q POLICYSOURCES=`mktemp -d --tmpdir policysources.XXXXXX` pushd $POLICYSOURCES > /dev/null -git clone -q $REPO_SELINUX_POLICY selinux-policy -git clone -q $REPO_SELINUX_POLICY_CONTRIB selinux-policy-contrib -git clone -q $REPO_CONTAINER_SELINUX container-selinux -git clone -q $REPO_MACRO_EXPANDER macro-expander +git clone --depth=1 -q $REPO_SELINUX_POLICY selinux-policy \ + -b $REPO_SELINUX_POLICY_BRANCH +git clone --depth=1 -q $REPO_SELINUX_POLICY_CONTRIB selinux-policy-contrib \ + -b $REPO_SELINUX_POLICY_CONTRIB_BRANCH +git clone --depth=1 -q $REPO_CONTAINER_SELINUX container-selinux +git clone --depth=1 -q $REPO_MACRO_EXPANDER macro-expander pushd selinux-policy > /dev/null # prepare policy patches against upstream commits matching the last upstream merge -git checkout $REPO_SELINUX_POLICY_BRANCH BASE_HEAD_ID=$(git rev-parse HEAD) BASE_SHORT_HEAD_ID=$(c=${BASE_HEAD_ID}; echo ${c:0:7}) git archive --prefix=selinux-policy-$BASE_HEAD_ID/ --format tgz HEAD > $DISTGIT_PATH/selinux-policy-$BASE_SHORT_HEAD_ID.tar.gz @@ -38,7 +39,6 @@ popd > /dev/null pushd selinux-policy-contrib > /dev/null # prepare policy patches against upstream commits matching the last upstream merge -git checkout $REPO_SELINUX_POLICY_CONTRIB_BRANCH CONTRIB_HEAD_ID=$(git rev-parse HEAD) CONTRIB_SHORT_HEAD_ID=$(c=${CONTRIB_HEAD_ID}; echo ${c:0:7}) git archive --prefix=selinux-policy-contrib-$CONTRIB_HEAD_ID/ --format tgz HEAD > $DISTGIT_PATH/selinux-policy-contrib-$CONTRIB_SHORT_HEAD_ID.tar.gz