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. # We are now at monoproject/mycrate. os.chdir("monoproject") os.chdir("crate1") alr_publish("crate1", "0.0.0", index_path=os.path.join(start_dir, "my_index")) # We create a second crate at another commit os.chdir(os.path.join(start_dir, "monoproject.upstream")) init_local_crate("crate2", enter=False) os.chdir(start_dir) commit2 = commit_all("monoproject.upstream") # Check out changes and publish crate2 os.chdir("monoproject") run(["git", "pull"]).check_returncode() os.chdir("crate2") alr_publish("crate2", "0.0.0", index_path=os.path.join(start_dir, "my_index")) # Verify that the crates are usable as a dependency, and expected binary # locations
os.chdir("monoproject.upstream") init_local_crate("myparent") init_local_crate("mychild") os.chdir(start_dir) commit = 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(os.path.join("monoproject", "myparent", "mychild")) run_alr("show") # Verify the crate is detected properly # This call publishes and "submits" the release to our local index alr_publish("mychild", "0.0.0", index_path=index_dir) # Publish also its parent for later test os.chdir("..") alr_publish("myparent", "0.0.0", index_path=index_dir) # Verify that the crate can be got and compiled, and expected location os.chdir(start_dir) run_alr("get", "--build", "mychild") assert os.path.isdir(os.path.join(f"monoproject_{commit[:8]}", "myparent", "mychild")), \ "Expected directory does not exist" # Verify that the crate is usable as a dependency, and expected location init_local_crate("top") alr_with("mychild")
os.chdir("monoproject.upstream") init_local_crate("myparent") init_local_crate("mychild") os.chdir(start_dir) commit = 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(os.path.join("monoproject", "myparent", "mychild")) run_alr("show") # Verify the crate is detected properly # This call publishes and "submits" the release to our local index alr_publish("mychild", "0.1.0-dev", index_path=index_dir) # Publish also its parent for later test os.chdir("..") alr_publish("myparent", "0.1.0-dev", index_path=index_dir) # Verify that the crate can be got and compiled, and expected location os.chdir(start_dir) run_alr("get", "--build", "mychild") assert os.path.isdir(os.path.join(f"monoproject_{commit[:8]}", "myparent", "mychild")), \ "Expected directory does not exist" # Verify that the crate is usable as a dependency, and expected location init_local_crate("top") alr_with("mychild")
# We can now create the upstream repo os.chdir("..") commit = init_git_repo(crate) os.rename(crate, f"{crate}.upstream") # We clone the project to obtain our local copy assert run(["git", "clone", f"{crate}.upstream", crate]).returncode == 0 # We enter the clone os.chdir(crate) # Verify the pin is there assert_match(".*\[\[pins\]\].*", content_of(alr_manifest())) # We publish with the pin in the manifest p = alr_publish(crate, "0.0.0", index_path=os.path.join(start_dir, "my_index"), submit=False, quiet=False) # Verify warning during publishing assert_match(".*contains pins that will be removed.*", p.out) # Verify no pins in the generated file assert "[[pins]]" not in \ content_of(os.path.join("alire", "releases", f"{crate}-0.0.0.toml")), \ "Unexpected contents in published file" print('SUCCESS')
# We enter the clone and verify that attempting to publish from the root fails, # as there is no crate at the git root os.chdir("monoproject") p = run_alr("publish", complain_on_error=False) assert p.status != 0, "alr failed to err as expected" assert "No Alire workspace found" in p.out, "Unexpected output: " + p.out # We enter the crate nested inside and publish. # We are now at monoproject/mycrate. os.chdir("mycrate") run_alr("show") # Verify the crate is detected properly # This call creates the manifest and puts it in place in the index alr_publish("mycrate", "0.1.0-dev", index_path=os.path.join(start_dir, "my_index")) # Verify that the crate can be got and compiled, and expected location os.chdir(start_dir) run_alr("get", "--build", "mycrate") assert os.path.isdir(os.path.join(f"monoproject_{commit[:8]}", "mycrate")), \ "Expected directory does not exist" # Verify that the crate is usable as a dependency, and expected binary location init_local_crate("top") alr_with("mycrate") run_alr("build") assert os.path.isfile(os.path.join( "alire", "cache", "dependencies", f"monoproject_{commit[:8]}", "mycrate", "bin",