charm-tools
charm-tools copied to clipboard
A Makefile in the layer tramples the generated Makefile in the built charm
Checklist
- [X] Confirmed this is an issue with charm-tools, not charmstore-client
- [X] Provide versions of tools used
- [X] Described the feature or ways to replicate the issue
What version am I running?
I ran the following command: charm version
and got the following ouput:
$ venv/bin/charm-version
charm unavailable # The charm command is not installed by `venv/bin/pip install charm-tools`
charm-tools 2.1.4
I am using: Ubuntu Xenial 16.04.1
Issue/Feature
I expect/expected the following
I expected the the Makefile in the layered charm (which ought to govern the layered charm only) not trample the makefile generated during charm build
. At the very least, something like Warning: not generating Makefile for <charm>
would be nice.
What I got
We use a Makefile and a virtualenv to pin the version of charm-tools to a working version. When running charm build
, that Makefile takes precedence and the generated Makefile (which contains the targets for running tests, lint, etc) is not written, and instead I only have the targets required for running charm build
.
Forgot to add, but my workaround was to sequester my Makefile, run charm build
, then copy most of the targets from the generated Makefile into mine before restoring it, so that one can still run make test
etc. on the built charm.
See https://github.com/makyo/bundleservice-charm/blob/99e1452641183915e89146dc082cf593ff497711/Makefile
From man make
make executes commands in the makefile to update one or more target names, where name is typically a program. If no -f option is
present, make will look for the makefiles GNUmakefile, makefile, and Makefile, in that order.
So a very simple fix to this issue would be for 'charm build' to create makefile
instead of Makefile
and document the behavior. Makefile
would be used by the layer and makefile
(higher precedence) would be reserved for the built charm.
Or generate to a unique filename and use make -f
Yep, another option.
I would like to point out that you may be able to use the exclude
and ignore
keys in your layer.yaml to achieve the desired outcome. Please read https://github.com/juju/charm-tools/blob/master/doc/source/build.md#layeryaml
This also applies to requirements.txt
; having that in my layer overwrites layer:base's requirements and causes unmet dependencies and no tests to run (that I receive several hundred test failures when fixing this is neither here nor there)
And venv
- the exclude
key in layer.yaml
does nothing.