def _generate_job_desc(zapp):
    """
    Generate the boot/system.map file contents from the zapp config file.

    :param zapp:
        `dict` of the contents of a ``zapp.yaml`` file.
    :returns:
        `dict` of the job description
    """
    job = []

    # TODO(mg): we should eventually reuse zvsh._nvram_escape
    def escape(value):
        for c in '\\", \n':
            value = value.replace(c, '\\x%02x' % ord(c))
        return value

    def translate_args(cmdline):
        # On Python 2, the yaml module loads non-ASCII strings as
        # unicode objects. In Python 2.7.2 and earlier, we must give
        # shlex.split a str -- but it is an error to give shlex.split
        # a bytes object in Python 3.
        need_decode = not isinstance(cmdline, str)
        if need_decode:
            cmdline = cmdline.encode('utf8')
        args = shlex.split(cmdline)
        if need_decode:
            args = [arg.decode('utf8') for arg in args]
        return ' '.join(escape(arg) for arg in args)

    for zgroup in zapp['execution']['groups']:
        # Copy everything, but handle 'env', 'path', and 'args' specially:
        jgroup = dict(zgroup)

        path = zgroup['path']
        # if path is `file://image:exe`, exec->name is "exe"
        # if path is `swift://~/container/obj`, exec->name is "obj"
        exec_name = None
        if path.startswith('file://'):
            exec_name = path.split(':')[-1]
        elif path.startswith('swift://'):
            # If obj is a pseudo path, like foo/bar/obj, we need to
            # handle this as well with a careful split.
            # If the object path is something like `swift://~/container/obj`,
            # then exec_name will be `obj`.
            # If the object path is something like
            # `swift://./container/foo/bar/obj`, then the exec_name will be
            # `foo/bar/obj`.
            exec_name = path.split('/', 4)[-1]

        jgroup['exec'] = {
            'path': zgroup['path'],
            'args': translate_args(zgroup['args']),
        }
        if exec_name is not None:
            jgroup['exec']['name'] = exec_name

        del jgroup['path'], jgroup['args']

        if 'env' in zgroup:
            jgroup['exec']['env'] = zgroup['env']
            del jgroup['env']
        job.append(jgroup)
    return job