Skip to content

build: Use rpm-ostree compose --print-only to expand ${basearch}#192

Merged
jlebon merged 1 commit intocoreos:masterfrom
cgwalters:expand-ref
Nov 5, 2018
Merged

build: Use rpm-ostree compose --print-only to expand ${basearch}#192
jlebon merged 1 commit intocoreos:masterfrom
cgwalters:expand-ref

Conversation

@cgwalters
Copy link
Copy Markdown
Member

This way we can use ${basearch} in the ref. Also the way
we were doing it before didn't work with treefile inheritance.

Reinstates support for coreos/fedora-coreos-config#24

This way we can use `${basearch}` in the ref.  Also the way
we were doing it before didn't work with treefile inheritance.

Reinstates support for coreos/fedora-coreos-config#24
Copy link
Copy Markdown
Contributor

@lucab lucab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (with a general question on quoting)

Comment thread src/cmdlib.sh
# TODO - allow this to be unset
export ref=$(manifest_get '["ref"]')
export ref=$(jq -r '.ref' < ${manifest_tmp_json})
rm -f ${manifest_tmp_json}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why we don't quote variables (here and everywhere else too)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, consistency is not strong on this. Too bad there's not a "strict mode" for this. But probably our best bet really is to rewrite this in not-bash...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely do think about quoting whenever a variable "could reasonably" have spaces; definitely when handling externally provided filename arguments for example.

But in practice we don't support spaces for these variables like workdir, ref, name etc. So my inclination is to go with this as is - that OK with you?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I was mostly asking for my own knowledge in case I was missing some other details, not a blocker. It makes sense to bucket this under #161.

On other coreos projects we use https://github.com/koalaman/shellcheck, which helps catching simple things.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh, wow. That is a useful project. I just ran it against cmdlib.sh and indeed...lots to fix.

Comment thread src/cmdlib.sh
echo "Using manifest: ${manifest}"

manifest_tmp_json=${workdir}/tmp/manifest.json
rpm-ostree compose tree --repo=repo --print-only ${manifest} > ${manifest_tmp_json}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jlebon does this extra rpm-ostree compose invocation have implications on the supermin PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be fine; --print-only should work without any privileges at all.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what i was referring to is the repo we operate against. Will it perform any write operations to the repo. Do we need to spin up a VM to do this in the supermin case for consistency?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it perform any write operations to the repo.

If it does, that's something we would fix in rpm-ostree. :)

Copy link
Copy Markdown
Member

@jlebon jlebon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks sane to me.

@jlebon
Copy link
Copy Markdown
Member

jlebon commented Nov 5, 2018

Merging this so I can rebase my work on top and make sure things still work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants