Compose element loses symlink modifications from integration commands
Currently, if you replace an existing directory with a symbolic link as a part of integration commands, this modification is lost in the result of a compose
element which purports to retain the results of integration commands.
This is because of the current way things are setup, which are the way they are because splitting artifacts and running integration commands is a delicate business; in the case that we integrate and split artifacts; we currently do the following:
- First stage everything without splitting to
/
- This is because we cannot assume that we can run integration commands with partial artifacts, tools and files may be missing
- Snapshot the sandbox, recording file existence and timestamps
- Run the integration commands on the fully staged dependencies
- Snapshot the sandbox again, observing what files have been updated
- Stage the artifacts again, but this time applying split rules and staging into
%{install-root}
- Copy over the files which have changed as a result of integration commands into
%{install-root}
, overwriting files from staged artifacts which have changed as a result of integration (and adding newly created files which resulted from integration)
As you can notice, in this case we miss out on symlink modifications.
Proposed Change
The gist of the change here is that instead of re-staging the files from their originating artifacts into %{install-root}
and applying splitting rules, we gather the manifest using the split rules and use that to instead move files from /
into %{install-root}
This change will be safer for the symbolic link cases, and as a bonus it should also be more optimized.
It will require:
- Public API for the
Element
to report a manifest of it's artifact with split rules applied - An option to
utils.move_files()
which allows ignoringEEXIST
errors on source files (in case files have already been moved) - For the compose element to use the split manifests of each dependencies to move files over from
/
to%{install-root}
, ignoring EEXIST on sources - Test cases to ensure that replacement of a directory with a symbolic link works with a compose element's output
Note
This approach should also have the interesting side effect of preserving any intentionally created hardlinks in integration commands, which currently is meaningless, but will become interesting if and when:
- We resolve issue #38
- We fix upstream ostree or work around ostree in order to preserve information about hardlinks at artifact creation time, upstream ostree issue here