Skip to contentSkip to conversation

package.py: fix Darwin support

PATCH Superseded [email protected] 2 participants 3 messages Jan 12, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package.py: fix Darwin support

From: Etienne Cordonnier <[email protected]>

---
 meta/lib/oe/package.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/lib/oe/package.py +3 -3
index 9a465eaa09..635efc9763 100644
@@ -1615,7 +1615,7 @@ def process_shlibs(pkgfiles, d):
                     sonames.add(prov)
         if file.endswith('.dylib') or file.endswith('.so'):
             rpath = []
-            p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+            p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
             out, err = p.communicate()
             # If returned successfully, process stdout for results
             if p.returncode == 0:
@@ -1624,7 +1624,7 @@ def process_shlibs(pkgfiles, d):
                     if l.startswith('path '):
                         rpath.append(l.split()[1])
 
-        p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
         out, err = p.communicate()
         # If returned successfully, process stdout for results
         if p.returncode == 0:
@@ -1686,7 +1686,7 @@ def process_shlibs(pkgfiles, d):
                 soname = None
                 if cpath.islink(file):
                     continue
-                if hostos == "darwin" or hostos == "darwin8":
+                if hostos.startswith("darwin"):
                     darwin_so(file, needed, sonames, renames, pkgver)
                 elif hostos.startswith("mingw"):
                     mingw_dll(file, needed, sonames, renames, pkgver)
Signature · 1 line
2.36.1.vfs.0.0
#1 lore raw

The universal_newlines=True changes need to be explained in the commit message. Why are they added?

The need for hostos.startswith("darwin") is easier to guess, but that too, needs an explanation.

Alex

Quoted 52 lines · Etienne Cordonnier via lists.openembedded.org

From: Etienne Cordonnier <[email protected]>

---
 meta/lib/oe/package.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/lib/oe/package.py +3 -4
index 9a465eaa09..635efc9763 100644
@@ -1615,7 +1615,7 @@ def process_shlibs(pkgfiles, d):
                     sonames.add(prov)
         if file.endswith('.dylib') or file.endswith('.so'):
             rpath = []
-            p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+            p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
             out, err = p.communicate()
             # If returned successfully, process stdout for results
             if p.returncode == 0:
@@ -1624,7 +1624,7 @@ def process_shlibs(pkgfiles, d):
                     if l.startswith('path '):
                         rpath.append(l.split()[1])
 
-        p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)
         out, err = p.communicate()
         # If returned successfully, process stdout for results
         if p.returncode == 0:
@@ -1686,7 +1686,7 @@ def process_shlibs(pkgfiles, d):
                 soname = None
                 if cpath.islink(file):
                     continue
-                if hostos == "darwin" or hostos == "darwin8":
+                if hostos.startswith("darwin"):
                     darwin_so(file, needed, sonames, renames, pkgver)
                 elif hostos.startswith("mingw"):
                     mingw_dll(file, needed, sonames, renames, pkgver)
--

2.36.1.vfs.0.0

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

#2 lore raw

hi Alex,
as far as I know, universal_newlines=True is always required when executing commands which produce text. I'll send an updated commit, but it's already used a lot in the code-base, so I didn't think it needed an explanation. See this example:

Quoted 1 line
Quoted 1 line
Quoted 1 line

p = subprocess.Popen(['ls', '-l'], stdout=subprocess.PIPE,

stderr=subprocess.PIPE)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

stdout, stderr = p.communicate()
print(stdout)

b'total 32\ndrwxrwxr-x 2 ecordonnier ecordonnier 4096 Sep 19 13:43 classes\ndrwxrwxr-x 3 ecordonnier ecordonnier 4096 Aug 31 17:32 conf\n-rw-rw-r-- 1 ecordonnier ecordonnier 1023 Jun 23 2022 COPYING.MIT\n-rw-rw-r-- 1 ecordonnier ecordonnier 1946 Sep 19 13:43 README\ndrwxrwxr-x 5 ecordonnier ecordonnier 4096 Jun 23 2022 recipes-core\ndrwxrwxr-x 13 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-devtools\ndrwxrwxr-x 3 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-extended\ndrwxrwxr-x 5 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-support\n'

Quoted 1 line
Quoted 1 line
Quoted 1 line

p = subprocess.Popen(['ls', '-l'], stdout=subprocess.PIPE,

stderr=subprocess.PIPE, universal_newlines=True)

Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

stdout, stderr = p.communicate()
print(stdout)

total 32

