1
Script for synchronizing charm-helpers into a charm branch.
3
This script is intended to be used by charm authors during the development
4
of their charm. It allows authors to pull in bits of a charm-helpers source
5
tree and embed directly into their charm, to be deployed with the rest of
6
their hooks and charm payload. This script is not intended to be called
7
by the hooks themselves, but instead by the charm author while they are
8
hacking on a charm offline. Consider it a method of compiling specific
9
revision of a charm-helpers branch into a given charm source tree.
11
Some goals and benefits to using a sync tool to manage this process:
13
- Reduces the burden of manually copying in upstream charm helpers code
14
into a charm and helps ensure we can easily keep a specific charm's
15
helper code up to date.
17
- Allows authors to hack on their own working branch of charm-helpers,
18
easily sync into their WIP charm. Any changes they've made to charm
19
helpers can be upstreamed via a merge of their charm-helpers branch
20
into lp:charm-helpers, ideally at the same time they are upstreaming
21
the charm itself into the charm store. Separating charm helper
22
development from charm development can help reduce cases where charms
23
are shipping locally modified helpers.
25
- Avoids the need to ship the *entire* lp:charm-helpers source tree with
26
a charm. Authors can selectively pick and choose what subset of helpers
27
to include to satisfy the goals of their charm.
29
Loosely based on OpenStack's oslo-incubator:
31
https://github.com/openstack/oslo-incubator.git
33
Allows specifying a list of dependencies to sync in from a charm-helpers
34
branch. Ideally, each charm should describe its requirements in a yaml
35
config included in the charm, eg charm-helpers.yaml (NOTE: Example module
36
layout as of 05/30/2013):
39
$ cat >charm-helpers.yaml <<END
40
destination: hooks/helpers
41
branch: lp:charm-helpers
49
includes may be defined as entire module sub-directories, or as invidual
50
.py files with in a module sub-directory.
52
Charm author can then sync in and update helpers as needed. The following
53
import all of charmhelpers.core + charmhelpers.contrib.openstack, and only
54
ceph_utils.py from charmhelpers.contrib.hahelpers:
56
$ charm-helper-sync -c charm-helpers.yaml
60
hooks/helpers/contrib/openstack
61
hooks/helpers/contrib/openstack/openstack_utils.py
62
hooks/helpers/contrib/openstack/__init__.py
63
hooks/helpers/contrib/hahelpers
64
hooks/helpers/contrib/hahelpers/ceph_utils.py
65
hooks/helpers/contrib/hahelpers/__init__.py
66
hooks/helpers/contrib/__init__.py
68
hooks/helpers/core/hookenv.py
69
hooks/helpers/core/host.py
70
hooks/helpers/core/__init__.py
71
hooks/helpers/__init__.py
74
Script will create missing __init__.py's to ensure each subdirectory is
75
importable, assuming the script is run from the charm's top-level directory.
77
You may also override configured destination directory and source bzr
80
$ charm-helper-sync -b ~/src/bzr/charm-helpers-dev \
81
-d hooks/helpers-test \
84
Or not use a config file at all:
85
$ charm-helper-sync -b lp:~gandelman-a/charm-helpers/fixes \
86
-d hooks/helpers core contrib.openstack contrib.hahelpers
88
Script will create missing __init__.py's to ensure each subdirectory is
89
importable, assuming the script is run from the charm's top-level directory.