OnionIoT / openwrt-sdk-wrapper

Easily build packages using the OpenWRT SDK
MIT License
1 stars 1 forks source link

prepare_sdk function called multiple times during setup_sdk #9

Closed greenbreakfast closed 1 year ago

greenbreakfast commented 1 year ago

Description

After updates in PR #8, it looks like the prepare_sdk function will be called multiple times when onion_buildenv is called with the setup_sdk argument

Steps to Reproduce

Running bash onion_buildenv setup_sdk

When the setup_sdk function is run

https://github.com/OnionIoT/openwrt-sdk-wrapper/blob/65ea6c1c3f72278e15ff64ea1fec9b819348910c/onion_buildenv#L118-L124

It will call the update_package_feeds function and the prepare_sdk function.

However, the update_package_feeds function will ALSO call prepare_sdk (on line 108):

https://github.com/OnionIoT/openwrt-sdk-wrapper/blob/65ea6c1c3f72278e15ff64ea1fec9b819348910c/onion_buildenv#L100-L111

⚠️ Resulting in prepare_sdk being run twice.

Running bash onion_buildenv update_sdk -> No Issue

The update_sdk doesn't have this issue:

https://github.com/OnionIoT/openwrt-sdk-wrapper/blob/65ea6c1c3f72278e15ff64ea1fec9b819348910c/onion_buildenv#L113C15-L116

Proposed Resolution

We should avoid running prepare_sdk twice since the feeds update and installation operations take quite a bit of time

Possible solutions:

  1. Remove prepare_sdk call from update_package_feeds, and add prepare_sdk call to update_sdk
  2. Remote prepare_sdk from setup_sdk

Will leave this up to you @jempatel

greenbreakfast commented 1 year ago

Resolved in PR https://github.com/OnionIoT/openwrt-sdk-wrapper/pull/10 Closing this issue