Update to sh-inline 0.2

Syncing up with the latest.
This commit is contained in:
Colin Walters 2022-03-11 15:37:15 -05:00
parent 75ae283f23
commit afdc84b97b
4 changed files with 20 additions and 20 deletions

View File

@ -14,7 +14,7 @@ structopt = "0.3"
serde = "1.0.111"
serde_derive = "1.0.111"
serde_json = "1.0"
sh-inline = "0.1.0"
sh-inline = "0.2.0"
anyhow = "1.0"
tempfile = "3.1.0"
ostree-ext = { version = "0.6.0" }

View File

@ -152,7 +152,7 @@ fn generate_update(commit: &str) -> Result<()> {
// but traversing all the objects is expensive. So here we only prune 1/5 of the time.
if rand::thread_rng().gen_ratio(1, 5) {
bash!(
"ostree --repo={srvrepo} prune --refs-only --depth=1",
"ostree --repo=${srvrepo} prune --refs-only --depth=1",
srvrepo = SRVREPO
)?;
}
@ -166,10 +166,10 @@ fn generate_update(commit: &str) -> Result<()> {
fn generate_srv_repo(commit: &str) -> Result<()> {
bash!(
r#"
ostree --repo={srvrepo} init --mode=archive
ostree --repo={srvrepo} config set archive.zlib-level 1
ostree --repo={srvrepo} pull-local /sysroot/ostree/repo {commit}
ostree --repo={srvrepo} refs --create={testref} {commit}
ostree --repo=${srvrepo} init --mode=archive
ostree --repo=${srvrepo} config set archive.zlib-level 1
ostree --repo=${srvrepo} pull-local /sysroot/ostree/repo ${commit}
ostree --repo=${srvrepo} refs --create=${testref} ${commit}
"#,
srvrepo = SRVREPO,
commit = commit,
@ -310,7 +310,7 @@ fn parse_and_validate_reboot_mark<M: AsRef<str>>(
fn validate_pending_commit(pending_commit: &str, commitstates: &CommitStates) -> Result<()> {
if pending_commit != commitstates.target {
bash!("rpm-ostree status -v")?;
bash!("ostree show {pending_commit}", pending_commit)?;
bash!("ostree show ${pending_commit}", pending_commit)?;
anyhow::bail!(
"Expected target commit={} but pending={} ({:?})",
commitstates.target,
@ -463,11 +463,11 @@ fn impl_transaction_test<M: AsRef<str>>(
"
systemctl stop rpm-ostreed
systemctl stop ostree-finalize-staged
ostree reset testrepo:{testref} {booted_commit}
ostree reset testrepo:${testref} ${booted_commit}
rpm-ostree cleanup -pbrm
",
testref,
booted_commit,
booted_commit
)
.with_context(|| {
format!(
@ -571,7 +571,7 @@ pub(crate) fn itest_transactionality() -> Result<()> {
let url = format!("http://{}", addr);
bash!(
"ostree remote delete --if-exists testrepo
ostree remote add --set=gpg-verify=false testrepo {url}",
ostree remote add --set=gpg-verify=false testrepo ${url}",
url
)?;
@ -589,9 +589,9 @@ pub(crate) fn itest_transactionality() -> Result<()> {
let testref = TESTREF;
bash!(
"
ostree admin set-origin testrepo {url} {testref}
ostree refs --create testrepo:{testref} {commit}
ostree refs --create={origref} {commit}
ostree admin set-origin testrepo ${url} ${testref}
ostree refs --create testrepo:${testref} ${commit}
ostree refs --create=${origref} ${commit}
",
url,
origref,

View File

@ -72,14 +72,14 @@ pub(crate) fn itest_pull_basicauth() -> Result<()> {
let osroot = Path::new("osroot");
crate::treegen::mkroot(&osroot)?;
bash!(
r#"ostree --repo={serverrepo} init --mode=archive
ostree --repo={serverrepo} commit -b os --tree=dir={osroot} >/dev/null
r#"ostree --repo=${serverrepo} init --mode=archive
ostree --repo=${serverrepo} commit -b os --tree=dir=${osroot} >/dev/null
mkdir client
cd client
ostree --repo=repo init --mode=archive
ostree --repo=repo remote add --set=gpg-verify=false origin-unauth {baseuri}
ostree --repo=repo remote add --set=gpg-verify=false origin-badauth {unauthuri}
ostree --repo=repo remote add --set=gpg-verify=false origin-goodauth {authuri}
ostree --repo=repo remote add --set=gpg-verify=false origin-unauth ${baseuri}
ostree --repo=repo remote add --set=gpg-verify=false origin-badauth ${unauthuri}
ostree --repo=repo remote add --set=gpg-verify=false origin-goodauth ${authuri}
"#,
osroot = osroot,
serverrepo = serverrepo,
@ -90,7 +90,7 @@ pub(crate) fn itest_pull_basicauth() -> Result<()> {
for rem in &["unauth", "badauth"] {
cmd_fails_with(
bash_command!(
r#"ostree --repo=client/repo pull origin-{rem} os >/dev/null"#,
r#"ostree --repo=client/repo pull origin-${rem} os >/dev/null"#,
rem = *rem
)
.unwrap(),

View File

@ -140,7 +140,7 @@ pub(crate) fn update_os_tree<P: AsRef<Path>>(
}
assert!(mutated > 0);
println!("Mutated ELF files: {}", mutated);
bash!("ostree --repo={repo} commit --consume -b {ostref} --base={ostref} --tree=dir={tempdir} --owner-uid 0 --owner-gid 0 --selinux-policy-from-base --link-checkout-speedup --no-bindings --no-xattrs",
bash!("ostree --repo=${repo} commit --consume -b ${ostref} --base=${ostref} --tree=dir=${tempdir} --owner-uid 0 --owner-gid 0 --selinux-policy-from-base --link-checkout-speedup --no-bindings --no-xattrs",
repo = repo_path,
ostref = ostref,
tempdir = tempdir.path()).context("Failed to commit updated content")?;