Skip to content
This repository has been archived by the owner on Jul 19, 2018. It is now read-only.

Make the layers install into the data root directory #2603

Merged
merged 1 commit into from Apr 28, 2018

Conversation

sarnex
Copy link
Contributor

@sarnex sarnex commented Apr 22, 2018

Hi,

I think the layers files should be installed in the data root directory. They are not configuration files, so they do not belong in /etc. Please review,

Sarnex

@CLAassistant
Copy link

CLAassistant commented Apr 22, 2018

CLA assistant check
All committers have signed the CLA.

@mark-lunarg
Copy link
Collaborator

Please see CONTRIBUTING.md and the continuous-integration/travis-ci/pr results for commit format assistance.

@karl-lunarg
Copy link
Contributor

The description of the GNUInstallDirs suggests that both the SYSCONFDIR and the DATAROOTDIR are for "data" files, so I'm not sure I see the distinction.

Do you have some sort of reference, like the FHS, that suggests DATAROOTDIR is preferable to SYSCONFDIR?

I also believe that you can override the value of SYSCONFDIR on the CMake command line if the default location is not suitable for you.

@sarnex
Copy link
Contributor Author

sarnex commented Apr 25, 2018

Hi Karl,

Thanks for your comment and interest. Based on the GnuInstallDirs doc we can see that:


SYSCONFDIR       - read-only single-machine data (etc)
DATAROOTDIR      - read-only architecture-independent data root (share)

I believe the JSON files that this area is installing fits better under the latter, as it appears to be architecture independent.

In addition, we see that these values are expanded to /etc and /usr/share respectively. If we look at FHS, section 3.7 states that /etc is for the below purpose:

"The /etc hierarchy contains configuration files. A "configuration file" is a local file used to control the operation
of a program; it must be static and cannot be an executable binary. "

Section 4.11 decesribes /usr/share:

The /usr/share hierarchy is for all read-only architecture independent data files. 
...
Any program or package which contains or requires data that doesn’t need to be modified should store that data in /usr/share 

As far as I can tell, the installed files are not configuration files. Due to these reasons, I feel this data fits better in /usr/share (DATAROOTDIR) than /etc (SYSCONFIGDIR)

I am a maintainer for Gentoo, and we are currently shipping a patch to fix this behavior as I feel it is an upstream issue. I could just change the value of SYSCONFDIR in CMake, but this solution is cleaner.

Please let me know if you have any comments.

If there is a chance of this being accepted, I will work on commit format.

Thanks,
Sarnex

@karl-lunarg
Copy link
Contributor

We've always thought of these files as configuration files, but I concede that users rarely edit these files. And I just think that early momentum in this project placed the files in /etc.

Another data point is that the proprietary nvidia driver installer places a similar file in /etc/vulkan/icd.d that does pretty much the same thing. We can't change that here, but it shows some precedent and there is some value in the sense of consistency if these layer "config" files are in the same place.

The good news is that the Vulkan loader has, for a long time, searched the /usr/share (DATAROOTDIR) for these files when built with default settings. So moving them should not be a problem.

But the loader's search paths can be configured at build time. It is possible, for example, for a package maintainer to build the loader with an alternate value for DATAROOTDIR such that /usr/share is not searched, but /etc still is. Then this change could result in a loader not finding the layers. But I think that the surface area of this risk is pretty small. And it may not be a problem at all if the loader and layers are built with the same settings.

I think we're leaning towards accepting this change, so go ahead and fix up the commit message. If you know about any other package maintainers that may be interested in this change, see if you can get them to review this and give a 👍 or whatever. I do worry about breakage in that area.

@sarnex
Copy link
Contributor Author

sarnex commented Apr 27, 2018

Thank you Karl. I have fixed the commit message. Please let me know if there is something I missed.

I will email other maintainers now, but I can't say that any of them will actually look at this PR let alone review my change.

Thank you,
Sarnex

@tjaalton
Copy link
Contributor

tjaalton commented Apr 27, 2018

Debian/Ubuntu already move the layer files under /usr/share/vulkan, so making it the default would be a welcomed change.

@@ -142,7 +142,7 @@ if(UNIX)
VERBATIM
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/linux/${config_file}.json
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${config_file}.json DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/vulkan/explicit_layer.d)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/staging-json/${config_file}.json DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/vulkan/explicit_layer.d)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hate to do this, but could you also please fix the comment a few lines up? Perhaps just change it to

# Need to remove the "./" from the library path before installing to system directories.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@karl-lunarg
Copy link
Contributor

I'm sorry I didn't catch the comment problem sooner. After that, we should be good,
Thanks, @tjaalton for the extra input; that helps a lot.

The layers files fit are not really configuration files and are rarely
edited by users. So, let's move the install location into the
data root directory.

Signed-off-by: Nick Sarnie <sarnex@gentoo.org>
@sarnex
Copy link
Contributor Author

sarnex commented Apr 27, 2018

@karl-lunarg Done, good catch

@karl-lunarg karl-lunarg merged commit 0a93656 into KhronosGroup:master Apr 28, 2018
@sarnex
Copy link
Contributor Author

sarnex commented Apr 28, 2018

Thanks Karl!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants