Skip to content

Commit

Permalink
Merge .gitmodules with repos.conf (project-chip#1430)
Browse files Browse the repository at this point in the history
* Fix naming discrepancies between repos.conf & .gitmodules

The .gitmodules was unintentionally set up with different names as this
is the default for "git submodule add". Rename submodulse to use the
names chosen in repos.conf.

* Merge repos.conf with .gitmodules

These duplicate the same information. Merge them.

* Add commits to .gitmodules

This avoids having a dirty tree after running

	make -f Makefile-bootstrap repos

which was happening because repos.conf doesn't track versions.

* Add a transition script to rename submodules.

After fixing .gitmodules to use the same names as repos.conf, we need a
way to transition checkouts to the new names.

Add a sript to do this and run it from bootstrap.

* Restyle
  • Loading branch information
mspang authored Jul 3, 2020
1 parent a52635d commit abccd70
Show file tree
Hide file tree
Showing 5 changed files with 105 additions and 76 deletions.
90 changes: 54 additions & 36 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,36 +1,54 @@
[submodule "third_party/nlunit-test/repo"]
path = third_party/nlunit-test/repo
url = https://github.com/nestlabs/nlunit-test.git
ignore = dirty
[submodule "third_party/nlio/repo"]
path = third_party/nlio/repo
url = https://github.com/nestlabs/nlio.git
ignore = dirty
[submodule "third_party/nlfaultinjection/repo"]
path = third_party/nlfaultinjection/repo
url = https://github.com/nestlabs/nlfaultinjection.git
ignore = dirty
[submodule "third_party/nlassert/repo"]
path = third_party/nlassert/repo
url = https://github.com/nestlabs/nlassert.git
ignore = dirty
[submodule "third_party/mbedtls/repo"]
path = third_party/mbedtls/repo
url = https://github.com/ARMmbed/mbedtls.git
ignore = dirty
[submodule "examples/common/QRCode/repo"]
path = examples/common/QRCode/repo
url = https://github.com/nayuki/QR-Code-generator.git
ignore = dirty
[submodule "examples/common/m5stack-tft/repo"]
path = examples/common/m5stack-tft/repo
url = https://github.com/jeremyjh/ESP32_TFT_library.git
ignore = dirty
[submodule "third_party/pigweed"]
path = third_party/pigweed
url = https://pigweed.googlesource.com/pigweed/pigweed
ignore = dirty
[submodule "third_party/openthread/repo"]
path = third_party/openthread/repo
url = https://github.com/openthread/openthread
ignore = dirty
[submodule "nlassert"]
path = third_party/nlassert/repo
url = https://github.com/nestlabs/nlassert.git
branch = master
ignore = dirty
commit = bd2f082102d4456ca750189ee853fa8c7443af59
[submodule "nlfaultinjection"]
path = third_party/nlfaultinjection/repo
url = https://github.com/nestlabs/nlfaultinjection.git
branch = master
ignore = dirty
commit = 79f92f309de58c4591f53a9b492600550b473c84
[submodule "nlio"]
path = third_party/nlio/repo
url = https://github.com/nestlabs/nlio.git
branch = master
ignore = dirty
commit = dbb78fb4f188bb09ba51626341e1dffa636aa0da
[submodule "nlunit-test"]
path = third_party/nlunit-test/repo
url = https://github.com/nestlabs/nlunit-test.git
branch = master
ignore = dirty
commit = ef5a2b9a8b71ad592fcf3681968fd63c844e3d81
[submodule "mbedtls"]
path = third_party/mbedtls/repo
url = https://github.com/ARMmbed/mbedtls.git
branch = mbedtls-2.18
ignore = dirty
commit = ca933c7e0c9e84738b168b6b0feb89af4183a60a
[submodule "qrcode"]
path = examples/common/QRCode/repo
url = https://github.com/nayuki/QR-Code-generator.git
branch = master
ignore = dirty
commit = 08ac806145aa6ab5d3e9df61d023092bb6cfe761
[submodule "m5stack-tft"]
path = examples/common/m5stack-tft/repo
url = https://github.com/jeremyjh/ESP32_TFT_library.git
branch = master
ignore = dirty
commit = 3a841faacb218dbdba2f54edb251d3a64d9833fb
[submodule "pigweed"]
path = third_party/pigweed
url = https://pigweed.googlesource.com/pigweed/pigweed
branch = master
ignore = dirty
commit = 16bde6b17e0fabdf4b6877f0d62bd49d3110ee7f
[submodule "openthread"]
path = third_party/openthread/repo
url = https://github.com/openthread/openthread.git
branch = master
ignore = dirty
commit = 9e291e62ed92d1132467489c4483330c46c0bce4
8 changes: 8 additions & 0 deletions Makefile-bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -113,5 +113,13 @@ repos-hook:
#
clean-repos-hook:

# Transition submodule names.
repos: rename-submodules
clean-repos: rename-submodules
rename-submodules:
@if test -f $(top_srcdir)/scripts/helpers/rename_submodules.sh; then \
$(top_srcdir)/scripts/helpers/rename_submodules.sh; \
fi

include $(abs_top_nlbuild_autotools_dir)/make/post.mak
include $(abs_top_nlbuild_autotools_dir)/make/post/rules/bootstrap.mak
4 changes: 4 additions & 0 deletions bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ CHIP_ROOT="$(dirname "$0")"
export PW_BRANDING_BANNER="$CHIP_ROOT/.chip-banner.txt"
export PW_BRANDING_BANNER_COLOR="bold_white"

if test -f "$CHIP_ROOT/scripts/helpers/rename_submodules.sh"; then
"$CHIP_ROOT/scripts/helpers/rename_submodules.sh"
fi

git submodule update --init

# shellcheck source=/dev/null
Expand Down
40 changes: 0 additions & 40 deletions repos.conf

This file was deleted.

1 change: 1 addition & 0 deletions repos.conf
38 changes: 38 additions & 0 deletions scripts/helpers/rename_submodules.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash

#
# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

CHIP_ROOT="$(dirname "$0")/../.."

if [[ ! -e "$CHIP_ROOT/.git" ]]; then
exit 0
fi

# Transitional: Remove keys for submodules with mismatched names
OLD_SUBMODULE_KEYS='submodule\.third_party/.*|submodule\.examples/.*'

if ! git -C "$CHIP_ROOT" config --get-regexp "$OLD_SUBMODULE_KEYS" >&/dev/null; then
exit 0
fi

# Remove renamed submodules from config
git -C "$CHIP_ROOT" config --get-regexp "$OLD_SUBMODULE_KEYS" | while read key value; do
git -C "$CHP_ROOT" config --unset "$key"
done

# Re-init with new submodule names.
git submodule update --init

0 comments on commit abccd70

Please sign in to comment.