Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OXT-1073 : mirror upstream layer repos #240

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion build-scripts/oe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,22 @@ if [ ! -d openxt ] ; then
cd openxt

# Fetch the "upstream" layers
# Initialise the submodules using .gitmodules

git submodule init

# Initialise the submodules from the local git mirror by updating .git/config
# If there is a copy of the submodule in the local git mirror, use it.
for SUBMODULE in $(git config -f .gitmodules --get-regexp path | cut -f2 -d' ')
do
REPONAME=${SUBMODULE##*/}
MIRROR_URL="git://${HOST_IP}/${BUILD_USER}/${REPONAME}"
# Detect presence of a mirror repo by using git's ls-remote command:
if git ls-remote "${MIRROR_URL}" >/dev/null 2>/dev/null
then
git config -f .git/config --replace-all submodule."${SUBMODULE}".url "${MIRROR_URL}"
fi
done

# Clone the submodules, using their saved HEAD
git submodule update --checkout
# Update the submodules that follow a branch (update != none)
Expand Down
12 changes: 12 additions & 0 deletions build-scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,19 @@ if [ ! -d ${GIT_ROOT_PATH}/${BUILD_USER} ]; then
git clone --quiet --mirror https://github.com/OpenXT/${repo}.git
done
echo "Done"
echo "Mirroring the upstream layer repositories..."
# Obtain the URLs of the submodule repositories from a temporary clone of openxt.git
TMP_CLONE_DIR=$(mktemp -d /tmp/setup-openxt.XXXXX)
git clone --depth 1 --quiet file://${GIT_ROOT_PATH}/${BUILD_USER}/openxt.git \
"${TMP_CLONE_DIR}/openxt"
for repo_url in \
$(git config -f "${TMP_CLONE_DIR}/openxt/.gitmodules" --get-regexp url | cut -f2 -d' ')
do
git clone --quiet --mirror ${repo_url}
done
cd - > /dev/null
rm -rf ${TMP_CLONE_DIR}
echo "Done"
chown -R ${BUILD_USER}:${BUILD_USER} ${GIT_ROOT_PATH}/${BUILD_USER}
fi

Expand Down