Skip to contentSkip to conversation

lib/oe/package-manager: return early in install_complementary with empty globs

PATCH In review Claus Stovgaard 2 participants 5 messages Sep 26, 2024 – Oct 7, 2024

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 lib/oe/package-manager: return early in install_complementary with empty globs

Return early when globs is either None or an empty string. If globs is an empty string from the self.d.getVar, we should skip the reset of install_complementary, as the result from processing with empty glob in oe-pkgdata-util will always be 0 packages to install.

---
 meta/lib/oe/package_manager/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta/lib/oe/package_manager/__init__.py +1 -1
index d3b2317894..1d923c436e 100644
@@ -365,7 +365,7 @@ class PackageManager(object, metaclass=ABCMeta):
                 for complementary_linguas in (self.d.getVar('IMAGE_LINGUAS_COMPLEMENTARY') or "").split():
                     globs += (" " + complementary_linguas) % lang
 
-        if globs is None:
+        if not globs:
             return
 
         # we need to write the list of installed packages to a file because the
Signature · 1 line
2.45.2
#1 lore raw
Quoted 5 lines · Claus Stovgaard via lists.openembedded.org

Return early when globs is either None or an empty string. If globs is an empty string from the self.d.getVar, we should skip the reset of install_complementary, as the result from processing with empty glob in oe-pkgdata-util will always be 0 packages to install.

This isn’t right: if the globs are empty then we can skip the processing of the globs, but this function also contains the locale archive generation which is then skipped.

Ideally this function is tidied up a little as locale archive generation isn’t really related to complementary installation.

Ross

#2 lore raw
Quoted 10 lines · Ross Burton
Quoted 7 lines · Claus Stovgaard via lists.openembedded.org

Return early when globs is either None or an empty string. If globs is
an empty string from the self.d.getVar, we should skip the reset of install_complementary, as the result from processing with empty glob in
oe-pkgdata-util will always be 0 packages to install.

Quoted 4 lines

This isn’t right: if the globs are empty then we can skip the processing of the globs, but this function also contains the locale archive generation which is then skipped.

Oh yes - you are correct. I focused to much on the top part, and the with loop, so somehow it slipped. Nicely catch.

I see 3 options.

1) drop this patch, and keep doing the extra work.

2) invert the condition and move the with loop in under this condition

3) split the archiving out in seperate method, and then call it after install_complementary the places where install_complementary is called from. This option is what I belive you refering to below.

What do you think is the best options?

/Claus

Quoted 4 lines

Ideally this function is tidied up a little as locale archive generation isn’t really related to complementary installation.

Ross

#3 lore raw
Quoted 24 lines · On 1 Oct 2024, at 08:52, [email protected] wrote:
Quoted 10 lines · Ross Burton
Quoted 7 lines · Claus Stovgaard via lists.openembedded.org

Return early when globs is either None or an empty string. If globs is
an empty string from the self.d.getVar, we should skip the reset of install_complementary, as the result from processing with empty glob in
oe-pkgdata-util will always be 0 packages to install.

Quoted 4 lines

This isn’t right: if the globs are empty then we can skip the processing of the globs, but this function also contains the locale archive generation which is then skipped.

Oh yes - you are correct. I focused to much on the top part, and the with loop, so somehow it slipped. Nicely catch.

I see 3 options.

1) drop this patch, and keep doing the extra work.

Quoted 7 lines

2) invert the condition and move the with loop in under this condition

3) split the archiving out in seperate method, and then call it after install_complementary the places where install_complementary is called from. This option is what I belive you refering to below.

What do you think is the best options?

(3) but moving the logic somewhere so callers don’t need to be updated would be ideal, if possible. (2) if not.

Ross

#4 lore raw
Quoted 39 lines · Ross Burton
Quoted 38 lines · On 1 Oct 2024, at 08:52, [email protected] wrote:
Quoted 13 lines · Ross Burton
Quoted 9 lines · Claus Stovgaard via lists.openembedded.org

Return early when globs is either None or an empty string. If globs
is
an empty string from the self.d.getVar, we should skip the reset of
install_complementary, as the result from processing with empty glob in
oe-pkgdata-util will always be 0 packages to install.

Quoted 5 lines

This isn’t right: if the globs are empty then we can skip the processing of the globs, but this function also contains the locale
archive generation which is then skipped.

Oh yes - you are correct. I focused to much on the top part, and the
with loop, so somehow it slipped. Nicely catch.

I see 3 options.

1) drop this patch, and keep doing the extra work.

2) invert the condition and move the with loop in under this condition

3) split the archiving out in seperate method, and then call it after
install_complementary the places where install_complementary is called
from. This option is what I belive you refering to below.

Quoted 4 lines
Quoted 1 line

What do you think is the best options?

(3) but moving the logic somewhere so callers don’t need to be updated would be ideal, if possible.  (2) if not.

I looked to see if I could move the generate_locale_archive logic to somewhere, where the callers don't need to be updated. I could not find a place where it would fit, so I will send option 2 as version 3 of the patch

Regards Claus

Quoted 2 lines

Ross