All of lore.kernel.org
 help / color / mirror / Atom feed
* Best convention for FILES variable
@ 2020-11-21  2:49 rustyhowell
  2020-11-21  8:21 ` [yocto] " Chuck Wolber
  0 siblings, 1 reply; 5+ messages in thread
From: rustyhowell @ 2020-11-21  2:49 UTC (permalink / raw)
  To: yocto

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

Hello,
I am relatively new to yocto, and I am working on several recipes at the moment and I'm wondering about using wildcards in my FILES_{PN} list. None of the packages have more than 5 or 6 files to package. They could easily be covered with two wildcard entries, but I wonder if there is benefit to listing each file explicitly. Thanks for the help.  Example below:
FILES_fooz = "\
   */fooz* \
   */*/fooz* \
" vs
FILES_fooz = "\
   /lib/foozlib.so \
   /usr/lib/foozlib-2.so \
  /usr/bin/fooz \
  /bin/fooz \
  /usr/share/fooz \
" Thanks

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

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

* Re: [yocto] Best convention for FILES variable
  2020-11-21  2:49 Best convention for FILES variable rustyhowell
@ 2020-11-21  8:21 ` Chuck Wolber
  2020-11-21  8:35   ` Chuck Wolber
  0 siblings, 1 reply; 5+ messages in thread
From: Chuck Wolber @ 2020-11-21  8:21 UTC (permalink / raw)
  To: rustyhowell; +Cc: yocto

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

On Fri, Nov 20, 2020 at 6:49 PM <rustyhowell@gmail.com> wrote:

> Hello,
> I am relatively new to yocto, and I am working on several recipes at the
> moment and I'm wondering about using wildcards in my FILES_{PN} list. None
> of the packages have more than 5 or 6 files to package. They could easily
> be covered with two wildcard entries, but I wonder if there is benefit to
> listing each file explicitly. Thanks for the help.  Example below:
>
> FILES_fooz = "\
>     */fooz* \
>     */*/fooz* \
> "
>
> vs
>
> FILES_fooz = "\
>    /lib/foozlib.so \
>    /usr/lib/foozlib-2.so \
>    /usr/bin/fooz \
>    /bin/fooz \
>    /usr/share/fooz \
> "
>
>
Both will work, although you do run the risk of accidentally globbing files
that you do not mean to include, but perhaps you know your recipes well
enough that that is not a factor.

Personally, I find that being explicit makes a lot more sense for a few
reasons:

   - Stuff changes, and I _want_ a build error or warning to let me when it
   changes and someone forgot to update the recipe.
   - The grep command is your friend. If you glob, you lose a lot of
   fidelity there.
   - If you want to refactor a recipe into separate packages later, you
   probably need to do a lot of head scratching to pin down all of the files
   generated in the build.

And finally, I have adjusted to using the following pattern, and found that
it has improved maintainability a great deal. It applies to DEPENDS and
RDEPENDS as well. Yes, it is a bit tedious, but the benefits far outweigh
the cost (IMHO).

FILES_fooz += " lib/foozlib.so"
FILES_fooz += " /usr/lib/foozlib-2.so"
FILES_fooz += " /usr/bin/fooz"
FILES_fooz += " /bin/fooz"
FILES_fooz += " /usr/share/fooz"

This pattern is invaluable when you start accumulating a lot of recipes. A
recursive grep (grep -r) across a directory tree, will immediately tell you
that (for example), /bin/fooz is file in the fooz package and it is
referenced in the fooz_1.3.2.bb recipe.

..Ch:W..

-- 
*"Perfection must be reached by degrees; she requires the slow hand of
time." - Voltaire*

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

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

* Re: [yocto] Best convention for FILES variable
  2020-11-21  8:21 ` [yocto] " Chuck Wolber
@ 2020-11-21  8:35   ` Chuck Wolber
  2020-11-21 15:48     ` Robert P. J. Day
  0 siblings, 1 reply; 5+ messages in thread
From: Chuck Wolber @ 2020-11-21  8:35 UTC (permalink / raw)
  To: rustyhowell; +Cc: yocto

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

