~snappy-dev/click/snappy

« back to all changes in this revision

Viewing changes to click/build.py

  • Committer: Michael Vogt
  • Date: 2015-02-23 15:13:35 UTC
  • mfrom: (535.4.25 yaml-manifest)
  • Revision ID: michael.vogt@ubuntu.com-20150223151335-836i28fwmpakgb55
* lp:~mvo/click/yaml-manifest:
  - add support for auto-generating "snappy-conifg" apparmor json

Show diffs side-by-side

added added

removed removed

Lines of Context:
77
77
SNAPPY_BINARY_APPARMOR_DEFAULT_TEMPLATE = \
78
78
  SNAPPY_SERVICE_APPARMOR_DEFAULT_TEMPLATE
79
79
 
 
80
# XXX For now, these are the same templates.
 
81
SNAPPY_CONFIG_APPARMOR_DEFAULT_TEMPLATE = \
 
82
  SNAPPY_SERVICE_APPARMOR_DEFAULT_TEMPLATE
 
83
 
80
84
 
81
85
@contextlib.contextmanager
82
86
def make_temp_dir():
228
232
        if "binaries" in self.manifest:
229
233
            del self.manifest["binaries"]
230
234
 
 
235
        # now add a default apparmor profile for "snappy-config"
 
236
        # NOTE: that this is currently not overridable
 
237
        name = "snappy-config"
 
238
        template_path = os.path.join(
 
239
            'meta', '{}.apparmor'.format(name))
 
240
        self.autogen_apparmor.append(
 
241
            (SNAPPY_CONFIG_APPARMOR_DEFAULT_TEMPLATE, template_path))
 
242
        self.manifest["hooks"][name] = {}
 
243
        self.manifest["hooks"][name]["apparmor"] = template_path
 
244
 
231
245
    def _read_manifest_json(self, manifest_path):
232
246
        """Compat with the "old" click json format"""
233
247
        with io.open(manifest_path, encoding="UTF-8") as manifest: