summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Jardón <jjardon@gnome.org>2020-04-18 14:08:49 +0100
committerJavier Jardón <jjardon@gnome.org>2020-05-01 20:05:22 +0100
commit25125d38ee54ac79056e246f900477e06490dbcb (patch)
treeab68ac0fb6ec33ae68dfda44d18b321093cd8ba4
parent9796d1da5266183574da3e968d5b892624aa3033 (diff)
downloadbuildstream-jjardon/submodules.tar.gz
git: Do not checkout submodules by defaultjjardon/submodules
This makes repeatibility more difficult We do not want download things from internet when building and the user have not explicity specify those in any .bst file Fixes #783
-rw-r--r--NEWS2
-rw-r--r--src/buildstream/_gitsourcebase.py2
-rw-r--r--src/buildstream/plugins/sources/git.py9
-rw-r--r--tests/cachekey/project/sources/git1.expected2
-rw-r--r--tests/cachekey/project/sources/git2.expected2
-rw-r--r--tests/cachekey/project/sources/git3.expected2
-rw-r--r--tests/cachekey/project/sources/pip1.expected2
-rw-r--r--tests/cachekey/project/target.expected2
-rw-r--r--tests/sources/git.py14
-rw-r--r--tests/sources/git/project-override/project.conf2
10 files changed, 18 insertions, 21 deletions
diff --git a/NEWS b/NEWS
index ec6f5f352..8c3c9c58e 100644
--- a/NEWS
+++ b/NEWS
@@ -306,6 +306,8 @@ CLI
Plugins
-------
+ o BREAKING CHANGE: The git plugin does not checkout submodules by default anymore
+
o BREAKING CHANGE: cmake, make, makemaker, meson, modulebuild and qmake
plugins have been moved to the bst-plugins-experimental repository.
diff --git a/src/buildstream/_gitsourcebase.py b/src/buildstream/_gitsourcebase.py
index 1f74bb972..d54bfb00d 100644
--- a/src/buildstream/_gitsourcebase.py
+++ b/src/buildstream/_gitsourcebase.py
@@ -533,7 +533,7 @@ class _GitSourceBase(Source):
"{}: Git sources require a ref and/or track".format(self), reason="missing-track-and-ref"
)
- self.checkout_submodules = node.get_bool("checkout-submodules", default=True)
+ self.checkout_submodules = node.get_bool("checkout-submodules", default=False)
# Parse a dict of submodule overrides, stored in the submodule_overrides
# and submodule_checkout_overrides dictionaries.
diff --git a/src/buildstream/plugins/sources/git.py b/src/buildstream/plugins/sources/git.py
index 6427d4b04..467deadd1 100644
--- a/src/buildstream/plugins/sources/git.py
+++ b/src/buildstream/plugins/sources/git.py
@@ -25,11 +25,6 @@ git - stage files from a git repository
* git
-.. attention::
-
- Note that this plugin **will checkout git submodules by default**; even if
- they are not specified in the `.bst` file.
-
**Usage:**
.. code:: yaml
@@ -58,8 +53,8 @@ git - stage files from a git repository
# Optionally specify whether submodules should be checked-out.
# This is done recursively, as with `git clone --recurse-submodules`.
- # If not set, this will default to 'True'
- checkout-submodules: True
+ # If not set, this will default to 'False'
+ checkout-submodules: False
# If your repository has submodules, explicitly specifying the
# url from which they are to be fetched allows you to easily
diff --git a/tests/cachekey/project/sources/git1.expected b/tests/cachekey/project/sources/git1.expected
index 833e3a9a9..1e437080a 100644
--- a/tests/cachekey/project/sources/git1.expected
+++ b/tests/cachekey/project/sources/git1.expected
@@ -1 +1 @@
-4e21bc1089066998d44933fdf1e48b2a5a73ceaba7a3944538f3f142e34b8b8e \ No newline at end of file
+a664491c19c5347e20f5f7064fae62883253d7da38fadf04b4983d4a73b44519
diff --git a/tests/cachekey/project/sources/git2.expected b/tests/cachekey/project/sources/git2.expected
index b4d2e70ae..5f03b689b 100644
--- a/tests/cachekey/project/sources/git2.expected
+++ b/tests/cachekey/project/sources/git2.expected
@@ -1 +1 @@
-c6cb011849cb0ded98add6f46e6737caa1191e6cec58bcee20f06a5198f03466 \ No newline at end of file
+b684c60239449b1064db01b890478b4ec73f7707c9c220ad30265a1df57c6386
diff --git a/tests/cachekey/project/sources/git3.expected b/tests/cachekey/project/sources/git3.expected
index 2d12c164d..8b66538a0 100644
--- a/tests/cachekey/project/sources/git3.expected
+++ b/tests/cachekey/project/sources/git3.expected
@@ -1 +1 @@
-65f9f934ed84d63bb19dab4c323bb3a4a3cef85d9592f5be9d6d6e420952747e \ No newline at end of file
+129c3024db023b6e2eba7c215060ce42734c74583e46ebdefc06f9bcec5992f5
diff --git a/tests/cachekey/project/sources/pip1.expected b/tests/cachekey/project/sources/pip1.expected
index 844f4c54c..dbd0909fd 100644
--- a/tests/cachekey/project/sources/pip1.expected
+++ b/tests/cachekey/project/sources/pip1.expected
@@ -1 +1 @@
-70870ffa81e4527a2d812c809b1e99025c72d1ae289be38e45a5b22dc0262eac \ No newline at end of file
+d0b09dfc436e156c0ed3845ba58e006f683bc8ce1795071bb20f2a15c0a2d32e
diff --git a/tests/cachekey/project/target.expected b/tests/cachekey/project/target.expected
index cf38ddcfe..4eadd1150 100644
--- a/tests/cachekey/project/target.expected
+++ b/tests/cachekey/project/target.expected
@@ -1 +1 @@
-a57f84353d1528b3ecbd9993ac02a20d0355f2451e19700172c95575af9a5b48 \ No newline at end of file
+7c40255e2c6e57ea95f692719a7fa2eddfde6a7ff1658ef03327e40a85199b10
diff --git a/tests/sources/git.py b/tests/sources/git.py
index 033db1bf9..1cd504349 100644
--- a/tests/sources/git.py
+++ b/tests/sources/git.py
@@ -118,7 +118,7 @@ def test_submodule_fetch_checkout(cli, tmpdir, datafiles):
# Assert we checked out both files at their expected location
assert os.path.exists(os.path.join(checkoutdir, "file.txt"))
- assert os.path.exists(os.path.join(checkoutdir, "subdir", "ponyfile.txt"))
+ assert not os.path.exists(os.path.join(checkoutdir, "subdir", "ponyfile.txt"))
@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
@@ -157,8 +157,8 @@ def test_recursive_submodule_fetch_checkout(cli, tmpdir, datafiles):
# Assert we checked out all files at their expected location
assert os.path.exists(os.path.join(checkoutdir, "file.txt"))
- assert os.path.exists(os.path.join(checkoutdir, "subdir", "ponyfile.txt"))
- assert os.path.exists(os.path.join(checkoutdir, "subdir", "subdir", "unicornfile.txt"))
+ assert not os.path.exists(os.path.join(checkoutdir, "subdir", "ponyfile.txt"))
+ assert not os.path.exists(os.path.join(checkoutdir, "subdir", "subdir", "unicornfile.txt"))
@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
@@ -374,7 +374,7 @@ def test_submodule_fetch_project_override(cli, tmpdir, datafiles):
# Assert we checked out both files at their expected location
assert os.path.exists(os.path.join(checkoutdir, "file.txt"))
- assert not os.path.exists(os.path.join(checkoutdir, "subdir", "ponyfile.txt"))
+ assert os.path.exists(os.path.join(checkoutdir, "subdir", "ponyfile.txt"))
@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
@@ -515,7 +515,7 @@ def test_unlisted_submodule(cli, tmpdir, datafiles, fail):
result.assert_task_error(ErrorDomain.PLUGIN, "git:unlisted-submodule")
else:
result.assert_success()
- assert "git:unlisted-submodule" in result.stderr
+ assert "git:unlisted-submodule" not in result.stderr
# Now that we've fetched it, `bst show` will discover the unlisted submodule too
result = cli.run(project=project, args=["show", "target.bst"])
@@ -527,7 +527,7 @@ def test_unlisted_submodule(cli, tmpdir, datafiles, fail):
result.assert_success()
# We have cached things internally and successfully. Therefore, the plugin
# is not involved in checking whether the cache is correct or not.
- assert "git:unlisted-submodule" not in result.stderr
+ assert "git:unlisted-submodule" in result.stderr
@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
@@ -581,7 +581,7 @@ def test_track_unlisted_submodule(cli, tmpdir, datafiles, fail):
result.assert_task_error(ErrorDomain.PLUGIN, "git:unlisted-submodule")
else:
result.assert_success()
- assert "git:unlisted-submodule" in result.stderr
+ assert "git:unlisted-submodule" not in result.stderr
@pytest.mark.skipif(HAVE_GIT is False, reason="git is not available")
diff --git a/tests/sources/git/project-override/project.conf b/tests/sources/git/project-override/project.conf
index 01c901657..a8452f2cb 100644
--- a/tests/sources/git/project-override/project.conf
+++ b/tests/sources/git/project-override/project.conf
@@ -4,7 +4,7 @@ min-version: 2.0
sources:
git:
config:
- checkout-submodules: False
+ checkout-submodules: True
elements:
manual:
config: