-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix monorepo bug wrt location of generated manifest
When deploying crates, to avoid confusion, we replace the packaged manifest (if any) with the one from the index, which is the one used anyway. For monorepos, the replacement was placed at the repo root instead of at the crate location.
- Loading branch information
Showing
5 changed files
with
81 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
testsuite/tests/monorepo/manifest-in-place/my_index/index/index.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
version = "1.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
""" | ||
Verify that the index manifest is copied in the proper place instead of the one | ||
possible packed by upstream, like is done for regular crates. | ||
""" | ||
|
||
from glob import glob | ||
import os | ||
from subprocess import run | ||
|
||
from drivers.alr import alr_manifest, alr_publish, init_local_crate, run_alr | ||
from drivers.asserts import assert_contents | ||
from drivers.helpers import init_git_repo | ||
|
||
# We create a repository with a nested crate that will act as the upstream | ||
# remote repository: | ||
|
||
start_dir = os.getcwd() | ||
os.mkdir("monoproject.upstream") | ||
os.chdir("monoproject.upstream") | ||
init_local_crate("crate1", enter=False) | ||
os.chdir(start_dir) | ||
commit1 = init_git_repo("monoproject.upstream") | ||
|
||
# We clone the project to obtain our local copy | ||
|
||
assert run(["git", "clone", | ||
"monoproject.upstream", "monoproject"]).returncode == 0 | ||
|
||
# We enter the crate nested inside and publish. | ||
|
||
os.chdir("monoproject") | ||
os.chdir("crate1") | ||
alr_publish("crate1", "0.1.0-dev", | ||
index_path=os.path.join(start_dir, "my_index")) | ||
|
||
# Verify that we can `alr get` the nested crate | ||
|
||
os.chdir(start_dir) | ||
run_alr("get", "crate1") | ||
|
||
# Enter and verify the only manifest is at the expected location, and the only | ||
# backup is too. | ||
|
||
os.chdir(glob("monoproject_*")[0]) | ||
|
||
assert not os.path.isfile(alr_manifest()), \ | ||
"Unexpected manifest in the root of the repository" | ||
|
||
assert_contents(".", | ||
['./crate1/alire.toml', | ||
'./crate1/alire/alire.toml.upstream'], | ||
".*alire.*toml") | ||
|
||
print('SUCCESS') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
driver: python-script | ||
indexes: | ||
my_index: | ||
in_fixtures: false | ||
compiler_only_index: {} |