drwxrwxr-x  2 ecordonnier ecordonnier 4096 Sep 19 13:43 classes
drwxrwxr-x  3 ecordonnier ecordonnier 4096 Aug 31 17:32 conf
-rw-rw-r--  1 ecordonnier ecordonnier 1023 Jun 23  2022 COPYING.MIT
-rw-rw-r--  1 ecordonnier ecordonnier 1946 Sep 19 13:43 README
drwxrwxr-x  5 ecordonnier ecordonnier 4096 Jun 23  2022 recipes-core

drwxrwxr-x 13 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-devtools drwxrwxr-x 3 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-extended drwxrwxr-x 5 ecordonnier ecordonnier 4096 Aug 31 17:32 recipes-support

Quoted 74 lines · Alexander Kanavin

The universal_newlines=True changes need to be explained in the commit message. Why are they added?

The need for hostos.startswith("darwin") is easier to guess, but that too, needs an explanation.

Alex

Quoted 14 lines · Etienne Cordonnier via lists.openembedded.org

From: Etienne Cordonnier <[email protected]>

---
 meta/lib/oe/package.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta/lib/oe/package.py +0 -0
index 9a465eaa09..635efc9763 100644

meta/lib/oe/package.py def process_shlibs(pkgfiles, d): · line 1618

Quoted 4 lines
meta/lib/oe/package.py +0 -1
@@ -1615,7 +1615,7 @@ def process_shlibs(pkgfiles, d):
                     sonames.add(prov)
         if file.endswith('.dylib') or file.endswith('.so'):
             rpath = []
-            p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"),

'-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

meta/lib/oe/package.py def process_shlibs(pkgfiles, d): · line 1618

Quoted 1 line
meta/lib/oe/package.py +1 -0
+            p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"),

'-l', file], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)

meta/lib/oe/package.py def process_shlibs(pkgfiles, d): · line 1627

Quoted 8 lines
meta/lib/oe/package.py +0 -1
             out, err = p.communicate()
             # If returned successfully, process stdout for results
             if p.returncode == 0:
@@ -1624,7 +1624,7 @@ def process_shlibs(pkgfiles, d):
                     if l.startswith('path '):
                         rpath.append(l.split()[1])
 
-        p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L',

file], stdout=subprocess.PIPE, stderr=subprocess.PIPE)

meta/lib/oe/package.py def process_shlibs(pkgfiles, d): · line 1627

Quoted 1 line
meta/lib/oe/package.py +1 -0
+        p = subprocess.Popen([d.expand("${HOST_PREFIX}otool"), '-L',

file], stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True)

Quoted 16 lines
meta/lib/oe/package.py +1 -2
         out, err = p.communicate()
         # If returned successfully, process stdout for results
         if p.returncode == 0:
@@ -1686,7 +1686,7 @@ def process_shlibs(pkgfiles, d):
                 soname = None
                 if cpath.islink(file):
                     continue
-                if hostos == "darwin" or hostos == "darwin8":
+                if hostos.startswith("darwin"):
                     darwin_so(file, needed, sonames, renames, pkgver)
                 elif hostos.startswith("mingw"):
                     mingw_dll(file, needed, sonames, renames, pkgver)
--

2.36.1.vfs.0.0

Quoted 3 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#193581):

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Dcore_message_193581&d=DwIBaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=bC-1l9s8NypI08MIH0GkVOLZuK5GhN-8HKGWDd14XzEPV0hokRSMnQool8P_UxeE&s=3np-oDcl19G26iJYYe4LYKJh8dR8GfPupB3gN-3ePOc&e=

Quoted 1 line

Mute This Topic:

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_mt_103682827_1686489&d=DwIBaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=bC-1l9s8NypI08MIH0GkVOLZuK5GhN-8HKGWDd14XzEPV0hokRSMnQool8P_UxeE&s=2J7mVEMxvnhNr7-F0orRggogqKQzpe1eSjFnvgmGeVU&e=

Quoted 2 lines

Group Owner: [email protected] Unsubscribe:

https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.openembedded.org_g_openembedded-2Dcore_unsub&d=DwIBaQ&c=ncDTmphkJTvjIDPh0hpF_4vCHvabgGkICC2epckfdiw&r=AhkbNonVuMIGRfPx_Qj9TsRih1DULJTKUkSGa66m67E&m=bC-1l9s8NypI08MIH0GkVOLZuK5GhN-8HKGWDd14XzEPV0hokRSMnQool8P_UxeE&s=iGAXfy_qbvatFl0SoKFI9C8WHypiYGpcAvA1eaP4F8Q&e=
[[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-