This repository has been archived by the owner on Feb 24, 2020. It is now read-only.
Give different names to different flavors of stage1 images #1406
Merged
Conversation
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
Using m4 defines in help strings makes them oddly formatted. I used defines to avoid repeating some values, but: 1. They sometimes were used once anyway. 2. They don't change all that often, so a bit of redundancy should not be a problem.
This code is used not only by the run command, but also by prepare, so let's move it outside. Also, it will grow in the next commit.
With this commit, each flavor of stage1 image has a different name, basically in a pattern like "coreos.com/rkt/stage1-${flavor}". This change also forced us to pass a default stage1 image path via a linker flag unconditionally, because we cannot hardcode "stage1.aci". This also makes some changes in the stage1 image loading: 1. If we want to use the default stage1 image we first check if it is in the store. No change in this step. 2. If there was no default stage1 image in the store, we will try to load it from disk. The change is that we will try one or two locations: - if the default stage1 image path is an absolute path on disk, has a scheme (http://, docker://, etc) or it was overridden with --stage1-image flag, we will try to load it - if none of the above is true (so the path is relative), we ignore it - if the above fails (or is ignored) and the path has no scheme and it was not overridden, we try to load the image from the same directory where rkt resides using the basename of the default stage1 image path Examples: The default stage1 image path is set to "/usr/libexec/rkt/stage1-lkvm.aci", the rkt binary is in "/usr/bin". rkt will try to load "/usr/libexec/rkt/stage1-lkvm.aci" first and if that fails, it will try to load "/usr/bin/stage1-lkvm.aci". In case where the default stage1 image path is set to "some/relative/path/stage1-coreos.aci" rkt will only try to load "/usr/bin/stage1-coreos.aci". In case where the default stage1 image path is set to "file:///dir/img.aci" or "https://example.com/img.aci", rkt will try to load just that. Loading different (non-default) stage1 image is unchanged. This way we can have two things: 1. Having a working "rkt" installed with stage1 placed in different directory (a groundwork for "make install"). 2. The uninstalled case still works (provided that the stage1 image is in the same directory as rkt as it was so far). Fixes #1292
Just moving the code, no other changes here. The name will later depend on a flavor.
We can build several src-flavored stage1 images with a different systemd version from the same commit. Without this change all of those images would have the same name and version. With the stage1 loading optimization the other images would be ignored. The filenames are still the same, though (stage1-src.aci).
LGTM |
iaguis
added a commit
that referenced
this pull request
Sep 24, 2015
Give different names to different flavors of stage1 images
I don't think so. But it is late now, so I'll think about it tomorrow. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR makes some small changes in rkt's behavior. Hopefully commit messages are quite clear about the changes.
In short - we do not default to
stage1.aci
in the same directory as rkt if default stage1 image path was not set; we always set the path. But the code tries to load the stage1 image from the same directory as rkt if loading stage1 image from default path fails.This PR fixes #1292.