Make WITH_USBIDS more visible, update usb.ids file #207

Merged
SlavekB merged 1 commits from feat/usbisd_file into master 3 years ago
Ghost commented 3 years ago

this add more visibility (for packagers) to the former WITH_USBIDS option.

this add more visibility (for packagers) to the former WITH_USBIDS option.
SlavekB requested changes 3 years ago
SlavekB left a comment
Owner

Here are a few things that need to be solved.

For consideration is whether to add support to use of the existing variable WITH_USBIDS if it is set?

Here are a few things that need to be solved. For consideration is whether to add support to use of the existing variable `WITH_USBIDS` if it is set?
if( _PATH_USBIDS )
set( PATH_USBIDS "${_PATH_USBIDS}" )
message( STATUS "PATH_USBIDS: ${_PATH_USBIDS}" )
endif()
Owner

If is requested WITH_SYSTEM_USBIDS, but the file is not found and WITH_USBIDS is not set, it should end up using tde_message_fatal(...).

If is requested `WITH_SYSTEM_USBIDS`, but the file is not found and `WITH_USBIDS` is not set, it should end up using `tde_message_fatal(...)`.
SlavekB marked this conversation as resolved
{
#ifndef USBIDS_FILE
TQString db = "/usr/share/hwdata/usb.ids"; /* on Fedora */
TQString db( PATH_USBIDS );
Owner

If is not used WITH_SYSTEM_USBIDS then PATH_USBIDS value will not be set. I'm afraid it causes unexpected behavior.

If is not used `WITH_SYSTEM_USBIDS` then `PATH_USBIDS` value will not be set. I'm afraid it causes unexpected behavior.
SlavekB marked this conversation as resolved
TQString db = USBIDS_FILE;
#endif
{
TQString db = locate("data", "kcmusb/usb.ids");
Owner

Using TQString db = locate(...) inside the {...} block causes it to be a local variable within a given block. This is probably not intended purpose.

Using `TQString db = locate(...)` inside the `{...}` block causes it to be a local variable within a given block. This is probably not intended purpose.
SlavekB marked this conversation as resolved
Ghost force-pushed feat/usbisd_file from 0057a358eb to 175b724f0b 3 years ago
Ghost added the PR/wip label 3 years ago
SlavekB requested changes 3 years ago
SlavekB left a comment
Owner

This looks reasonably. However, there are some little things that need to change.

This looks reasonably. However, there are some little things that need to change.
##### look for the usb.ids file
find_file( _PATH_USBIDS name usb.ids
Owner

Here it could be added to support existing option WITH_USBIDS. For example:

if( WITH_USBIDS )
    set( PATH_USBIDS "${WITH_USBIDS}" )
    message( STATUS "Used specified usb.ids file: $ {_ PATH_USBIDS}" )
else()
    find_file(...)
    ...
endif()
Here it could be added to support existing option `WITH_USBIDS`. For example: ``` if( WITH_USBIDS ) set( PATH_USBIDS "${WITH_USBIDS}" ) message( STATUS "Used specified usb.ids file: $ {_ PATH_USBIDS}" ) else() find_file(...) ... endif() ```
SlavekB marked this conversation as resolved
set( PATH_USBIDS "${_PATH_USBIDS}" )
message( STATUS "Looking for usb.ids file: ${_PATH_USBIDS}" )
else()
set( INCLUDED_USBIDS 1 )
Owner

I suggest a variable name: USE_BUILTIN_USBIDS.

I suggest a variable name: `USE_BUILTIN_USBIDS`.
SlavekB marked this conversation as resolved
config.h.cmake Outdated
#cmakedefine WORDS_BIGENDIAN @WORDS_BIGENDIAN@
/* Define the path for the usb.ids file */
#cmakedefine PATH_USBIDS "@PATH_USBIDS@"
Owner

Instead of #cmakedefine, use #define to define the constant always, even if it can have an empty value.

Instead of `#cmakedefine`, use `#define` to define the constant always, even if it can have an empty value.
SlavekB marked this conversation as resolved
#else
TQString db = USBIDS_FILE;
#endif
TQString db = "PATH_USBIDS";
Owner

Here you need to use PATH_USBIDS without quotation marks, as otherwise, instead of the value specified by the constant, the "PATH_USBIDS" string will be used. And such a string probably never will determine an existing file.

Here you need to use `PATH_USBIDS` without quotation marks, as otherwise, instead of the value specified by the constant, the "PATH_USBIDS" string will be used. And such a string probably never will determine an existing file.
SlavekB marked this conversation as resolved
Ghost force-pushed feat/usbisd_file from 175b724f0b to 6410b79a2d 3 years ago
Ghost commented 3 years ago
Poster

Automake build was not tested, It does work anymore on my system.

Automake build was not tested, It does work anymore on my system.
Ghost removed the PR/wip label 3 years ago
Ghost changed title from WIP:add WITH_SYSTEM_USBIDS option. to Make WITH_USBIDS more visible, update usb.ids file 3 years ago
Owner

Automake build was not tested, It does work anymore on my system.

I believe that testing and adjusting automake build is not needed. Everyone knows that the current is building using CMake. Here is more things that are not implemented in automake builds: merging translations into desktop files, selection and installation of TDM unit for systemd,…

Maybe it could be said that automake files are left here due to the fact that the generation of Apidox still depends on the common admin module and existence of Makefile.am files.

> Automake build was not tested, It does work anymore on my system. I believe that testing and adjusting automake build is not needed. Everyone knows that the current is building using CMake. Here is more things that are not implemented in automake builds: merging translations into desktop files, selection and installation of TDM unit for systemd,… Maybe it could be said that automake files are left here due to the fact that the generation of Apidox still depends on the common admin module and existence of Makefile.am files.
SlavekB requested changes 3 years ago
SlavekB left a comment
Owner

Great, it looks good. There are last little things that would be good to change.

Great, it looks good. There are last little things that would be good to change.
set( USBIDS_FILE "${WITH_USBIDS}" )
message( STATUS "Using specified usb.ids file: ${USBIDS_FILE}" )
else()
find_file( PATH_USBIDS name usb.ids
Owner

I believe that instead of name (singular, lowercase letters), it should be as a keyword NAMES (plural, capital letters). Or may be omitted.

I believe that instead of `name` (singular, lowercase letters), it should be as a keyword `NAMES` (plural, capital letters). Or may be omitted.
SlavekB marked this conversation as resolved
TQString db = USBIDS_FILE;
#endif
if (db.isNull() || !TQFile::exists(db))
Owner

Here I recommend using isEmpty() instead of isNull(). The empty string is valid => testing using the isNull() can lead to an unexpected result.

Here I recommend using `isEmpty()` instead of `isNull()`. The empty string is valid => testing using the `isNull()` can lead to an unexpected result.
SlavekB marked this conversation as resolved
Ghost force-pushed feat/usbisd_file from 5720975484 to 2797ae5a2b 3 years ago
Ghost force-pushed feat/usbisd_file from 2797ae5a2b to 2a38c3e239 3 years ago
Ghost force-pushed feat/usbisd_file from 2a38c3e239 to 96e6e3105e 3 years ago
Ghost force-pushed feat/usbisd_file from 96e6e3105e to 899c23fb9d 3 years ago
SlavekB approved these changes 3 years ago
SlavekB left a comment
Owner

It looks good.
Please make rebase to current head.

It looks good. Please make rebase to current head.
Ghost force-pushed feat/usbisd_file from 899c23fb9d to 1389e29696 3 years ago
SlavekB merged commit 1389e29696 into master 3 years ago
SlavekB deleted branch feat/usbisd_file 3 years ago
SlavekB added this to the R14.0.11 release milestone 3 years ago

Reviewers

SlavekB approved these changes 3 years ago
The pull request has been merged as 1389e29696.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: TDE/tdebase#207
Loading…
There is no content yet.