diff --git a/.gitmodules b/.gitmodules index b797673..bb1d840 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,16 +1,20 @@ [submodule "bitbake"] path = bitbake url = ssh://git@bitbucket.gad.local:7999/ico/bitbake.git + upstream-url = https://git.openembedded.org/bitbake/ branch = 2.0 [submodule "layers/openembedded-core"] path = layers/openembedded-core url = ssh://git@bitbucket.gad.local:7999/ico/openembedded-core.git + upstream-url = https://git.openembedded.org/openembedded-core branch = kirkstone [submodule "layers/meta-openembedded"] path = layers/meta-openembedded url = ssh://git@bitbucket.gad.local:7999/ico/meta-openembedded.git + upstream-url = https://git.openembedded.org/meta-openembedded branch = kirkstone [submodule "layers/meta-virtualization"] path = layers/meta-virtualization url = ssh://git@bitbucket.gad.local:7999/ico/meta-virtualization.git + upstream-url = https://git.yoctoproject.org/meta-virtualization branch = kirkstone diff --git a/scripts/_coreos-update-submodule-internal b/scripts/_coreos-update-submodule-internal new file mode 100755 index 0000000..d32060f --- /dev/null +++ b/scripts/_coreos-update-submodule-internal @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +set -e + +# This is run by git submodule foreach inside the coreos-update-submodule script +# Some info is passed via variable. +if [ -z "$sm_path" ]; then + echo "This scripts should not be run directly" + exit 1 +fi + +UPSTREAM_URL=$(git config --file "${toplevel}/.gitmodules" --get "submodule.${name}.upstream-url") +DOWNSTREAM_URL=$(git config --file "${toplevel}/.gitmodules" --get "submodule.${name}.url") +TRACKING_BRANCH=$(git config --file "${toplevel}/.gitmodules" --get "submodule.${name}.branch") + +echo "Pull $TRACKING_BRANCH from ${UPSTREAM_URL} and pushing to ${DOWNSTREAM_URL}" + +git pull "${UPSTREAM_URL}" "${TRACKING_BRANCH}" --ff-only +git push "${DOWNSTREAM_URL}" "${TRACKING_BRANCH}" + diff --git a/scripts/coreos-update-submodule b/scripts/coreos-update-submodule new file mode 100755 index 0000000..2bdf2ac --- /dev/null +++ b/scripts/coreos-update-submodule @@ -0,0 +1,38 @@ +#!/usr/bin/env bash + +set -e + +echo "Updating layers" + +# First we go to the root git repository. This will fail if we are not inside +# a repository +gitdir=$(git rev-parse --show-toplevel) +echo "Root Git directory found at $gitdir" +cd $gitdir + +# Ensure we are inside the CoreOS repository + +if ! [ -f "coreos-init-build-env" ]; then + echo "We are not inside the CoreOS repository" + exit 1 +fi + +echo "This script will update each submodule by pulling from the upstream url" +echo "Then the internal mirror on bitbucket.gad.local will be updated" + +printf 'Do you want to proceed (y/n)? ' +read answer + +if ! [ "$answer" != "${answer#[Yy]}" ] ; then + exit 1 +fi + + +echo "Update all submodule to latest commit, using the tracking branch..." + +git submodule foreach "_coreos-update-submodule-internal" + +echo "All submodule are updated, internal mirror are up to date" +echo "You can now use git add and git commit to push changes to CoreOS" + +git status \ No newline at end of file