All of lore.kernel.org
 help / color / mirror / Atom feed
* recipe design curiosity: how to best install a package configuration file?
@ 2020-03-20 11:04 Robert P. J. Day
  2020-03-20 11:15 ` Ankur Tyagi
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Robert P. J. Day @ 2020-03-20 11:04 UTC (permalink / raw)
  To: OE Core mailing list


  got into a discussion yesterday about the "cleanest" way to design a
.bbappend file to install a package's configuration file, so i'm
curious about best practices, and here's an example. (and i'm asking
as it looks like this will be an issue for a number of recipes i'm
looking at.)

  current recipe for conntrack-tools:

http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-filter/conntrack-tools/conntrack-tools_1.4.5.bb

note how the recipe install step installs a conntrack.conf.sample
file:

do_install_append() {
  install -d ${D}/${sysconfdir}/conntrackd
  install -d ${D}/${sysconfdir}/init.d
  install -m 0644 ${S}/doc/sync/ftfw/conntrackd.conf ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample
  ...

so far, so good. now, in cases where a sample conf file is provided,
there is, of course, no guarantee that it will be applicable out of
the box -- one *expects* that it might be necessary to tweak such a
file and install it as part of a .bbappend file. and here's the point
of contention.

  in this current situation, it turns out that that sample conf file
just happens to be appropriate, so the entire .bbappend file for this
recipe consists of:

do_install_append () {
    install -m 0644  \
    ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample \
    ${D}/${sysconfdir}/conntrackd/conntrackd.conf
}

  yes, that will work, but i suggested that, even though it's
convenient, the problem with that approach is that looking at the
.bbappend file doesn't show you the contents of the file that will be
installed. to see the actual conf file, you'd have to peruse the
source, or check the final result ... you get the idea.

  i suggested that, even though the sample file in *this* case was
perfectly appropriate, i would choose to make a copy of it under
files/, and install the conf file from *there*, the advantage being
that the actual file being installed is immediately readable.

  does anyone have any strong opinions on this? it seems mundane, but
i think the latter approach is still superior, especially since i
suspect most sample configuration files would have to be adjusted,
anyway.

  thoughts? just trying to collect some best practices to apply to
this project.

rday


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: recipe design curiosity: how to best install a package configuration file?
  2020-03-20 11:04 recipe design curiosity: how to best install a package configuration file? Robert P. J. Day
@ 2020-03-20 11:15 ` Ankur Tyagi
  2020-03-20 11:32   ` Robert P. J. Day
  2020-03-20 11:28 ` Adrian Bunk
  2020-03-20 12:12 ` Quentin Schulz
  2 siblings, 1 reply; 7+ messages in thread
From: Ankur Tyagi @ 2020-03-20 11:15 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: OE Core mailing list

[-- Attachment #1: Type: text/plain, Size: 2900 bytes --]

what if sample file is updated in new version? Now you have to maintain the
copy in your "file/" as well.

If you are using sample file as it is, then keeping a copy is probably not
a good idea

Cheers
Ankur

On Sat, Mar 21, 2020, 12:04 AM Robert P. J. Day <rpjday@crashcourse.ca>
wrote:

>
>   got into a discussion yesterday about the "cleanest" way to design a
> .bbappend file to install a package's configuration file, so i'm
> curious about best practices, and here's an example. (and i'm asking
> as it looks like this will be an issue for a number of recipes i'm
> looking at.)
>
>   current recipe for conntrack-tools:
>
>
> http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-filter/conntrack-tools/conntrack-tools_1.4.5.bb
>
> note how the recipe install step installs a conntrack.conf.sample
> file:
>
> do_install_append() {
>   install -d ${D}/${sysconfdir}/conntrackd
>   install -d ${D}/${sysconfdir}/init.d
>   install -m 0644 ${S}/doc/sync/ftfw/conntrackd.conf
> ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample
>   ...
>
> so far, so good. now, in cases where a sample conf file is provided,
> there is, of course, no guarantee that it will be applicable out of
> the box -- one *expects* that it might be necessary to tweak such a
> file and install it as part of a .bbappend file. and here's the point
> of contention.
>
>   in this current situation, it turns out that that sample conf file
> just happens to be appropriate, so the entire .bbappend file for this
> recipe consists of:
>
> do_install_append () {
>     install -m 0644  \
>     ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample \
>     ${D}/${sysconfdir}/conntrackd/conntrackd.conf
> }
>
>   yes, that will work, but i suggested that, even though it's
> convenient, the problem with that approach is that looking at the
> .bbappend file doesn't show you the contents of the file that will be
> installed. to see the actual conf file, you'd have to peruse the
> source, or check the final result ... you get the idea.
>
>   i suggested that, even though the sample file in *this* case was
> perfectly appropriate, i would choose to make a copy of it under
> files/, and install the conf file from *there*, the advantage being
> that the actual file being installed is immediately readable.
>
>   does anyone have any strong opinions on this? it seems mundane, but
> i think the latter approach is still superior, especially since i
> suspect most sample configuration files would have to be adjusted,
> anyway.
>
>   thoughts? just trying to collect some best practices to apply to
> this project.
>
> rday
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 3891 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: recipe design curiosity: how to best install a package configuration file?
  2020-03-20 11:04 recipe design curiosity: how to best install a package configuration file? Robert P. J. Day
  2020-03-20 11:15 ` Ankur Tyagi