On Sat, Nov 21, 2020 at 12:21 AM Chuck Wolber <chuckwolber@gmail.com> wrote:

%< SNIP %<


> And finally, I have adjusted to using the following pattern, and found
> that it has improved maintainability a great deal. It applies to DEPENDS
> and RDEPENDS as well. Yes, it is a bit tedious, but the benefits far
> outweigh the cost (IMHO).
>
> FILES_fooz += " lib/foozlib.so"
> FILES_fooz += " /usr/lib/foozlib-2.so"
> FILES_fooz += " /usr/bin/fooz"
> FILES_fooz += " /bin/fooz"
> FILES_fooz += " /usr/share/fooz"
>
> This pattern is invaluable when you start accumulating a lot of recipes. A
> recursive grep (grep -r) across a directory tree, will immediately tell you
> that (for example), /bin/fooz is file in the fooz package and it is
> referenced in the fooz_1.3.2.bb recipe.
>


I forgot one other benefit. When a change is made to a recipe that uses
that pattern, the (Git) commit diff is a lot clearer and easier to
understand.

Think of it this way... Use your pattern, but imagine there are a lot more
entries in your list. A change to the middle of that list is going to
result in a diff that is hard to determine if it is a FILE_fooz entry or a
DEPENDS_${PN} entry. Prefixing with the directive keeps your Git history a
lot clearer.

..Ch:W..

-- 
*"Perfection must be reached by degrees; she requires the slow hand of
time." - Voltaire*

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

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

* Re: [yocto] Best convention for FILES variable
  2020-11-21  8:35   ` Chuck Wolber
@ 2020-11-21 15:48     ` Robert P. J. Day
  2020-11-21 22:11       ` Chuck Wolber
  0 siblings, 1 reply; 5+ messages in thread
From: Robert P. J. Day @ 2020-11-21 15:48 UTC (permalink / raw)
  To: Chuck Wolber; +Cc: rustyhowell, yocto

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

On Sat, 21 Nov 2020, Chuck Wolber wrote:

>
>
> On Sat, Nov 21, 2020 at 12:21 AM Chuck Wolber <chuckwolber@gmail.com> wrote:
>
> %< SNIP %<
>  
>       And finally, I have adjusted to using the following pattern, and found that it
>       has improved maintainability a great deal. It applies to DEPENDS and RDEPENDS
>       as well. Yes, it is a bit tedious, but the benefits far outweigh the cost
>       (IMHO).
>
> FILES_fooz += " lib/foozlib.so"
> FILES_fooz += " /usr/lib/foozlib-2.so"
> FILES_fooz += " /usr/bin/fooz"
> FILES_fooz += " /bin/fooz"
> FILES_fooz += " /usr/share/fooz"

  pedantically speaking, since you're using "+=", you don't need those
leading spaces.

rday

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

* Re: [yocto] Best convention for FILES variable
  2020-11-21 15:48     ` Robert P. J. Day
@ 2020-11-21 22:11       ` Chuck Wolber
  0 siblings, 0 replies; 5+ messages in thread
From: Chuck Wolber @ 2020-11-21 22:11 UTC (permalink / raw)
  To: Robert P. J. Day; +Cc: rustyhowell, yocto

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

On Sat, Nov 21, 2020 at 7:48 AM Robert P. J. Day <rpjday@crashcourse.ca>
wrote:

%< SNIP %<


>   pedantically speaking, since you're using "+=", you don't need those
> leading spaces.
>

Indeed you are correct. I believe I mistakenly conflated that particular
aspect of "_append" with "+=".

Thank you for pointing this out.

..Ch:W..

-- 
*"Perfection must be reached by degrees; she requires the slow hand of
time." - Voltaire*

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

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

end of thread, other threads:[~2020-11-21 22:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-21  2:49 Best convention for FILES variable rustyhowell
2020-11-21  8:21 ` [yocto] " Chuck Wolber
2020-11-21  8:35   ` Chuck Wolber
2020-11-21 15:48     ` Robert P. J. Day
2020-11-21 22:11       ` Chuck Wolber

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.