Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable parsing the OCI linux configuration on non-linux platforms
What does this patch do? * Make the LinuxSpec be visible by golang on non-linux platforms when “go build” What did this patch change? * Add linux/ * Rename config_linux.go to linux/config.go * Rename config-linux.md to linux/config.md * Rename runtime_config_linux.go to linux/runtime-config.go * Rename runtime-config-linux.md to linux/runtime-config.md * Rename runtime-linux.md -> linux/runtime.md * Remove the “// +build linux” from linux/config.go * The package name of linux/*.go is changed to “linux” * Add import of the “specs” in the linux/*.go The type LinuxSpec (or say the OCI linux configuration) is a structure describing some information, there is no executable code bound to the linux, so the LinuxSpec should be naturally usable by any platform when needed. But the file names (ended with “_linux.go”) and the build tag disallow us to do so. The patch changes it. Removing the “_linux” and the build tag makes `go build` accept the LinuxSpec on any platform. The linux related files are also moved to the linux/ to eliminate the future possible name clashing (include the file names and the type names). After making the LinuxSpec be visible on non-linux platforms, anyone can do anything of the following in any platforms. (They are also the useful usecases) * 1) parse the OCI linux configuration (config.json & runtime.json) * 2) verify the OCI linux configuration or the bundle * 3) check or test the OCI linux configuration or even the bundle * 4) discover/build/deliver linux OCI bundle * 5) Run the container via the hypervisor-based runtime on non-linux platforms * etc.) The 5) is one thing of what we are focusing on. After this patch applied, anyone can build the runv[1] and run linux container on darwin. (Also after we update the opencontainers/spec under Godeps/ in our runv.git[1] project.) [1]: https://github.com/hyperhq/runv Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
- Loading branch information