@ 2020-03-20 11:28 ` Adrian Bunk
  2020-03-20 11:57   ` Robert P. J. Day
  2020-03-20 12:12 ` Quentin Schulz
  2 siblings, 1 reply; 7+ messages in thread
From: Adrian Bunk @ 2020-03-20 11:28 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: OE Core mailing list

On Fri, Mar 20, 2020 at 07:04:05AM -0400, Robert P. J. Day wrote:
>...
>   in this current situation, it turns out that that sample conf file
> just happens to be appropriate,
>...

I'd guess you are wrong on that.

  IPv4_interface 192.168.100.100
  Interface eth2


> rday

cu
Adrian


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: recipe design curiosity: how to best install a package configuration file?
  2020-03-20 11:15 ` Ankur Tyagi
@ 2020-03-20 11:32   ` Robert P. J. Day
  2020-03-20 11:47     ` Ankur Tyagi
  0 siblings, 1 reply; 7+ messages in thread
From: Robert P. J. Day @ 2020-03-20 11:32 UTC (permalink / raw)
  To: Ankur Tyagi; +Cc: OE Core mailing list

[-- Attachment #1: Type: text/plain, Size: 3862 bytes --]

On Sat, 21 Mar 2020, Ankur Tyagi wrote:

> what if sample file is updated in new version? Now you have to
> maintain the copy in your "file/" as well.
>
> If you are using sample file as it is, then keeping a copy is
> probably not a good idea
>
> Cheers
> Ankur

  i actually think that's an argument in my favour ... i would be very
nervous about how upgrading a recipe version would quietly upgrade my
configuration file. i would far prefer to have to manually upgrade my
configuration to keep in step.

rday

>         got into a discussion yesterday about the "cleanest" way to design a
>       .bbappend file to install a package's configuration file, so i'm
>       curious about best practices, and here's an example. (and i'm asking
>       as it looks like this will be an issue for a number of recipes i'm
>       looking at.)
>
>         current recipe for conntrack-tools:
>
>       http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-filter/conntrack-tools/conntrack-tools_1.4.5.bb
>
>       note how the recipe install step installs a conntrack.conf.sample
>       file:
>
>       do_install_append() {
>         install -d ${D}/${sysconfdir}/conntrackd
>         install -d ${D}/${sysconfdir}/init.d
>         install -m 0644 ${S}/doc/sync/ftfw/conntrackd.conf ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample
>         ...
>
>       so far, so good. now, in cases where a sample conf file is provided,
>       there is, of course, no guarantee that it will be applicable out of
>       the box -- one *expects* that it might be necessary to tweak such a
>       file and install it as part of a .bbappend file. and here's the point
>       of contention.
>
>         in this current situation, it turns out that that sample conf file
>       just happens to be appropriate, so the entire .bbappend file for this
>       recipe consists of:
>
>       do_install_append () {
>           install -m 0644  \
>           ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample \
>           ${D}/${sysconfdir}/conntrackd/conntrackd.conf
>       }
>
>         yes, that will work, but i suggested that, even though it's
>       convenient, the problem with that approach is that looking at the
>       .bbappend file doesn't show you the contents of the file that will be
>       installed. to see the actual conf file, you'd have to peruse the
>       source, or check the final result ... you get the idea.
>
>         i suggested that, even though the sample file in *this* case was
>       perfectly appropriate, i would choose to make a copy of it under
>       files/, and install the conf file from *there*, the advantage being
>       that the actual file being installed is immediately readable.
>
>         does anyone have any strong opinions on this? it seems mundane, but
>       i think the latter approach is still superior, especially since i
>       suspect most sample configuration files would have to be adjusted,
>       anyway.
>
>         thoughts? just trying to collect some best practices to apply to
>       this project.
>
>       rday
>       --
>       _______________________________________________
>       Openembedded-core mailing list
>       Openembedded-core@lists.openembedded.org
>       http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>
>

-- 

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                         http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: recipe design curiosity: how to best install a package configuration file?
  2020-03-20 11:32   ` Robert P. J. Day
@ 2020-03-20 11:47     ` Ankur Tyagi
  0 siblings, 0 replies; 7+ messages in thread
From: Ankur Tyagi @ 2020-03-20 11:47 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: OE Core mailing list

[-- Attachment #1: Type: text/plain, Size: 4763 bytes --]

new recipe version (most likely) will have new release and expect any change

If you are concerned about recipe version in your layer then manage that
rather than copying original recipe file *as it is* in your layer

When upgrading recipe, anyway have to test it to make sure your image
doesn't break. So no way you will miss any breaking change introduced. And
at that point you could have (if needed) your custom version in "file/"
rather than always copying the working sample which is already maintained
by someone else

I wouldn't recommend to have copy of unchanged upstream files in a custom
layer

Cheers
Ankur

On Sat, Mar 21, 2020, 12:32 AM Robert P. J. Day <rpjday@crashcourse.ca>
wrote:

> On Sat, 21 Mar 2020, Ankur Tyagi wrote:
>
> > what if sample file is updated in new version? Now you have to
> > maintain the copy in your "file/" as well.
> >
> > If you are using sample file as it is, then keeping a copy is
> > probably not a good idea
> >
> > Cheers
> > Ankur
>
>   i actually think that's an argument in my favour ... i would be very
> nervous about how upgrading a recipe version would quietly upgrade my
> configuration file. i would far prefer to have to manually upgrade my
> configuration to keep in step.
>
> rday
>
> >         got into a discussion yesterday about the "cleanest" way to
> design a
> >       .bbappend file to install a package's configuration file, so i'm
> >       curious about best practices, and here's an example. (and i'm
> asking
> >       as it looks like this will be an issue for a number of recipes i'm
> >       looking at.)
> >
> >         current recipe for conntrack-tools:
> >
> >
> http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-filter/conntrack-tools/conntrack-tools_1.4.5.bb
> >
> >       note how the recipe install step installs a conntrack.conf.sample
> >       file:
> >
> >       do_install_append() {
> >         install -d ${D}/${sysconfdir}/conntrackd
> >         install -d ${D}/${sysconfdir}/init.d
> >         install -m 0644 ${S}/doc/sync/ftfw/conntrackd.conf
> ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample
> >         ...
> >
> >       so far, so good. now, in cases where a sample conf file is
> provided,
> >       there is, of course, no guarantee that it will be applicable out of
> >       the box -- one *expects* that it might be necessary to tweak such a
> >       file and install it as part of a .bbappend file. and here's the
> point
> >       of contention.
> >
> >         in this current situation, it turns out that that sample conf
> file
> >       just happens to be appropriate, so the entire .bbappend file for
> this
> >       recipe consists of:
> >
> >       do_install_append () {
> >           install -m 0644  \
> >           ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample \
> >           ${D}/${sysconfdir}/conntrackd/conntrackd.conf
> >       }
> >
> >         yes, that will work, but i suggested that, even though it's
> >       convenient, the problem with that approach is that looking at the
> >       .bbappend file doesn't show you the contents of the file that will
> be
> >       installed. to see the actual conf file, you'd have to peruse the
> >       source, or check the final result ... you get the idea.
> >
> >         i suggested that, even though the sample file in *this* case was
> >       perfectly appropriate, i would choose to make a copy of it under
> >       files/, and install the conf file from *there*, the advantage being
> >       that the actual file being installed is immediately readable.
> >
> >         does anyone have any strong opinions on this? it seems mundane,
> but
> >       i think the latter approach is still superior, especially since i
> >       suspect most sample configuration files would have to be adjusted,
> >       anyway.
> >
> >         thoughts? just trying to collect some best practices to apply to
> >       this project.
> >
> >       rday
> >       --
> >       _______________________________________________
> >       Openembedded-core mailing list
> >       Openembedded-core@lists.openembedded.org
> >       http://lists.openembedded.org/mailman/listinfo/openembedded-core
> >
> >
> >
>
> --
>
> ========================================================================
> Robert P. J. Day                                 Ottawa, Ontario, CANADA
>                          http://crashcourse.ca
>
> Twitter:                                       http://twitter.com/rpjday
> LinkedIn:                               http://ca.linkedin.com/in/rpjday
> ========================================================================

[-- Attachment #2: Type: text/html, Size: 6621 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: recipe design curiosity: how to best install a package configuration file?
  2020-03-20 11:28 ` Adrian Bunk
@ 2020-03-20 11:57   ` Robert P. J. Day
  0 siblings, 0 replies; 7+ messages in thread
From: Robert P. J. Day @ 2020-03-20 11:57 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: OE Core mailing list

On Fri, 20 Mar 2020, Adrian Bunk wrote:

> On Fri, Mar 20, 2020 at 07:04:05AM -0400, Robert P. J. Day wrote:
> >...
> >   in this current situation, it turns out that that sample conf file
> > just happens to be appropriate,
> >...
>
> I'd guess you are wrong on that.
>
>   IPv4_interface 192.168.100.100
>   Interface eth2

  ah, i was just going on the recipe append file as it was, which
simply copied that sample file. now i'm even more curious as to what's
going on in the background, as i did not create that append file.

rday


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: recipe design curiosity: how to best install a package configuration file?
  2020-03-20 11:04 recipe design curiosity: how to best install a package configuration file? Robert P. J. Day
  2020-03-20 11:15 ` Ankur Tyagi
  2020-03-20 11:28 ` Adrian Bunk
@ 2020-03-20 12:12 ` Quentin Schulz
  2 siblings, 0 replies; 7+ messages in thread
From: Quentin Schulz @ 2020-03-20 12:12 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: OE Core mailing list

Hi Robert,

On Fri, Mar 20, 2020 at 07:04:05AM -0400, Robert P. J. Day wrote:
> 
>   got into a discussion yesterday about the "cleanest" way to design a
> .bbappend file to install a package's configuration file, so i'm
> curious about best practices, and here's an example. (and i'm asking
> as it looks like this will be an issue for a number of recipes i'm
> looking at.)
> 
>   current recipe for conntrack-tools:
> 
> http://cgit.openembedded.org/meta-openembedded/tree/meta-networking/recipes-filter/conntrack-tools/conntrack-tools_1.4.5.bb
> 
> note how the recipe install step installs a conntrack.conf.sample
> file:
> 
> do_install_append() {
>   install -d ${D}/${sysconfdir}/conntrackd
>   install -d ${D}/${sysconfdir}/init.d
>   install -m 0644 ${S}/doc/sync/ftfw/conntrackd.conf ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample
>   ...
> 
> so far, so good. now, in cases where a sample conf file is provided,
> there is, of course, no guarantee that it will be applicable out of
> the box -- one *expects* that it might be necessary to tweak such a
> file and install it as part of a .bbappend file. and here's the point
> of contention.
> 
>   in this current situation, it turns out that that sample conf file
> just happens to be appropriate, so the entire .bbappend file for this
> recipe consists of:
> 
> do_install_append () {
>     install -m 0644  \
>     ${D}/${sysconfdir}/conntrackd/conntrackd.conf.sample \
>     ${D}/${sysconfdir}/conntrackd/conntrackd.conf
> }
> 
>   yes, that will work, but i suggested that, even though it's
> convenient, the problem with that approach is that looking at the
> .bbappend file doesn't show you the contents of the file that will be
> installed. to see the actual conf file, you'd have to peruse the
> source, or check the final result ... you get the idea.
> 
>   i suggested that, even though the sample file in *this* case was
> perfectly appropriate, i would choose to make a copy of it under
> files/, and install the conf file from *there*, the advantage being
> that the actual file being installed is immediately readable.
> 

Have a look at how wpa-supplicant is doing it.

It has two config files. wpa-supplicant.conf which is going straight
to the docs directory on the rootfs and wpa-supplicant.conf-sane which
is the one used by wpa-supplicant at runtime.

So when you want to override the default wpa-supplicant.conf, you
override wpa-supplicant.conf-sane in a bbappend.

I don't know if it's the proper way, but that's one and particularly in
poky which is usually done with best practices in mind.

Quentin


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-03-20 12:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-20 11:04 recipe design curiosity: how to best install a package configuration file? Robert P. J. Day
2020-03-20 11:15 ` Ankur Tyagi
2020-03-20 11:32   ` Robert P. J. Day
2020-03-20 11:47     ` Ankur Tyagi
2020-03-20 11:28 ` Adrian Bunk
2020-03-20 11:57   ` Robert P. J. Day
2020-03-20 12:12 ` Quentin Schulz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.