diff --git a/alire.toml b/alire.toml index a2e72c926..d9ab5289d 100644 --- a/alire.toml +++ b/alire.toml @@ -69,7 +69,7 @@ commit = "56bbdc008e16996b6f76e443fd0165a240de1b13" [pins.den] url = "https://github.com/mosteo/den" -commit = "35d1f38395b93766dd64bca5901ce3b6a416ba1a" +commit = "681ab5ca522585953f2e1d70763731df34c96012" [pins.dirty_booleans] url = "https://github.com/mosteo/dirty_booleans" diff --git a/deps/den b/deps/den index 35d1f3839..681ab5ca5 160000 --- a/deps/den +++ b/deps/den @@ -1 +1 @@ -Subproject commit 35d1f38395b93766dd64bca5901ce3b6a416ba1a +Subproject commit 681ab5ca522585953f2e1d70763731df34c96012 diff --git a/src/alire/alire-builds.adb b/src/alire/alire-builds.adb index 9593c1c77..373bcbff2 100644 --- a/src/alire/alire-builds.adb +++ b/src/alire/alire-builds.adb @@ -7,7 +7,7 @@ with Alire.Paths.Vault; with Alire.Roots; with Alire.Settings.Builtins; -with GNATCOLL.VFS; +with Den.Filesystem; package body Alire.Builds is @@ -56,16 +56,14 @@ package body Alire.Builds is Simple_Logging.Activity ("Syncing " & Release.Milestone.TTY_Image) with Unreferenced; - Success : Boolean := False; - use GNATCOLL.VFS; begin - GNATCOLL.VFS.Copy - (Create (+Src), - +Dst, - Success); - - Assert (Success, - "Could not sync build dir from " & Src & " to " & Dst); + Den.Filesystem.Create_Directory (Dst); + Den.Filesystem.Copy (Src, Dst); + exception + when E : others => + Log_Exception (E); + Raise_Checked_Error + ("Could not sync build dir from " & Src & " to " & Dst); end; -- At this point we can generate the final crate configuration diff --git a/testsuite/drivers/builds.py b/testsuite/drivers/builds.py index 48ff323d9..05e6359c7 100644 --- a/testsuite/drivers/builds.py +++ b/testsuite/drivers/builds.py @@ -83,14 +83,9 @@ def sync() -> None: """ Sync the shared build directory """ - # We force the sync by running a build, no matter if it succeeds or not - try: - subprocess.run(["alr", "-q", "-d", "build"] - , stdout=subprocess.DEVNULL - , stderr=subprocess.DEVNULL - ) - except: - pass + run_alr("build", "--stop-after=generation") + return + def sync_builds() -> None: sync() diff --git a/testsuite/tests/cache/softlinks/my_index/crate-0.1.0.tgz b/testsuite/tests/cache/softlinks/my_index/crate-0.1.0.tgz new file mode 100644 index 000000000..4e90424e3 Binary files /dev/null and b/testsuite/tests/cache/softlinks/my_index/crate-0.1.0.tgz differ diff --git a/testsuite/tests/cache/softlinks/my_index/index/cr/crate/crate-0.1.0.toml b/testsuite/tests/cache/softlinks/my_index/index/cr/crate/crate-0.1.0.toml new file mode 100644 index 000000000..a4b05f347 --- /dev/null +++ b/testsuite/tests/cache/softlinks/my_index/index/cr/crate/crate-0.1.0.toml @@ -0,0 +1,11 @@ +description = "Example crate" +name = "crate" +version = "0.1.0" +licenses = "GPL-3.0-only" +maintainers = ["example@example.com"] +maintainers-logins = ["mylogin"] +executables=['main'] + +[origin] +url = "file:../../../crate-0.1.0.tgz" +hashes = ["sha256:e246305107429e936610677bf5244d69510341a7df47cfce9e2278c4ad7da947"] diff --git a/testsuite/tests/cache/softlinks/my_index/index/index.toml b/testsuite/tests/cache/softlinks/my_index/index/index.toml new file mode 100644 index 000000000..bad265e4f --- /dev/null +++ b/testsuite/tests/cache/softlinks/my_index/index/index.toml @@ -0,0 +1 @@ +version = "1.1" diff --git a/testsuite/tests/cache/softlinks/test.py b/testsuite/tests/cache/softlinks/test.py new file mode 100644 index 000000000..fd74e9e1f --- /dev/null +++ b/testsuite/tests/cache/softlinks/test.py @@ -0,0 +1,60 @@ +""" +Test proper syncing of softlinks, even bad ones + +This test is Unix-only, as Windows' tar cannot recreate the broken links: + +crate-0.1.0 +└── crate + ├── bin -> subdir/bin + ├── broken -> missing + ├── lib + │ ├── mock.so -> mock.so.0.0 + │ ├── mock.so.0 -> mock.so.0.0 + │ ├── mock.so.0.0 + │ ├── zzz.so -> mock.so + │ └── zzz.so.0 -> mock.so + ├── loop + │ ├── x -> z + │ ├── y -> x + │ └── z -> y + ├── order + │ ├── ab -> b + │ ├── af -> d/f + │ ├── b + │ ├── cb -> b + │ ├── d + │ │ └── f + │ └── zf -> d/f + ├── self -> self + ├── subdir + │ ├── bin + │ │ ├── loop -> ../../subdir + │ │ └── x + │ ├── parent -> .. + │ └── self -> ../subdir + ├── that -> this + └── this -> that + +""" + +import os +import shutil +import drivers.builds as builds +from drivers.alr import alr_with, init_local_crate, run_alr + + +init_local_crate() + +# Make the crate depend on our troublesome crate and ensure syncing +alr_with("crate") +builds.sync() + +# Ensure that a copy has been made to the cache +if builds.are_shared(): + assert os.path.exists(builds.find_dir("crate")) + +# Cleanup +os.chdir("..") +shutil.rmtree("xxx") + +print('SUCCESS') diff --git a/testsuite/tests/cache/softlinks/test.yaml b/testsuite/tests/cache/softlinks/test.yaml new file mode 100644 index 000000000..f0325a232 --- /dev/null +++ b/testsuite/tests/cache/softlinks/test.yaml @@ -0,0 +1,8 @@ +driver: python-script +build_mode: both +control: + - [SKIP, "skip_unix", "Test is Unix-only"] +indexes: + my_index: + in_fixtures: false + compiler_only_index: {}