From d7d1d9892d663790d3d93797079d9f1ce864aaff Mon Sep 17 00:00:00 2001 From: Stephen Sherratt Date: Tue, 2 Apr 2024 11:32:01 +1100 Subject: [PATCH] Add repro for gh10232 (#10233) Signed-off-by: Stephen Sherratt --- .../pin-stanza/update-non-dune-local-pin.t | 67 +++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 test/blackbox-tests/test-cases/pkg/pin-stanza/update-non-dune-local-pin.t diff --git a/test/blackbox-tests/test-cases/pkg/pin-stanza/update-non-dune-local-pin.t b/test/blackbox-tests/test-cases/pkg/pin-stanza/update-non-dune-local-pin.t new file mode 100644 index 00000000000..d72f04286ae --- /dev/null +++ b/test/blackbox-tests/test-cases/pkg/pin-stanza/update-non-dune-local-pin.t @@ -0,0 +1,67 @@ +This demonstrates an issue when pinning a non-opam package. After attempting to +build the package, changes to the package are only picked up by dune after +running `dune clean`, even if building the package failed. + + $ . ../helpers.sh + + $ mkrepo + $ add_mock_repo_if_needed + + $ cat >dune-project < (lang dune 3.13) + > (pin + > (url "file://$PWD/foo") + > (package (name foo))) + > (package + > (name main) + > (depends foo)) + > EOF + +Make a package "foo" whose build will fail after printing a message: + $ mkdir foo + $ cat >foo/foo.opam < opam-version: "2.0" + > build: [ + > [ make ] + > ] + > EOF + $ cat >foo/Makefile < all: + > echo aaa + > false + > EOF + + $ dune pkg lock + Solution for dune.lock: + - foo.dev + +Attempt to build the packgage the first time: +(the error from make is grep'd out because it is not consistant across different systems) + $ dune build 2>&1 | grep -v make + echo aaa + aaa + false + -> required by _build/_private/default/.pkg/foo/target/cookie + +Update the message that gets printed while building foo: + $ cat >foo/Makefile < all: + > echo bbb + > false + > EOF + +The change to the package is ignored: + $ dune build 2>&1 | grep -v make + echo aaa + aaa + false + -> required by _build/_private/default/.pkg/foo/target/cookie + + $ dune clean + +The change to the package is picked up now that we've run `dune clean`: + $ dune build 2>&1 | grep -v make + echo bbb + bbb + false + -> required by _build/_private/default/.pkg/foo/target/cookie