Hi Quentin,

On 02.05.24 19:19, Quentin Schulz wrote:
Sent from outside the BMW organization  - be CAUTIOUS, particularly with links and attachments. Absender außerhalb der BMW Organisation - Bitte VORSICHT beim Öffnen von Links und Anhängen. -----------------------------------------------------------------------------------------------

Hi Philip,

On 5/2/24 4:27 PM, Philip Lorenz via lists.openembedded.org wrote:
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

The chosen payload compression algorithm can be changed by overriding
`OPKGBUILDCMD`. Ensure that package extraction deals with this by
globbing for "data.tar.*" to select the actual payload tarball.

Signed-off-by: Philip Lorenz <[email protected]>
---
  meta/lib/oe/package_manager/ipk/__init__.py | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/meta/lib/oe/package_manager/ipk/__init__.py b/meta/lib/oe/package_manager/ipk/__init__.py
index 8cc9953a027..0f0038d00d9 100644
--- a/meta/lib/oe/package_manager/ipk/__init__.py
+++ b/meta/lib/oe/package_manager/ipk/__init__.py
@@ -4,6 +4,7 @@
  # SPDX-License-Identifier: GPL-2.0-only
  #

+import glob
  import re
  import shutil
  import subprocess
@@ -134,11 +135,16 @@ class OpkgDpkgPM(PackageManager):
          tmp_dir = tempfile.mkdtemp()
          current_dir = os.getcwd()
          os.chdir(tmp_dir)
-        data_tar = 'data.tar.zst'

          try:
              cmd = [ar_cmd, 'x', pkg_path]
              output = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
+            data_tar = glob.glob("data.tar.*")

What happens if we have two consecutive builds with the same build directory but different compression algorithms? Would we have two data.tar.* matches?

Each call to extract() creates a new temporary directory into which the content of that particular IPK are extracted. IPKs should contain only one data tarball and as such the described scenario should never occur (and the length check I added is a merely a safety measure).

I initially considered introducing a dedicated variable to specify the IPK compression algorithm, but this would have also required to introduce

* another variable for the parametrization of said algorithm (see ZSTD_DEFAULTS, XZ_DEFAULTS) * a mapping from opkg-build algorithm name to the actual file extension (see [1])

This seems overly complex when a glob achieves the same effect so I went for the submitted solution instead.

Br,

Philip

[1] https://git.yoctoproject.org/opkg-utils/tree/opkg-build#n157

--
Philip Lorenz
BMW Car IT GmbH, Software-Plattform, -Integration Connected Company, 
Lise-Meitner-Straße 14, 89081 Ulm
-------------------------------------------------------------------------
BMW Car IT GmbH
Management: Chris Brandt and Michael Böttrich
Domicile and Court of Registry: München HRB 134810
-------------------------------------------------------------------------

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#198930): 
https://lists.openembedded.org/g/openembedded-core/message/198930
Mute This Topic: https://lists.openembedded.org/mt/105863603/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to