Skip to content

Conversation

@mtrmac
Copy link
Collaborator

@mtrmac mtrmac commented Aug 30, 2017

With this,

brew install gpgme
make

should “just work”.

The changes are mostly trivial, do note that this introduces a first internal subpackage.

@mtrmac
Copy link
Collaborator Author

mtrmac commented Aug 30, 2017

@hferentschik this could make your life a bit easier.

@mtrmac
Copy link
Collaborator Author

mtrmac commented Aug 30, 2017

RFC: Now that the tag completely disables the ostree package, naming it containers_image_ostree_stub might not be the best fit. It’s not wrong (as far as transports/alltransports goes at least), but containers_image_disable_ostree would be a bit more explicit.

I’m not overall sure that changing the tag name and breaking possible existing users is worth it, though. Opinions?

@rhatdan
Copy link
Member

rhatdan commented Aug 30, 2017

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.

@runcom
Copy link
Member

runcom commented Aug 31, 2017

LGTM

Approved with PullApprove

mtrmac added 4 commits August 31, 2017 21:17
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>
@mtrmac
Copy link
Collaborator Author

mtrmac commented Aug 31, 2017

👍

Approved with PullApprove

@mtrmac mtrmac merged commit cf1bc16 into containers:master Aug 31, 2017
@mtrmac mtrmac deleted the macOS branch August 31, 2017 20:03
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.

3 participants