[LEDE-DEV] [PATCH 1/5] base-files: introduce /lib/functions/board.sh

Felix Fietkau nbd at nbd.name
Wed May 3 03:38:51 PDT 2017


On 2017-05-03 12:15, Roman Yeryomin wrote:
>>> Simply including a big
>>> functions.sh doesn't say anything and IMO can only be a workaround,
>>> when you don't know what you need. But even now this doesn't work
>>> because there are separate files in /lib/functions/
>> In this case we're talking about *one* *single* *one-line* function (if
>> you leave out the unused board_model function, which you really should).
>> How does having a separate include file make sense?
> 
> As I said, most target scripts need either board_name alone or a
> fraction of functions.sh
> Those which don't need board_name also need only a fraction of functions.sh
At the moment, almost all of them include functions.sh either directly
or indirectly.

>> As I mentioned earlier, if there are significant cases where you could
>> avoid including functions.sh entirely, you could put this one-line
>> function into a different one if you like, e.g. system.sh
> 
> I see such solution only increasing the clutter.
> Many scrips now include functions.sh because authors simply didn't
> want to look at the source and see that they don't need it. Even that
> bad.
> Some functions are completely unused.
> 
> Maybe it wasn't clear -- I'm volunteering to clean this clutter up.
> But since it's spread all over the tree, I would do it step by step,
> so it will take some time.
I do agree with the goal of having a better split and smaller files, I
just don't want to have tons of .sh files with just 1 or 2 one-liner
functions.

I fully support you going ahead and cleaning it up, but it would be nice
if we could find some agreement first on what the cleaned up version
should look like. We should definitely discuss this further.

Would you be okay with leaving this function where it is until we have a
better plan on how to re-organize .sh include files?
I think your board detection and ipq806x script cleanup is good and it
shouldn't be held up by the generic shell script include discussion.

Thanks,

- Felix



More information about the Lede-dev mailing list