Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Help to design an arbitrary ebuild signature
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
spica
Guru
Guru


Joined: 04 Jun 2021
Posts: 329

PostPosted: Fri Aug 16, 2024 11:06 pm    Post subject: Help to design an arbitrary ebuild signature Reply with quote

Please help me to design a user interface for a fork of `net-wireless/wireless-regdb` that will allow users to provide parameters in an arbitrary form. Users need to be able to modify band settings per particular country code and band.

Example: A user needs to change
FROM `(5150 - 5250 @ 80), (20)`
TO `(5150 - 5250 @ 80), (36)`
FOR `country US`

`5150 - 5250` is a band - this is a key
`80` - channel width - this is a value
`36` - is a power of radiation - this is a value

How users to provide this information to portage?

this is an example of the file to be modified:
Code:
country US: DFS-FCC
        # S1G Channel 1-3
        (902 - 904 @ 2), (30)
        # S1G Channel 5-35
        (904 - 920 @ 16), (30)
        # S1G Channel 37-51
        (920 - 928 @ 8), (30)
        (2400 - 2472 @ 40), (30)
        # 5.15 ~ 5.25 GHz: 30 dBm for master mode, 23 dBm for clients
        (5150 - 5250 @ 80), (20)
        (5250 - 5350 @ 80), (20)
Back to top
View user's profile Send private message
flexibeast
Guru
Guru


Joined: 04 Apr 2022
Posts: 431
Location: Naarm/Melbourne, Australia

PostPosted: Fri Aug 16, 2024 11:38 pm    Post subject: Reply with quote

Off the top of my head, and from a purely technical point of view, you could possibly prompt for user input during the `configure` phase, via the `read` shell builtin - presumably doing validation to only accept valid inputs - and during that same phase, use sed(1) to make the appropriate changes to the relevant source file. (And are there formally 'valid' inputs that might nevertheless cause certain hardware to break?)

The wisdom and/or legality of doing this is another matter. :-)
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 22602

PostPosted: Sat Aug 17, 2024 12:18 am    Post subject: Reply with quote

If the format of the input is not constrained, I suggest using /etc/portage/patches to apply a unified diff to the data file(s). This avoids the need to write a new interface and its parser, and delegates the work back to patch, which is a well understood format with good tooling support.
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9605
Location: beyond the rim

PostPosted: Sat Aug 17, 2024 8:11 am    Post subject: Reply with quote

What is the purpose of this interface? As this is a regulatory database it doesn't look right to allow the user to make arbitrary changes.

Also any changes would break the signature verification of the database, is that what your title is about?

Quote:
Off the top of my head, and from a purely technical point of view, you could possibly prompt for user input during the `configure` phase, via the `read` shell builtin - presumably doing validation to only accept valid inputs - and during that same phase, use sed(1) to make the appropriate changes to the relevant source file. (And are there formally 'valid' inputs that might nevertheless cause certain hardware to break?)

The wisdom and/or legality of doing this is another matter. :-)

It is a bad idea, ebuilds should not be interactive unless absolutely necessary (e.g. upstream nonsense) for many reasons.
If you really need the user to provide input for the build phase, just use variables to do so. If the OPs wants the user to make multiple changes to the database then things get really messy though. Doing this via ebuild simply is the wrong approach.
Back to top
View user's profile Send private message
spica
Guru
Guru


Joined: 04 Jun 2021
Posts: 329

PostPosted: Sat Aug 17, 2024 3:03 pm    Post subject: Reply with quote

Hu wrote:
If the format of the input is not constrained, I suggest using /etc/portage/patches to apply a unified diff to the data file(s). This avoids the need to write a new interface and its parser, and delegates the work back to patch, which is a well understood format with good tooling support.

This is the easiest approach, and it seems a way to go. Thanks

Genone wrote:
Also any changes would break the signature verification of the database, is that what your title is about?

The topic of verification does not raise a question; if someone is interested, the verification certificates are under net/wireless/certs directory
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum