[Buildroot] [PATCH/next v2 5/9] package/flutter-sdk-bin/Config.in.host: add pub-cache location option

Arnout Vandecappelle arnout at mind.be
Sun Nov 19 20:41:29 UTC 2023



On 19/11/2023 20:45, Yann E. MORIN wrote:
> Adam, All,
> 
> On 2023-11-19 10:47 -0700, Adam Duskett spake thusly:
>> This one we should discuss.
> 
> This is exactly what a review is for.
> 
>> While it's reasonable to set a default to either dl/flutter-pub-cache or dl/pub-cache (your choice obviously!),
> 
> I was thinking more like we did for cargo, as I hinted earlier by
> pointing to the commit which introduced it (8450b7691870):
> 
>      BR_CARGO_HOME = $(DL_DIR)/br-cargo-home
> 
> So:
> 
>      FLUTTER_SDK_BIN_PUB_CACHE = $(DL_DIR)/br-flutter-pub-cache

  +1

> 
> (As Thomas pointed out on IRC, DL_DIR is just the internal variable that
> gets set from BR2_DL_DIR; in all practical matters, they are the same.)
> 
>> we should still have this as a configurable string.
>> 1) The work is already done, and most users won't change the default.
> 
> "The work is done" is not a valid argument for applying a patch,
> otherwise we would just blindly apply all and every patches that are
> submitted, on the rationale that "the work is done".
> 
>> 2) When developing an application, the pub-cache directory may be somewhere more convenient for the developer.
>>       Maybe they want to use ~/.pub-cache, or in my case /home/adam/projects/${company}/${project}/pub-cache
>> This allows users to not have to re-download the pub-cache if it already exists on their system.
> 
> If one wants to avoid re-downloading stuff again and again, one has
> already set BR2_DL_DIR in their environment and thus storing the flutter
> pub-cache there, is indeed exactly what we want to do.
> 
> As for sharing the pub-cache with something outside of Buildroot, I
> would argue against. Sharing with the ouside world means we no longer
> have exclusivity, and thus we risk conflicts on access. We never
> account for out-of-Buildroot use of our caches.

  AFAIU, this is a cache that is not managed by Buildroot at all, but rather it 
is managed by whatever flutter tool we are using to manage downloads. AFAIU, the 
downloads actually happen during the build rather than the download stage 
even... So I don't think "we no longer have exclusivity" is really much of a factor.

  That said, I do think this is enough of a corner case that it doesn't need a 
config option. It's easy enough to symlink dl/br-flutter-pub-cache to whereever 
your flutter cache is.

  Regards,
  Arnout


> 
> Regards,
> Yann E. MORIN.
> 
>> As Thomas seems interested in Flutter, I'll also bring him in for his thoughts.
>> Thanks so much for the quick response!
>> Adam Duskett
>>
>> Senior Embedded Systems Developer
>>
>> [1]adam.duskett at amarulasolutions.com
>>
>> __________________________________
>>
>> Amarula Solutions BV
>>
>> Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
>>
>> T. +31 (0)85 111 9170
>> [2]info at amarulasolutions.com
>>
>> [3]www.amarulasolutions.com
>>
>> On Sun, Nov 19, 2023 at 1:21 AM Yann E. MORIN < [4]yann.morin.1998 at free.fr> wrote:
>>
>>    On 2023-11-18 15:12 -0700, Adam Duskett spake thusly:
>>    > When running the command "flutter pub get," the plugins are stored in the
>>    > pub-cache directory along with their sha256sum hashes. The default location
>>    > of the pub-cache directory is $(HOST_DIR)/share/flutter/sdk/.pub-cache.
>>    > While the above location is a perfectly acceptable choice by default, users
>>    > may want to define an alternate location to prevent downloading all of the
>>    > plugins on each fresh build of a Flutter application, and they may want to
>>    > commit the pub-cache directory to their project.
>>    >
>>    > Add the new option BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_PUB_CACHE_LOCATION to the
>>    > flutter-sdk-bin/Config.in.host file, and set the default to the current
>>    > default of $(HOST_DIR)/share/flutter/sdk/.pub-cache.
>>
>>    So, this is for caching the downloaded artefacts. It should probably be
>>    non-configurable, and should be moved into a sub-directory iof
>>    BR2_DL_DIR, like we have for cargo:
>>
>>        8450b7691870 package/pkg-cargo: move CARGO_HOME into DL_DIR
>>
>>    So I would suggest that we do similar for the flutter download cache.
>>
>>    As for wanted to commit that downladed stuff to git: if people want
>>    that, then they would also want to commit all ofthe download stuff, so
>>    just have them point BR2_DL_DIR to a sub-dir of their outter repository.
>>
>>    Regards,
>>    Yann E. MORIN.
>>
>>    > Signed-off-by: Adam Duskett < [5]adam.duskett at amarulasolutions.com>
>>    > ---
>>    >  package/flutter-sdk-bin/Config.in.host     | 11 +++++++++++
>>    >  package/flutter-sdk-bin/ [6]flutter-sdk-bin.mk |  2 +-
>>    >  2 files changed, 12 insertions(+), 1 deletion(-)
>>    >
>>    > diff --git a/package/flutter-sdk-bin/Config.in.host b/package/flutter-sdk-bin/Config.in.host
>>    > index a48714ea7f..0e31a8e0fa 100644
>>    > --- a/package/flutter-sdk-bin/Config.in.host
>>    > +++ b/package/flutter-sdk-bin/Config.in.host
>>    > @@ -14,3 +14,14 @@ config BR2_PACKAGE_HOST_FLUTTER_SDK_BIN
>>    >         free and open source.
>>    >
>>    >          [7]https://flutter.dev/
>>    > +
>>    > +if BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_ARCH_SUPPORTS
>>    > +
>>    > +config BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_PUB_CACHE_LOCATION
>>    > +     string "pub-cache location"
>>    > +     default "$(HOST_DIR)/share/flutter/sdk/.pub-cache"
>>    > +     help
>>    > +       Directory to store cached packages used by Pub with
>>    > +       Dart/Flutter.
>>    > +
>>    > +endif
>>    > diff --git a/package/flutter-sdk-bin/ [8]flutter-sdk-bin.mk b/package/flutter-sdk-bin/ [9]flutter-sdk-bin.mk
>>    > index 9461148dfb..6471c11d4e 100644
>>    > --- a/package/flutter-sdk-bin/ [10]flutter-sdk-bin.mk
>>    > +++ b/package/flutter-sdk-bin/ [11]flutter-sdk-bin.mk
>>    > @@ -95,4 +95,4 @@ HOST_FLUTTER_SDK_BIN_DART_BIN = \
>>    >  $(eval $(host-generic-package))
>>    >
>>    >  # For target packages to locate said pub-cache
>>    > -FLUTTER_SDK_BIN_PUB_CACHE = $(HOST_FLUTTER_SDK_BIN_SDK)/.pub-cache
>>    > +FLUTTER_SDK_BIN_PUB_CACHE = $(call qstrip,$(BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_PUB_CACHE_LOCATION))
>>    > --
>>    > 2.42.0
>>    >
>>    > _______________________________________________
>>    > buildroot mailing list
>>    > [12]buildroot at buildroot.org
>>    > [13]https://lists.buildroot.org/mailman/listinfo/buildroot
>>
>>    --
>>    .-----------------.--------------------.------------------.--------------------.
>>    |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
>>    | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
>>       |
>>    | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
>>    | [14]http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
>>    '------------------------------^-------^------------------^--------------------'
>>
>> Links:
>> 1. mailto:adam.duskett at amarulasolutions.com
>> 2. mailto:info at amarulasolutions.com
>> 3. http://www.amarulasolutions.com/
>> 4. mailto:yann.morin.1998 at free.fr
>> 5. mailto:adam.duskett at amarulasolutions.com
>> 6. http://flutter-sdk-bin.mk
>> 7. https://flutter.dev/
>> 8. http://flutter-sdk-bin.mk
>> 9. http://flutter-sdk-bin.mk
>> 10. http://flutter-sdk-bin.mk
>> 11. http://flutter-sdk-bin.mk
>> 12. mailto:buildroot at buildroot.org
>> 13. https://lists.buildroot.org/mailman/listinfo/buildroot
>> 14. http://ymorin.is-a-geek.org/
> 
>> _______________________________________________
>> buildroot mailing list
>> buildroot at buildroot.org
>> https://lists.buildroot.org/mailman/listinfo/buildroot
> 
> 



More information about the buildroot mailing list