Skip to content

Commit

Permalink
Change crates from git repos to .tgz archives
Browse files Browse the repository at this point in the history
  • Loading branch information
Seb-MCaw committed Sep 23, 2024
1 parent b8b0506 commit e44265e
Show file tree
Hide file tree
Showing 26 changed files with 17 additions and 36 deletions.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

This file was deleted.

Empty file.
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ maintainers-logins = ["mylogin"]
libhello = "^1.0"

[origin]
url = "git+file:../../../crates/hello"
commit = "cd89b04bec4c8580f565b34a3aef11716e3ce963"
url = "file:../../../crates/hello.tgz"
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ maintainers = ["[email protected]"]
maintainers-logins = ["mylogin"]

[origin]
url = "git+file:../../../crates/libhello"
commit = "8265f7ebea39d73db9675fc91495b448ed5960ec"
url = "file:../../../crates/libhello.tgz"
27 changes: 15 additions & 12 deletions testsuite/tests/workflows/air-gapping/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
from drivers.asserts import assert_eq, assert_match


# Mock git, curl, gprbuild etc. with dummy scripts
# Mock tar, git, curl, gprbuild etc. with dummy scripts
os.mkdir("path-dir")
os.chdir("path-dir")
for executable in ("git", "hg", "svn", "curl", "gprbuild"):
for executable in ("tar", "git", "hg", "svn", "curl", "gprbuild"):
with open(executable, "w") as f:
f.write("\n".join([
"#!/usr/bin/env python",
Expand All @@ -27,21 +27,21 @@
os.chdir("..")


# Run `alr get hello`. This will fail because git is unavailable.
# Run `alr get hello`. This will fail because tar is unavailable.
p = run_alr("get", "hello", quiet=False, complain_on_error=False)
assert_match(".*Mocked command called", p.out)
assert_match(".*Deployment of commit .* from .* to .* failed", p.out)
assert_match(".*Deployment of path .* to .* failed", p.out)

# Disable git mocking and run `alr get hello` to 'download' the crate and its
# Disable tar mocking and run `alr get hello` to 'download' the crate and its
# dependencies.
os.remove(os.path.join("path-dir", "git"))
os.remove(os.path.join("path-dir", "tar"))
p = run_alr("get", "hello", quiet=False)
assert_match(r".*hello=1\.0\.1 successfully retrieved", p.out)
assert_match(r".*\+ libhello 1\.0\.0 \(new\)", p.out)

# Re-enable git mocking and make the index unavailable to simulate disconnection
# Re-enable tar mocking and make the index unavailable to simulate disconnection
# from the network
shutil.copy(os.path.join("path-dir", "curl"), os.path.join("path-dir", "git"))
shutil.copy(os.path.join("path-dir", "curl"), os.path.join("path-dir", "tar"))
shutil.move("my_index", "somewhere_else")

# Simulate transferring to a different system by clearing the alr-config
Expand All @@ -50,15 +50,15 @@
for f in os.listdir("alr-config"):
if f != "settings.toml":
shutil.rmtree(os.path.join("alr-config", f))
shutil.move(f"hello_1.0.1_cd89b04b", "hello")
shutil.move(f"hello_1.0.1_filesystem", "hello")

# Run `alr build`. This will fail because gprbuild is unavailable.
os.chdir(f"hello")
p = run_alr("build", quiet=False, complain_on_error=False)
assert_match(".*Mocked command called", p.out)
assert_match(r'.*Command \["gprbuild", .*\] exited with code 1', p.out)

# Disable gprbuild mocking and run `alr build` to build the crate (with git
# Disable gprbuild mocking and run `alr build` to build the crate (with tar
# mocking still enabled to check it doesn't try to fetch anything else)
os.remove(os.path.join("..", "path-dir", "gprbuild"))
p = run_alr("build", quiet=False)
Expand All @@ -73,8 +73,11 @@
# attempts (and fails) to re-fetch them
shutil.rmtree(os.path.join("alire", "cache", "dependencies"))
p = run_alr("build", quiet=False, complain_on_error=False)
assert_match(".*Mocked command called", p.out)
assert_match(".*Deployment of commit .* from .* to .* failed", p.out)
assert_match(
".*Filesystem crate is neither a folder nor a source archive: ",
p.out
)
assert_match(".*Deployment of path .* to .* failed", p.out)


print("SUCCESS")

0 comments on commit e44265e

Please sign in to comment.