ci: Check for submodules #18056

pull emilengler wants to merge 1 commits into bitcoin:master from emilengler:2020-02-submodule-linter-check changing 1 files +20 −0
  1. emilengler commented at 8:22 pm on February 2, 2020: contributor

    See #18019. The current solution looks like this (I also tested with multiple submodules):

    0These submodules were found, delete them:
    1 355a5a310019659d9bf6818d2fd66fbb214dfed7 curl (curl-7_68_0-108-g355a5a310)
    

    The submodule example command was git submodule add https://github.com/curl/curl.git curl

  2. fanquake added the label Tests on Feb 2, 2020
  3. in test/lint/lint-submodule.sh:1 in 7029d00670 outdated
    0@@ -0,0 +1,18 @@
    1+#!/bin/sh
    


    promag commented at 0:29 am on February 3, 2020:
    0#!/usr/bin/env bash
    

    emilengler commented at 11:59 am on February 3, 2020:
    Why use bash for it? sh does the same and is more cross platform
  4. in test/lint/lint-submodule.sh:18 in 7029d00670 outdated
    13+    echo Delete the submodules:
    14+    echo $CMD
    15+    EXIT_CODE=1
    16+fi
    17+
    18+exit $EXIT_CODE
    


    promag commented at 0:29 am on February 3, 2020:
    nit, add newline.
  5. in test/lint/lint-submodule.sh:9 in 7029d00670 outdated
    0@@ -0,0 +1,18 @@
    1+#!/bin/sh
    2+#
    3+# Copyright (c) 2020 The Bitcoin Core developers
    4+# Distributed under the MIT software license, see the accompanying
    5+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
    6+export LC_ALL=C
    7+EXIT_CODE=0
    8+
    9+CMD=$(find . -type f | grep .gitmodules)
    


    promag commented at 0:31 am on February 3, 2020:
    What if this is executed in test folder?

    emilengler commented at 12:56 pm on February 3, 2020:
    Then it will only look for .gitmodules in the test folder. Is there a way to go to the root dir?
  6. promag commented at 0:32 am on February 3, 2020: member
    Concept ACK.
  7. laanwj commented at 11:43 am on February 3, 2020: member

    Concept ACK, thanks for working on this.

    Wouldn’t it be preferable to ask git directly with git submodule status instead of looking for .gitmodules (which is an implementation detail)?

  8. hebasto commented at 12:09 pm on February 3, 2020: member
    Concept ACK.
  9. jonasschnelli commented at 4:30 pm on February 6, 2020: contributor
    Concept ACK Agree with @laanwj. Looking for .gitmodule feels like a tiny layer violation.
  10. emilengler commented at 5:39 pm on February 6, 2020: contributor
    Ok, will switch to a git(1) based solution. Don’t have that much time today so I don’t know if I can do it right now.
  11. emilengler commented at 5:08 pm on February 7, 2020: contributor

    Updated the script with a git based solution. If a submodule was found it’ll look like this (I used https://github.com/curl/curl.git in this example)

    0Delete the submodules:
    15ce7102ceae250e2d31b54aad2f33b3bc35f243a curl (curl-7_68_0-99-g5ce7102ce)
    
  12. jonasschnelli commented at 5:30 pm on February 7, 2020: contributor
    utACK bb01963663d6f20ccb8966f3d4c0f8d4e0007cd4
  13. emilengler force-pushed on Feb 8, 2020
  14. emilengler commented at 2:44 pm on February 8, 2020: contributor
    Squashed
  15. MarcoFalke commented at 3:35 pm on February 9, 2020: member
    ACK 1b29eee3f29fd835a83488c855d4cf5a6a4ab4df
  16. in test/lint/lint-submodule.sh:5 in 1b29eee3f2 outdated
    0@@ -0,0 +1,18 @@
    1+#!/usr/bin/env bash
    2+#
    3+# Copyright (c) 2020 The Bitcoin Core developers
    4+# Distributed under the MIT software license, see the accompanying
    5+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
    


    hebasto commented at 9:22 am on February 10, 2020:
    It will be nice having here a description (smth like “# Check for git submodules.”) following an empty line (see other scripts in this subdir as an example).
  17. in test/lint/lint-submodule.sh:11 in 1b29eee3f2 outdated
    0@@ -0,0 +1,18 @@
    1+#!/usr/bin/env bash
    2+#
    3+# Copyright (c) 2020 The Bitcoin Core developers
    4+# Distributed under the MIT software license, see the accompanying
    5+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
    6+export LC_ALL=C
    7+EXIT_CODE=0
    8+
    9+CMD=$(git submodule status --recursive)
    


    hebasto commented at 9:24 am on February 10, 2020:
    0CMD=$(git submodule status)
    

    If this script reports submodules which should be deleted, it should not list nested ones.


    emilengler commented at 2:58 pm on February 10, 2020:
    Why? Submodule is submodule?

    hebasto commented at 4:00 pm on February 10, 2020:

    If an “outer” submodule will be deleted, the nested submodule will be deleted automatically (as it resides in the subdirectory of the “outer” submodule), no?

    It seems no need in “delete them” instruction to a user point to nested submodules.

  18. in test/lint/lint-submodule.sh:13 in 1b29eee3f2 outdated
     6+export LC_ALL=C
     7+EXIT_CODE=0
     8+
     9+CMD=$(git submodule status --recursive)
    10+if [[ ${CMD} ]]
    11+then
    


    hebasto commented at 9:31 am on February 10, 2020:
    nit: if test -n "$CMD"; then seems more explicit. nit: curly braces are redundant here.
  19. hebasto changes_requested
  20. hebasto commented at 9:34 am on February 10, 2020: member
    Approach ACK 1b29eee3f29fd835a83488c855d4cf5a6a4ab4df
  21. in test/lint/lint-submodule.sh:13 in 1b29eee3f2 outdated
     8+
     9+CMD=$(git submodule status --recursive)
    10+if [[ ${CMD} ]]
    11+then
    12+    echo These submodules were found, delete them:
    13+    echo $CMD
    


    hebasto commented at 9:36 am on February 10, 2020:
    0    echo "$CMD"
    

    …otherwise, script will print multiple submodules in a line.

  22. laanwj commented at 1:49 pm on February 10, 2020: member
    Thanks for updating this to use git ACK
  23. ci: Check for submodules 2a95c7c956
  24. emilengler force-pushed on Feb 10, 2020
  25. laanwj commented at 3:33 pm on March 5, 2020: member
    ACK 2a95c7c95690112a03b14ccb0fb8f66db12cb75b
  26. laanwj merged this on Mar 5, 2020
  27. laanwj closed this on Mar 5, 2020

  28. in test/lint/lint-submodule.sh:7 in 2a95c7c956
    0@@ -0,0 +1,20 @@
    1+#!/usr/bin/env bash
    2+#
    3+# Copyright (c) 2020 The Bitcoin Core developers
    4+# Distributed under the MIT software license, see the accompanying
    5+# file COPYING or http://www.opensource.org/licenses/mit-license.php.
    6+#
    7+# This script checks for git modules
    


    instagibbs commented at 3:48 pm on March 5, 2020:
    post-hom: Probably should leave a sentence saying why it’s erroring if it does and what the alternative is for implementers :)
  29. sidhujag referenced this in commit b7d0632c2c on Mar 5, 2020
  30. sidhujag referenced this in commit 71ebace671 on Nov 10, 2020
  31. PastaPastaPasta referenced this in commit 7425f34f93 on Jun 27, 2021
  32. PastaPastaPasta referenced this in commit 17b813e69b on Jun 28, 2021
  33. PastaPastaPasta referenced this in commit db46b1ed11 on Jun 29, 2021
  34. PastaPastaPasta referenced this in commit aec19f7bfe on Jul 1, 2021
  35. PastaPastaPasta referenced this in commit 55e6997970 on Jul 1, 2021
  36. PastaPastaPasta referenced this in commit 0e16d43494 on Jul 14, 2021
  37. PastaPastaPasta referenced this in commit a426a8b2e6 on Jul 14, 2021
  38. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-09-29 01:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me