-
Notifications
You must be signed in to change notification settings - Fork 395
Add full macOS support #336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@hferentschik this could make your life a bit easier. |
|
RFC: Now that the tag completely disables the I’m not overall sure that changing the tag name and breaking possible existing users is worth it, though. Opinions? |
|
I would leave it alone. I would have preferred just having ostree, similar to how we have selinux and seccomp, but I now others are using it so why break it. |
Set the containers_image_ostree_stub build tag automatically on macOS; at least right now, ostree/src/libostree/ostree-linuxfsutil.c hard-codes Linux-specific header files and ioctls, so we are fairly sure that it will not be available no macOS. Make the ostree subpackage also conditional on containers_image_ostree_stub , so that we don't even try to build it (and any reference to it fails with "no buildable source files"). Finally, use $BUILDFLAGS also in (go list) when listing the subpackages, so that we don't try to run tests in the ostree subpackage (and therefore try to build it) when it has been disabled. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Some tests directly or indirectly exercising the directory/explicitfilepath subpackage expect the path returned by ioutil.TempDir to be canonical in the directory/explicitfilepath sense (absolute, no symlinks, cleaned up). ioutil.TempDir uses $TMPDIR by default, and on macOS, $TMPDIR is by default set to /var/folders/…, with /var a symlink to /private/var , which does not match our expectations. So, tests which want to use ioutil.TempDir that way, can import _ "github.com/containesr/image/internal/testing/explicitfilepath-tmpdir" to ensure that $TMPDIR is canonical and usable as a base for testing path canonicalization in its subdirectories. Hide this canonicalization in a subpackage which can be just imported into any tests which needs it. (This also introduces the first use of the "internal" subdirectory, for subpackages which should not be used by externals callers.) Signed-off-by: Miloslav Trmač <mitr@redhat.com>
…amespaces /etc/skel does not exist on macOS; /usr/share exists both on macOS and Linux. Ultimately, for full portability, we should be using something within an ioutil.TempDir, but in that case the test would have to compute the full set of parent directories, essentially duplicating exactly the code we want to test; so, a hard-coded directory which exists on all supported platforms is better, as long as we can get away with it. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
On macOS, (brew install gpgme) installs it within /usr/local, but /usr/local/include is not in the default search path. Rather than hard-code this directory, use gpgme-config. Sadly that must be done at the top-level user instead of locally in the gpgme subpackage, because cgo supports only pkg-config, not general shell scripts, and gpgme does not install a pkg-config file. If gpgme is not installed or gpgme-config can’t be found for other reasons, the error is silently ignored (and the user will probably find out because the cgo compilation will fail); this is so that users can use the containers_image_openpgp build tag without seeing ugly errors (and without the Makefile having to detect that build tag in even more shell scripts). Note that users of this library will probably need a similar modification to their build environment; we can't do it for them, just as the gpgme package can't do it for us. Signed-off-by: Miloslav Trmač <mitr@redhat.com>
With this,
should “just work”.
The changes are mostly trivial, do note that this introduces a first
internalsubpackage.