Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install UDev rules to the proper location by default #4114

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1373,23 +1373,19 @@ if(UNIX AND NOT APPLE)
if (INSTALL_USER_UDEV_RULES)
install(
FILES
"${CMAKE_CURRENT_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules"
"${CMAKE_CURRENT_SOURCE_DIR}/packaging/linux/69-mixxx-usb-uaccess.rules"
DESTINATION
"${MIXXX_INSTALL_DATADIR}/udev/rules.d"
"${CMAKE_INSTALL_LIBDIR}/udev/rules.d"
Copy link
Member

Choose a reason for hiding this comment

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

By default this is "/usr/local/lib/udev/rules.d" which is wrong at least for Ubuntu

Copy link
Contributor

Choose a reason for hiding this comment

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

So what is the problem? It did not install to the right place before either if the prefix was /usr/local

Copy link
Member

Choose a reason for hiding this comment

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

Before it was installed as data to the standard arch directory under a mixxx folder. I did not consider this as clutter.
Please refer to the original decision process. #3458

Copy link
Contributor

@Be-ing Be-ing Jul 20, 2021

Choose a reason for hiding this comment

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

The original decision was bad, as packagers have told us. This exists for their convenience. Please listen to them.

Copy link
Contributor

Choose a reason for hiding this comment

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

It makes no difference whether it is installed to one wrong location or another. Neither has an effect.

Copy link
Author

Choose a reason for hiding this comment

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

Note that Ubuntu will install it to the correct place if it's packaging sets -DCMAKE_INSTALL_PREFIX=/. If it doesn't right now, that's wrong anyhow.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

That's autoconf and not relevant for a CMake project. Besides, you should be able to overwrite whatever defaults it sets as a packager.

Copy link
Member

Choose a reason for hiding this comment

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

Oh right, wrong link:
https://github.com/Debian/debhelper/blob/eb6e510ef52430c6edb96b28879fa4f64fbcafdb/Debian/Debhelper/Buildsystem/cmake.pm#L15

Besides, you should be able to overwrite whatever defaults it sets as a packager.

Yes, but the point of the whole PR is to avoid manual steps, right?

Copy link
Author

Choose a reason for hiding this comment

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

I find configuring CMake correctly by adding an argument to the command you're calling any way better than executing an entirely new command 😉

But it seems Ubuntu installs things in places I didn't expect, so I guess the pkg-config method is the way to go. Closing this PR for now.

)
install(CODE "
message(STATUS \"Important Note: Installation of udev rules\n\"
\"The udev rule file for USB HID and Bulk controller permissions will be\n\"
\"installed to:\n\"
\" ${CMAKE_INSTALL_PREFIX}/${MIXXX_INSTALL_DATADIR}/udev/rules.d.\n\"
\" ${CMAKE_INSTALL_LIBDIR}/udev/rules.d.\n\"
\"If you are installing Mixxx from source for your own use, copy\n\"
\"mixxx-usb-uaccess.rules to /etc/udev/rules.d/ and run:\n\"
\"69-mixxx-usb-uaccess.rules to /etc/udev/rules.d/ and run:\n\"
\" udevadm control --reload-rules && udevadm trigger\n\"
\"as root to load the rules.\n\"
\"If you are building a package for a distribution, the correct directory for\n\"
Copy link
Member

Choose a reason for hiding this comment

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

Why was this passage removed?

Copy link
Author

Choose a reason for hiding this comment

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

Because the intent of this PR is to install it to the right place in the first place. At that point this comment is unnecessary, it'll already be in the right place.

Copy link
Member

Choose a reason for hiding this comment

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

Once we install it at the right place, we need to rewrite this message. Maybe it can be omitted entirely and only be issues as a fatal message if the detection of the correct install directory fails.
For that case we may take the directory including file name as a cmake option.

\"system rules is either /lib/udev/rules.d (e.g. Debian, Fedora) or\n\"
\"/usr/lib/udev/rules.d (e.g. Arch Linux) with an appropriate priority prefix.\n\"
\"Adjust your package script accordingly and set -DINSTALL_USER_UDEV_RULES=OFF\")
\"as root to load the rules.\n\")
")
endif()
endif()
Expand Down
6 changes: 3 additions & 3 deletions packaging/CPackDebInstall.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ configure_file(${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/con
@ONLY)
file(REMOVE ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/control.in)

file(COPY ${CPACK_DEBIAN_SOURCE_DIR}/res/linux/mixxx-usb-uaccess.rules
file(COPY ${CPACK_DEBIAN_SOURCE_DIR}/packaging/linux/69-mixxx-usb-uaccess.rules
DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian)
file(RENAME
${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx-usb-uaccess.rules
${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.mixxx-usb-uaccess.udev)
${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/69-mixxx-usb-uaccess.rules
${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.69-mixxx-usb-uaccess.udev)

execute_process(
COMMAND ${CPACK_DEBIAN_DOCBOOK_TO_MAN} debian/mixxx.sgml
Expand Down
6 changes: 3 additions & 3 deletions packaging/CPackDebUploadPPA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ execute_process(
WORKING_DIRECTORY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}
)

file(COPY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/res/linux/mixxx-usb-uaccess.rules
file(COPY ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/packaging/linux/69-mixxx-usb-uaccess.rules
DESTINATION ${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian)
file(RENAME
${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx-usb-uaccess.rules
${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.mixxx-usb-uaccess.udev)
${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/69-mixxx-usb-uaccess.rules
${CPACK_TOPLEVEL_DIRECTORY}/${CPACK_PACKAGE_FILE_NAME}/debian/mixxx.69-mixxx-usb-uaccess.udev)

if(DEB_BUILD)
execute_process(
Expand Down
2 changes: 1 addition & 1 deletion res/linux/mixxx.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</ul>
</description>
<provides>
<!-- Keep these IDs in sync with res/linux/mixxx-usb-uaccess.rules -->
<!-- Keep these IDs in sync with packaging/linux/69-mixxx-usb-uaccess.rules -->
<modalias>usb:v22F0p0008d*</modalias>
<modalias>usb:v1C75p*</modalias>
<modalias>usb:v1397p*</modalias>
Expand Down