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

linux: cp project and device device tree, silence errors #1491

Merged
merged 1 commit into from
Apr 8, 2017
Merged

linux: cp project and device device tree, silence errors #1491

merged 1 commit into from
Apr 8, 2017

Conversation

MilhouseVH
Copy link
Contributor

This gets rid of the following errors when building the kernel:

cp: cannot stat 'projects/Generic/devices//config/*-overlay.dts': No such file or directory
cp: cannot stat 'projects/Generic/devices//config/dt-blob.dts': No such file or directory

Currently the only projects or devices with dts files are Slice and Slice3:

projects/RPi/devices/Slice/config/dt-blob.dts
projects/RPi/devices/Slice/config/ws2812-overlay.dts
projects/RPi/devices/Slice/config/slice-overlay.dts
projects/RPi/devices/Slice3/config/dt-blob.dts
projects/RPi/devices/Slice3/config/ws2812-overlay.dts
projects/RPi/devices/Slice3/config/slice-overlay.dts

With this PR we:

  1. Silence the errors when no dts files are present
  2. Add support for "common" project-level dts files
  3. Avoid accessing the devices directory when $DEVICE is not defined

Perhaps this is overkill for a largely cosmetic issue, but #2 above might prove useful.

@vpeter4
Copy link
Contributor

vpeter4 commented Mar 28, 2017

Is loop really necessary? What about just redirecting error to null?
cp -v ..... 2>/dev/null || :
Instead of 4 lines there are 14 of them :(

@MilhouseVH
Copy link
Contributor Author

Necessary? No it's absolutely not, but it's the usual method we've used elsewhere so it is at least consistent. :)

As I say it's probably overkill, but it is also perhaps a little bit more "correct" than copying and ignoring/throwing away the error.

Chewitt raised the initial error, so I'll let him decide if he wants this or not, or prefers ignoring the error in which case it can be refactored along those lines while also handling common project files.

@vpeter4
Copy link
Contributor

vpeter4 commented Mar 28, 2017

I just mentioned this because when reading such code it takes more time to think what it does and when something is copied. With one liner cp it is clear immediately. KISS way :)
Not that this has any important factor when running.

@MilhouseVH
Copy link
Contributor Author

I do agree the one liner is clearer, however I guess it's a choice between brevity (which may cover up potential errors) and being verbose (but safe).

In the past we've tended towards the latter, and I think on the whole it's something I'd favour as I really don't like failing silently unless it's absolutely essential.

@vpeter4
Copy link
Contributor

vpeter4 commented Mar 28, 2017

Well, I think I agree with this. Especially after remembering cp issue with wildcard on 2 folders few days back :-)

Some helper function for such copy would be useful too - loop_cp with two arguments.

@MilhouseVH
Copy link
Contributor Author

Yes, I think there are a number of places where some helper functions would be useful, this being one such example, particularly as a helper function would automatically handle projects and devices. It's something I intend to tackle. To that end I'd suggest keeping this PR as is, and eventually this type of code will hopefully disappear.

Copy link
Member

@chewitt chewitt left a comment

Choose a reason for hiding this comment

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

thanks :)

@chewitt chewitt merged commit a96b573 into LibreELEC:master Apr 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants