Without this change strutil.OrderedMap would panic on a duplicate
key. This change instead makes it return an error.
This means that, if you're `try`ing a snap, edit its `snap.yaml` to
accidentally have a duplicate key, instead of snapd getting
depramestrated the user will see an error. See [lp:1782990] for the
panic you used to get; with this change instead you get
```
$ snap info xyzzy --verbose
name: xyzzy
summary: ""
publisher: –
license: unset
description: |
notes:
private: false
confinement:
devmode: false
jailmode: false
trymode: true
enabled: true
broken: true (cannot use installed snap "xyzzy" at revision x1: cannot parse snap.yaml: found duplicate key "foo")
ignore-validation: false
refresh-date: today at 11:22 BST
installed: (x1) 0B
```
[lp:1782990]: https://bugs.launchpad.net/snapd/+bug/1782990
This allows to use nested env vars in the `environment:` block of a snap. It supports both the pre-existing environment (PATH, PS1, SNAP_*) and from within the environment. E.g.:
```
environment:
FOO: 1
BAR: $FOO/2
BAZ: $PATH:/something
```
will work.
The current search order is:
1. app specific environment
2. snap specific environment
3. os environment